Skip to content

Commit 0a44321

Browse files
committed
should fix a bug with random sourceAnchor (to check later)
1 parent 5602555 commit 0a44321

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Famix2Java/FAMIX2JavaVisitor.class.st

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,15 @@ FAMIX2JavaVisitor >> visitAttribute: aAttribute [
224224

225225
" Printing the annotations for the attribute"
226226

227+
| attributeSource attributeSourceFromName |
227228
aAttribute annotationInstances
228229
do: [ :annotationInstance |
229230
self clone visit: annotationInstance.
230231
self crlf ].
231232

232233
"Printing modifiers"
233234
self indent.
234-
aAttribute modifiers
235+
(aAttribute cacheAt: #modifiers ifAbsent: [ aAttribute modifiers ])
235236
do: [ :modifier |
236237
self
237238
<<< modifier;
@@ -244,10 +245,14 @@ FAMIX2JavaVisitor >> visitAttribute: aAttribute [
244245
self
245246
space;
246247
<<< aAttribute name.
247-
(aAttribute sourceAnchor sourceText includesSubstring: '=')
248+
249+
"This is an hack to get the affectation is any (hack because some problems with annotations that are sometimes part of the sourceAnchor...)"
250+
attributeSource := aAttribute sourceAnchor sourceText.
251+
attributeSourceFromName := attributeSource copyFrom: (attributeSource findString: aAttribute name) to: attributeSource size.
252+
(attributeSourceFromName includesSubstring: '=')
248253
ifTrue: [ self
249254
space;
250-
<<< (aAttribute sourceAnchor sourceText copyFrom: (aAttribute sourceAnchor sourceText findString: '=') to: aAttribute sourceAnchor sourceText size) ].
255+
<<< (attributeSourceFromName copyFrom: (attributeSourceFromName findString: '=') to: attributeSourceFromName size) ].
251256
self <<< ';'
252257
]
253258

0 commit comments

Comments
 (0)