--- a/StatementNode.st Sat Aug 08 22:49:53 2020 +0100
+++ b/StatementNode.st Tue Aug 25 12:20:06 2020 +0100
@@ -141,7 +141,6 @@
"Created: / 20-07-2011 / 19:52:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!StatementNode methodsFor:'code generation'!
codeAllForSideEffectOn:aStream inBlock:b for:aCompiler
@@ -194,6 +193,30 @@
!StatementNode methodsFor:'enumerating'!
+allMessageSelectorsDo:aBlock
+ "evaluate aBlock for each message-selector sent by this statement and all followup statements"
+
+ |s|
+
+ s := self.
+ [s notNil] whileTrue:[
+ s messageSelectorsDo:aBlock.
+ s := s nextStatement
+ ].
+!
+
+allMessagesDo:aBlock
+ "evaluate aBlock for each message-node sent by this statement and all followup statements"
+
+ |s|
+
+ s := self.
+ [s notNil] whileTrue:[
+ s messagesDo:aBlock.
+ s := s nextStatement
+ ].
+!
+
allNodesDo:aBlock
"evaluate aBlock for each node in this node and subnodes"
@@ -230,6 +253,12 @@
"Created: / 15-07-2018 / 10:34:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+childrenDo:aBlock
+ expression notNil ifTrue:[
+ aBlock value:expression
+ ].
+!
+
do:aBlock
"in st/x, statements is a linked list (not an ordered collection),
this provides some dialect compatibility (for st2js)"
@@ -250,25 +279,17 @@
|s e|
- s := self.
- [s notNil] whileTrue:[
- e := s expression.
- e notNil ifTrue:[e messageSelectorsDo:aBlock].
- s := s nextStatement
- ].
+ e := self expression.
+ e notNil ifTrue:[e messageSelectorsDo:aBlock].
!
messagesDo:aBlock
"evaluate aBlock for each message-node sent by this node and subnodes"
- |s e|
+ |e|
- s := self.
- [s notNil] whileTrue:[
- e := s expression.
- e notNil ifTrue:[e messagesDo:aBlock].
- s := s nextStatement
- ].
+ e := self expression.
+ e notNil ifTrue:[e messagesDo:aBlock].
!
nodeDo:anEnumerator
@@ -308,7 +329,6 @@
].
! !
-
!StatementNode methodsFor:'evaluation'!
evaluateAllIn:anEnvironment