equal
deleted
inserted
replaced
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 StatementNode subclass:#ReturnNode |
13 StatementNode subclass:#ReturnNode |
14 instanceVariableNames:'myHome blockHome' |
14 instanceVariableNames:'myHome blockHome' |
15 classVariableNames:'' |
15 classVariableNames:'' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'System-Compiler-Support' |
17 category:'System-Compiler-Support' |
18 ! |
18 ! |
19 |
19 |
20 !ReturnNode class methodsFor:'documentation'! |
20 !ReturnNode class methodsFor:'documentation'! |
21 |
21 |
22 copyright |
22 copyright |
31 other person. No title to or ownership of the software is |
31 other person. No title to or ownership of the software is |
32 hereby transferred. |
32 hereby transferred. |
33 " |
33 " |
34 ! |
34 ! |
35 |
35 |
36 version |
|
37 ^ '$Header: /cvs/stx/stx/libcomp/Attic/RetNode.st,v 1.12 1995-11-11 15:31:30 cg Exp $' |
|
38 ! |
|
39 |
|
40 documentation |
36 documentation |
41 " |
37 " |
42 node for parse-trees, representing return expressions |
38 node for parse-trees, representing return expressions |
43 " |
39 " |
|
40 ! |
|
41 |
|
42 version |
|
43 ^ '$Header: /cvs/stx/stx/libcomp/Attic/RetNode.st,v 1.13 1995-11-23 02:14:34 cg Exp $' |
44 ! ! |
44 ! ! |
45 |
45 |
46 !ReturnNode methodsFor:'accessing'! |
46 !ReturnNode methodsFor:'accessing'! |
47 |
47 |
48 home:someOne blockHome:aBlockNode |
48 home:someOne blockHome:aBlockNode |
49 myHome := someOne. |
49 myHome := someOne. |
50 blockHome := aBlockNode |
50 blockHome := aBlockNode |
51 ! ! |
|
52 |
|
53 !ReturnNode methodsFor:'queries'! |
|
54 |
|
55 isConstant |
|
56 ^ false |
|
57 ! |
|
58 |
|
59 isReturnNode |
|
60 ^ true |
|
61 ! ! |
|
62 |
|
63 !ReturnNode methodsFor:'evaluating'! |
|
64 |
|
65 evaluateExpression |
|
66 |val| |
|
67 |
|
68 val := expression evaluate. |
|
69 myHome exitWith:val. |
|
70 "when we arrive here, the parser context is already gone |
|
71 - try block-return" |
|
72 blockHome notNil ifTrue:[blockHome exitWith:val]. |
|
73 "well - what else can be done" |
|
74 ^ val |
|
75 ! ! |
51 ! ! |
76 |
52 |
77 !ReturnNode methodsFor:'code generation'! |
53 !ReturnNode methodsFor:'code generation'! |
78 |
54 |
79 codeForSideEffectOn:aStream inBlock:b for:aCompiler |
55 codeForSideEffectOn:aStream inBlock:b for:aCompiler |
150 ]. |
126 ]. |
151 expression codeOn:aStream inBlock:b for:aCompiler. |
127 expression codeOn:aStream inBlock:b for:aCompiler. |
152 aStream nextPut:#retTop |
128 aStream nextPut:#retTop |
153 ! ! |
129 ! ! |
154 |
130 |
|
131 !ReturnNode methodsFor:'evaluating'! |
|
132 |
|
133 evaluateExpression |
|
134 |val| |
|
135 |
|
136 val := expression evaluate. |
|
137 myHome exitWith:val. |
|
138 "when we arrive here, the parser context is already gone |
|
139 - try block-return" |
|
140 blockHome notNil ifTrue:[blockHome exitWith:val]. |
|
141 "well - what else can be done" |
|
142 ^ val |
|
143 ! ! |
|
144 |
155 !ReturnNode methodsFor:'printing'! |
145 !ReturnNode methodsFor:'printing'! |
156 |
146 |
157 printOn:aStream indent:i |
147 printOn:aStream indent:i |
158 aStream nextPutAll:'^ '. |
148 aStream nextPutAll:'^ '. |
159 expression printOn:aStream |
149 expression printOn:aStream |
160 ! ! |
150 ! ! |
|
151 |
|
152 !ReturnNode methodsFor:'queries'! |
|
153 |
|
154 isConstant |
|
155 ^ false |
|
156 ! |
|
157 |
|
158 isReturnNode |
|
159 ^ true |
|
160 ! ! |
|
161 |