added node-walk facility (ST80 compatibility)
authorClaus Gittinger <cg@exept.de>
Thu, 19 Jun 1997 16:58:23 +0200
changeset 539 69a1cd05c7d6
parent 538 54f8491a9ea3
child 540 642f56fab795
added node-walk facility (ST80 compatibility)
AssignNd.st
AssignmentNode.st
BlockNode.st
CascadeNd.st
CascadeNode.st
ConstNode.st
ConstantNode.st
ImmArray.st
ImmutableArray.st
MessageNd.st
MessageNode.st
RetNode.st
ReturnNode.st
StatNode.st
StatementNode.st
VarNode.st
VariableNode.st
--- a/AssignNd.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/AssignNd.st	Thu Jun 19 16:58:23 1997 +0200
@@ -163,6 +163,16 @@
     "Modified: 1.3.1996 / 00:42:21 / cg"
 ! !
 
+!AssignmentNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doAssignment:self variable:variable value:expression
+
+    "Modified: 19.6.1997 / 16:37:50 / cg"
+! !
+
 !AssignmentNode methodsFor:'evaluating'!
 
 evaluate
@@ -197,5 +207,5 @@
 !AssignmentNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.23 1997-01-11 19:56:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.24 1997-06-19 14:57:38 cg Exp $'
 ! !
--- a/AssignmentNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/AssignmentNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -163,6 +163,16 @@
     "Modified: 1.3.1996 / 00:42:21 / cg"
 ! !
 
+!AssignmentNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doAssignment:self variable:variable value:expression
+
+    "Modified: 19.6.1997 / 16:37:50 / cg"
+! !
+
 !AssignmentNode methodsFor:'evaluating'!
 
 evaluate
@@ -197,5 +207,5 @@
 !AssignmentNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.23 1997-01-11 19:56:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.24 1997-06-19 14:57:38 cg Exp $'
 ! !
--- a/BlockNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/BlockNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -387,6 +387,16 @@
     "Modified: 23.10.1996 / 15:40:46 / cg"
 ! !
 
+!BlockNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doBlock:self arguments:blockArgs body:statements
+
+    "Created: 19.6.1997 / 16:38:30 / cg"
+! !
+
 !BlockNode methodsFor:'evaluating'!
 
 evaluate
@@ -668,5 +678,5 @@
 !BlockNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.37 1997-06-18 10:06:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.38 1997-06-19 14:58:23 cg Exp $'
 ! !
--- a/CascadeNd.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/CascadeNd.st	Thu Jun 19 16:58:23 1997 +0200
@@ -56,6 +56,18 @@
     self codeSendOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
 ! !
 
+!CascadeNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    self halt:'not yet compatible'.
+    ^ anEnumerator doCascade:self receiver:receiver messages:argArray
+
+    "Created: 19.6.1997 / 16:39:17 / cg"
+    "Modified: 19.6.1997 / 16:40:00 / cg"
+! !
+
 !CascadeNode methodsFor:'evaluating'!
 
 evaluate
@@ -141,5 +153,5 @@
 !CascadeNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/CascadeNd.st,v 1.15 1996-04-25 17:09:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/CascadeNd.st,v 1.16 1997-06-19 14:58:12 cg Exp $'
 ! !
--- a/CascadeNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/CascadeNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -56,6 +56,18 @@
     self codeSendOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
 ! !
 
+!CascadeNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    self halt:'not yet compatible'.
+    ^ anEnumerator doCascade:self receiver:receiver messages:argArray
+
+    "Created: 19.6.1997 / 16:39:17 / cg"
+    "Modified: 19.6.1997 / 16:40:00 / cg"
+! !
+
 !CascadeNode methodsFor:'evaluating'!
 
 evaluate
@@ -141,5 +153,5 @@
 !CascadeNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/CascadeNode.st,v 1.15 1996-04-25 17:09:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/CascadeNode.st,v 1.16 1997-06-19 14:58:12 cg Exp $'
 ! !
--- a/ConstNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/ConstNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -205,6 +205,16 @@
     ^ self error:'assignment to literals not allowed'
 ! !
 
+!ConstantNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doLiteral:self value:value
+
+    "Modified: 19.6.1997 / 16:40:59 / cg"
+! !
+
 !ConstantNode methodsFor:'evaluating'!
 
 evaluate
@@ -269,5 +279,5 @@
 !ConstantNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ConstNode.st,v 1.22 1996-04-25 17:08:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ConstNode.st,v 1.23 1997-06-19 14:57:42 cg Exp $'
 ! !
--- a/ConstantNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/ConstantNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -205,6 +205,16 @@
     ^ self error:'assignment to literals not allowed'
 ! !
 
+!ConstantNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doLiteral:self value:value
+
+    "Modified: 19.6.1997 / 16:40:59 / cg"
+! !
+
 !ConstantNode methodsFor:'evaluating'!
 
 evaluate
@@ -269,5 +279,5 @@
 !ConstantNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ConstantNode.st,v 1.22 1996-04-25 17:08:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ConstantNode.st,v 1.23 1997-06-19 14:57:42 cg Exp $'
 ! !
--- a/ImmArray.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/ImmArray.st	Thu Jun 19 16:58:23 1997 +0200
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:57'                   !
-
 Array subclass:#ImmutableArray
 	instanceVariableNames:''
 	classVariableNames:''
@@ -19,7 +17,7 @@
 	category:'System-Compiler-Support'
 !
 
-!ImmutableArray  class methodsFor:'documentation'!
+!ImmutableArray class methodsFor:'documentation'!
 
 copyright
 "
@@ -188,8 +186,8 @@
     ^ super becomeNil
 ! !
 
-!ImmutableArray  class methodsFor:'documentation'!
+!ImmutableArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmArray.st,v 1.15 1996-06-28 15:32:42 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmArray.st,v 1.16 1997-06-19 14:57:04 cg Exp $'
 ! !
--- a/ImmutableArray.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/ImmutableArray.st	Thu Jun 19 16:58:23 1997 +0200
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:57'                   !
-
 Array subclass:#ImmutableArray
 	instanceVariableNames:''
 	classVariableNames:''
@@ -19,7 +17,7 @@
 	category:'System-Compiler-Support'
 !
 
-!ImmutableArray  class methodsFor:'documentation'!
+!ImmutableArray class methodsFor:'documentation'!
 
 copyright
 "
@@ -188,8 +186,8 @@
     ^ super becomeNil
 ! !
 
-!ImmutableArray  class methodsFor:'documentation'!
+!ImmutableArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmutableArray.st,v 1.15 1996-06-28 15:32:42 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmutableArray.st,v 1.16 1997-06-19 14:57:04 cg Exp $'
 ! !
--- a/MessageNd.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/MessageNd.st	Thu Jun 19 16:58:23 1997 +0200
@@ -1675,6 +1675,16 @@
     ^ nil
 ! !
 
+!MessageNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doMessage:self receiver:receiver selector:selector arguments:argArray
+
+    "Created: 19.6.1997 / 16:46:39 / cg"
+! !
+
 !MessageNode methodsFor:'evaluating'!
 
 evaluate
@@ -1872,5 +1882,5 @@
 !MessageNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.67 1997-06-19 06:41:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.68 1997-06-19 14:58:02 cg Exp $'
 ! !
--- a/MessageNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/MessageNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -1675,6 +1675,16 @@
     ^ nil
 ! !
 
+!MessageNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doMessage:self receiver:receiver selector:selector arguments:argArray
+
+    "Created: 19.6.1997 / 16:46:39 / cg"
+! !
+
 !MessageNode methodsFor:'evaluating'!
 
 evaluate
@@ -1872,5 +1882,5 @@
 !MessageNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.67 1997-06-19 06:41:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.68 1997-06-19 14:58:02 cg Exp $'
 ! !
--- a/RetNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/RetNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -167,6 +167,16 @@
     "Modified: 21.10.1996 / 14:54:36 / cg"
 ! !
 
+!ReturnNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doReturn:self value:expression
+
+    "Modified: 19.6.1997 / 16:42:40 / cg"
+! !
+
 !ReturnNode methodsFor:'evaluating'!
 
 evaluateExpression
@@ -201,5 +211,5 @@
 !ReturnNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/RetNode.st,v 1.19 1996-10-23 15:31:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/RetNode.st,v 1.20 1997-06-19 14:57:29 cg Exp $'
 ! !
--- a/ReturnNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/ReturnNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -167,6 +167,16 @@
     "Modified: 21.10.1996 / 14:54:36 / cg"
 ! !
 
+!ReturnNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doReturn:self value:expression
+
+    "Modified: 19.6.1997 / 16:42:40 / cg"
+! !
+
 !ReturnNode methodsFor:'evaluating'!
 
 evaluateExpression
@@ -201,5 +211,5 @@
 !ReturnNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ReturnNode.st,v 1.19 1996-10-23 15:31:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ReturnNode.st,v 1.20 1997-06-19 14:57:29 cg Exp $'
 ! !
--- a/StatNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/StatNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -112,6 +112,26 @@
     expression codeOn:aStream inBlock:b for:aCompiler
 ! !
 
+!StatementNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    |stats this|
+
+    "/ too stupid: ST/X statements are linked as a list ...
+
+    stats := OrderedCollection new.
+    this := self.
+    [this notNil] whileTrue:[
+        stats add:this.
+        this := this nextStatement
+    ].
+    ^ anEnumerator doSequence:self temporaries:#() statements:stats
+
+    "Created: 19.6.1997 / 16:45:34 / cg"
+! !
+
 !StatementNode methodsFor:'evaluating'!
 
 evaluate
@@ -195,5 +215,5 @@
 !StatementNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.18 1997-04-20 10:14:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.19 1997-06-19 14:57:34 cg Exp $'
 ! !
--- a/StatementNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/StatementNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -112,6 +112,26 @@
     expression codeOn:aStream inBlock:b for:aCompiler
 ! !
 
+!StatementNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    |stats this|
+
+    "/ too stupid: ST/X statements are linked as a list ...
+
+    stats := OrderedCollection new.
+    this := self.
+    [this notNil] whileTrue:[
+        stats add:this.
+        this := this nextStatement
+    ].
+    ^ anEnumerator doSequence:self temporaries:#() statements:stats
+
+    "Created: 19.6.1997 / 16:45:34 / cg"
+! !
+
 !StatementNode methodsFor:'evaluating'!
 
 evaluate
@@ -195,5 +215,5 @@
 !StatementNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.18 1997-04-20 10:14:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.19 1997-06-19 14:57:34 cg Exp $'
 ! !
--- a/VarNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/VarNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -415,6 +415,16 @@
     "Modified: 29.2.1996 / 23:54:38 / cg"
 ! !
 
+!VariableNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doVariable:self name:name
+
+    "Created: 19.6.1997 / 16:41:35 / cg"
+! !
+
 !VariableNode methodsFor:'evaluating'!
 
 evaluate
@@ -559,5 +569,5 @@
 !VariableNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.26 1997-06-18 10:07:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.27 1997-06-19 14:57:23 cg Exp $'
 ! !
--- a/VariableNode.st	Thu Jun 19 16:56:42 1997 +0200
+++ b/VariableNode.st	Thu Jun 19 16:58:23 1997 +0200
@@ -415,6 +415,16 @@
     "Modified: 29.2.1996 / 23:54:38 / cg"
 ! !
 
+!VariableNode methodsFor:'enumeration'!
+
+nodeDo:anEnumerator
+    "helper for parse tree walking"
+
+    ^ anEnumerator doVariable:self name:name
+
+    "Created: 19.6.1997 / 16:41:35 / cg"
+! !
+
 !VariableNode methodsFor:'evaluating'!
 
 evaluate
@@ -559,5 +569,5 @@
 !VariableNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.26 1997-06-18 10:07:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.27 1997-06-19 14:57:23 cg Exp $'
 ! !