Skip to content

Commit bdd01e5

Browse files
committed
fix export attribute
improve parameter export style
1 parent 4f4db03 commit bdd01e5

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

src/Famix2Java/FAMIX2JavaVisitor.class.st

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -197,27 +197,16 @@ FAMIX2JavaVisitor >> visitAnnotationInstanceAttribute: aAnnotationInstanceAttrib
197197
FAMIX2JavaVisitor >> visitAttribute: aAttribute [
198198
"Visit an attribute to print its annotations and its field."
199199

200-
| body |
201200
" Printing the annotations for the attribute"
202201
aAttribute annotationInstances
203202
do: [ :annotationInstance |
204203
self clone visit: annotationInstance.
205204
self crlf ].
206205

207206
"Printing modifiers"
208-
aAttribute modifiers
209-
ifNotEmpty: [ self
210-
<< aAttribute modifiers first;
211-
space ].
212-
2 to: aAttribute modifiers size - 1 do: [ :index |
213-
self
214-
space;
215-
<<< (aAttribute modifiers at: index) ].
216-
aAttribute modifiers size > 1
217-
ifTrue: [ self
218-
<<< aAttribute modifiers last;
219-
space ].
220-
207+
self indent.
208+
aAttribute modifiers do: [ :modifier | self <<< modifier; space ].
209+
221210
"Declared Type"
222211
self printDeclaredType: aAttribute declaredType.
223212
"Attribute name"
@@ -226,15 +215,8 @@ FAMIX2JavaVisitor >> visitAttribute: aAttribute [
226215
<<< aAttribute name;
227216
space.
228217
(aAttribute sourceAnchor sourceText includesSubstring: '=')
229-
ifTrue: [ body := aAttribute sourceAnchor sourceText
230-
copyFrom: (aAttribute sourceAnchor sourceText findString: '=')
231-
to:
232-
(aAttribute sourceAnchor sourceText
233-
findLastOccurrenceOfString: ';'
234-
startingAt: 0) ].
235-
body isNotNil
236-
ifTrue: [ self <<< body ]
237-
ifFalse: [ self <<< ';' ]
218+
ifTrue: [ self <<< (aAttribute sourceAnchor sourceText copyFrom: (aAttribute sourceAnchor sourceText findString: '=') to: aAttribute sourceAnchor sourceText size) ].
219+
self <<< ';'
238220
]
239221

240222
{ #category : #accessing }
@@ -320,7 +302,9 @@ FAMIX2JavaVisitor >> visitMethod: aMethod [
320302
ifFalse: [ self
321303
<<< aMethod name;
322304
<<< '('.
323-
aMethod parameters do: [ :parameter | self clone visit: parameter ] separatedBy: [ self <<< ',' ].
305+
(aMethod parameters sorted: [ :p :p2 | p sourceAnchor startPos < p2 sourceAnchor startPos ])
306+
do: [ :parameter | self clone visit: parameter ]
307+
separatedBy: [ self <<< ', ' ].
324308
self <<< ')' ]
325309
ifTrue: [ self << 'static' ].
326310
"Printing body of method if class is not abstract or an interface"

0 commit comments

Comments
 (0)