Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not use #originalSource when pretty printing with SimpleFormatter. F…
…ixes #5587
  • Loading branch information
MarcusDenker committed Jan 30, 2020
1 parent a8a91c2 commit 562861a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/AST-Core/RBSimpleFormatter.class.st
Expand Up @@ -11,7 +11,6 @@ Class {
#instVars : [
'codeStream',
'indent',
'originalSource',
'lineStart'
],
#classVars : [
Expand Down Expand Up @@ -60,7 +59,7 @@ RBSimpleFormatter >> addSpaceIfNeededForLastArgument: aPragmaNode [
{ #category : #private }
RBSimpleFormatter >> basicFormatCommentFor: aComment [

codeStream nextPutAll: (originalSource copyFrom: aComment start to: aComment stop)
codeStream nextPutAll: aComment contents
]

{ #category : #private }
Expand All @@ -84,7 +83,6 @@ RBSimpleFormatter >> codeStream: anObject [

{ #category : #'public interface' }
RBSimpleFormatter >> format: aParseTree [
originalSource := aParseTree source.
self visitNode: aParseTree.
^ codeStream contents
]
Expand Down Expand Up @@ -127,9 +125,7 @@ RBSimpleFormatter >> formatBlockArgumentsFor: aBlockNode [
{ #category : #'private-formatting' }
RBSimpleFormatter >> formatCommentsFor: aNode [

originalSource ifNil: [ ^ self ].
aNode comments
do: [ :each |
aNode comments do: [ :each |
self
basicFormatCommentFor: each;
newLine
Expand All @@ -150,9 +146,7 @@ RBSimpleFormatter >> formatMethodBodyFor: aMethodNode [
{ #category : #'private-formatting' }
RBSimpleFormatter >> formatMethodCommentFor: aNode [

originalSource ifNil: [ ^ self ].
aNode comments
do: [ :each |
aNode comments do: [ :each |
self
basicFormatCommentFor: each;
newLine
Expand Down Expand Up @@ -220,9 +214,7 @@ RBSimpleFormatter >> formatSequenceNodeStatementsFor: aSequenceNode [
{ #category : #'private-formatting' }
RBSimpleFormatter >> formatStatementCommentsFor: aStatementNode [

originalSource ifNil: [ ^ self ].
aStatementNode statementComments
do: [ :each |
aStatementNode statementComments do: [ :each |
self
newLine;
basicFormatCommentFor: each
Expand Down

0 comments on commit 562861a

Please sign in to comment.