Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBSequenceNode: #stop does not take temp definitions into account #4045

Closed
MarcusDenker opened this issue Jul 22, 2019 · 2 comments
Closed

Comments

@MarcusDenker
Copy link
Member

We have found that #stop for SquenceNode is wrong if there are no statements but temp definitions. e.g. method | temp |
the stop of the temp is correct, just RBSequenceNode returns 0.

A possible fix:

stop
	| tempDefinitionStop |
	tempDefinitionStop := (self temporaries isNotEmpty) 
		ifTrue: [ self temporaries last stop  ]
	 	ifFalse: [ 0 ]. 
	
	^(periods isEmpty ifTrue: [tempDefinitionStop] ifFalse: [periods last]) 
		max: (statements isEmpty ifTrue: [tempDefinitionStop] ifFalse: [statements last stop])
@MarcusDenker
Copy link
Member Author

strongly I can not push

stop

^{  
temporaries isEmpty ifTrue: [0] ifFalse: [ self temporaries last stop]. 
periods isEmpty ifTrue: [0] ifFalse: [periods last].
statements isEmpty ifTrue: [0] ifFalse: [statements last stop]
} max

and for a new RBSequenceNodeTest:

testStop
| ast |
ast := RBParser parseMethod: 'method | temp |'.
self assert: ast body stop equals: ast body temporaries last stop.

@MarcusDenker
Copy link
Member Author

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant