Skip to content

Commit

Permalink
should fix a bug with random sourceAnchor (to check later)
Browse files Browse the repository at this point in the history
  • Loading branch information
badetitou committed Jan 14, 2021
1 parent 5602555 commit 0a44321
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Famix2Java/FAMIX2JavaVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,15 @@ FAMIX2JavaVisitor >> visitAttribute: aAttribute [

" Printing the annotations for the attribute"

| attributeSource attributeSourceFromName |
aAttribute annotationInstances
do: [ :annotationInstance |
self clone visit: annotationInstance.
self crlf ].

"Printing modifiers"
self indent.
aAttribute modifiers
(aAttribute cacheAt: #modifiers ifAbsent: [ aAttribute modifiers ])
do: [ :modifier |
self
<<< modifier;
Expand All @@ -244,10 +245,14 @@ FAMIX2JavaVisitor >> visitAttribute: aAttribute [
self
space;
<<< aAttribute name.
(aAttribute sourceAnchor sourceText includesSubstring: '=')

"This is an hack to get the affectation is any (hack because some problems with annotations that are sometimes part of the sourceAnchor...)"
attributeSource := aAttribute sourceAnchor sourceText.
attributeSourceFromName := attributeSource copyFrom: (attributeSource findString: aAttribute name) to: attributeSource size.
(attributeSourceFromName includesSubstring: '=')
ifTrue: [ self
space;
<<< (aAttribute sourceAnchor sourceText copyFrom: (aAttribute sourceAnchor sourceText findString: '=') to: aAttribute sourceAnchor sourceText size) ].
<<< (attributeSourceFromName copyFrom: (attributeSourceFromName findString: '=') to: attributeSourceFromName size) ].
self <<< ';'
]

Expand Down

0 comments on commit 0a44321

Please sign in to comment.