--- a/compiler/TFormatter.st Sun Sep 20 12:01:42 2015 +0100
+++ b/compiler/TFormatter.st Tue Sep 22 17:43:38 2015 +0100
@@ -11,106 +11,6 @@
!TFormatter methodsFor:'visitor-double dispatching'!
-acceptInlineAssemblyNode:aBlockNode
- |seqNode multiline formattedBody formatter parent parentSelector|
-
- (CStyleBlocks
- and:[ (parent := aBlockNode parent) notNil and:[ parent isMessage ] ])
- ifTrue:
- [ parent receiver == aBlockNode
- ifTrue:
- [ " I am the receiver of a message (i.e. typically a control structure) "
- ^ self acceptInlineAssemblyNodeCStyle:aBlockNode ].
- parentSelector := parent selector.
- parentSelector == #timesRepeat:
- ifTrue:
- [ " I am the receiver of a message (i.e. typically a control structure) "
- self indent:-2 while:[ ^ self acceptInlineAssemblyNodeCStyle:aBlockNode ] ] ].
- seqNode := aBlockNode body.
- formatter := (self copy)
- lineStart:0;
- yourself.
- seqNode isNil ifTrue:[
- formattedBody := ''
- ] ifFalse:[
- formattedBody := formatter format:seqNode
- ].
- multiline := (self lineLength + formattedBody size > self maxLineSize)
- or:[ formatter isMultiLine ].
- (CStyleBlocks and:[ multiline ])
- ifTrue:
- [ self indent:-1 while:[ self acceptInlineAssemblyNodeCStyle:aBlockNode ].
- ^ self ].
- multiline ifTrue:[ self indent ].
- codeStream nextPutAll:'%['.
- SpaceAfterBlockStart
- ifTrue:
- [ (formattedBody notEmpty and:[ aBlockNode arguments isEmptyOrNil ])
- ifTrue:[ codeStream space. ] ].
- self formatBlockArguments:aBlockNode.
- aBlockNode arguments isEmpty
- ifFalse:
- [ codeStream nextPutAll:'| '.
- multiline ifTrue:[ self indent ] ].
- codeStream nextPutAll:formattedBody.
- SpaceBeforeBlockEnd
- ifTrue:[ formattedBody notEmpty ifTrue:[ codeStream space. ] ].
- codeStream nextPutAll:'%]'
-
- "Created: / 02-09-2015 / 06:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-acceptInlineAssemblyNodeCStyle: aBlockNode
- | seqNode l multiline formattedBody formatter |
-
- seqNode := aBlockNode body.
-
- formatter := (self copy) lineStart: 0; yourself.
- formatter indentWhile:[
- formattedBody := formatter format: seqNode.
-formattedBody asCollectionOfLines last isBlank ifTrue:[
- formattedBody := (formattedBody asCollectionOfLines copyButLast:1) asStringWith:Character cr.
-].
- ].
- multiline := (l := self lineLength + formattedBody size) > self maxLineSize
- or: [formatter isMultiLine].
- multiline := multiline or:[l > (MaxLengthForSingleLineBlocks ? 60)].
-
- codeStream nextPutAll:'%['.
- multiline ifFalse:[
- SpaceAfterBlockStart
- ifTrue:[
- (formattedBody notEmpty and:[aBlockNode hasArguments not])
- ifTrue:[
- codeStream space.]].
- ].
- self indentWhile:[
- (BlockArgumentsOnNewLine or:[aBlockNode hasArguments not]) ifTrue:[
- multiline ifTrue:[
- self indent.
- ].
- ].
-
- self formatBlockArguments:aBlockNode.
- aBlockNode arguments isEmpty
- ifFalse:[
- codeStream nextPutAll: '| '.
- multiline ifTrue: [self indent]].
- ].
- codeStream nextPutAll: formattedBody.
- multiline
- ifTrue: [self indent]
- ifFalse:[
- SpaceBeforeBlockEnd
- ifTrue:[
- formattedBody notEmpty
- ifTrue:[
- codeStream space.]]].
- codeStream nextPutAll:'%]'.
-
- "Created: / 02-09-2015 / 06:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
acceptSimpleTypeNode: aTSimpleTypeNode
codeStream nextPutAll: aTSimpleTypeNode name