--- a/AssignNd.st Tue Nov 22 01:23:56 1994 +0100
+++ b/AssignNd.st Mon Nov 28 21:58:48 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
AssignmentNode comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.7 1994-08-22 12:38:59 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.8 1994-11-28 20:58:48 claus Exp $
'!
!AssignmentNode class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.7 1994-08-22 12:38:59 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.8 1994-11-28 20:58:48 claus Exp $
"
!
@@ -92,28 +92,28 @@
|sel arg|
(variable type == #MethodVariable) ifTrue:[
- expression isBinaryMessage ifTrue:[
- sel := expression selector.
- ((sel == #+) or:[sel == #-]) ifTrue:[
- (expression receiver type == #MethodVariable) ifTrue:[
- (expression receiver index == variable index) ifTrue:[
- arg := expression arg1.
- arg isConstant ifTrue:[
- (arg value == 1) ifTrue:[
- (sel == #+) ifTrue:[
- aStream nextPut:#incMethodVar
- ] ifFalse:[
- aStream nextPut:#decMethodVar
- ].
- aStream nextPut:(expression lineNumber).
- aStream nextPut:(variable index).
- ^ self
- ]
- ]
- ]
- ]
- ]
- ]
+ expression isBinaryMessage ifTrue:[
+ sel := expression selector.
+ ((sel == #+) or:[sel == #-]) ifTrue:[
+ (expression receiver type == #MethodVariable) ifTrue:[
+ (expression receiver index == variable index) ifTrue:[
+ arg := expression arg1.
+ arg isConstant ifTrue:[
+ (arg value == 1) ifTrue:[
+ (sel == #+) ifTrue:[
+ aStream nextPut:#incMethodVar
+ ] ifFalse:[
+ aStream nextPut:#decMethodVar
+ ].
+ aStream nextPut:(expression lineNumber).
+ aStream nextPut:(variable index).
+ ^ self
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
].
expression codeOn:aStream inBlock:b.
variable codeStoreOn:aStream inBlock:b valueNeeded:false
--- a/AssignmentNode.st Tue Nov 22 01:23:56 1994 +0100
+++ b/AssignmentNode.st Mon Nov 28 21:58:48 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
AssignmentNode comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.7 1994-08-22 12:38:59 claus Exp $
+$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.8 1994-11-28 20:58:48 claus Exp $
'!
!AssignmentNode class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.7 1994-08-22 12:38:59 claus Exp $
+$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.8 1994-11-28 20:58:48 claus Exp $
"
!
@@ -92,28 +92,28 @@
|sel arg|
(variable type == #MethodVariable) ifTrue:[
- expression isBinaryMessage ifTrue:[
- sel := expression selector.
- ((sel == #+) or:[sel == #-]) ifTrue:[
- (expression receiver type == #MethodVariable) ifTrue:[
- (expression receiver index == variable index) ifTrue:[
- arg := expression arg1.
- arg isConstant ifTrue:[
- (arg value == 1) ifTrue:[
- (sel == #+) ifTrue:[
- aStream nextPut:#incMethodVar
- ] ifFalse:[
- aStream nextPut:#decMethodVar
- ].
- aStream nextPut:(expression lineNumber).
- aStream nextPut:(variable index).
- ^ self
- ]
- ]
- ]
- ]
- ]
- ]
+ expression isBinaryMessage ifTrue:[
+ sel := expression selector.
+ ((sel == #+) or:[sel == #-]) ifTrue:[
+ (expression receiver type == #MethodVariable) ifTrue:[
+ (expression receiver index == variable index) ifTrue:[
+ arg := expression arg1.
+ arg isConstant ifTrue:[
+ (arg value == 1) ifTrue:[
+ (sel == #+) ifTrue:[
+ aStream nextPut:#incMethodVar
+ ] ifFalse:[
+ aStream nextPut:#decMethodVar
+ ].
+ aStream nextPut:(expression lineNumber).
+ aStream nextPut:(variable index).
+ ^ self
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
].
expression codeOn:aStream inBlock:b.
variable codeStoreOn:aStream inBlock:b valueNeeded:false
--- a/BinaryNd.st Tue Nov 22 01:23:56 1994 +0100
+++ b/BinaryNd.st Mon Nov 28 21:58:48 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
BinaryNode comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/Attic/BinaryNd.st,v 1.8 1994-11-17 14:23:20 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/BinaryNd.st,v 1.9 1994-11-28 20:58:47 claus Exp $
'!
!BinaryNode class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/Attic/BinaryNd.st,v 1.8 1994-11-17 14:23:20 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/BinaryNd.st,v 1.9 1994-11-28 20:58:47 claus Exp $
"
!
@@ -68,7 +68,7 @@
evaluate
receiver isSuper ifTrue:[
- ^ super evaluate
+ ^ super evaluate
].
^ (receiver evaluate) perform:selector with:(argArray at:1) evaluate
! !
@@ -79,41 +79,41 @@
|arg1|
receiver isSuper ifFalse:[
- ( #(== ~~ = ~= + - < <= > >=) includes:selector) ifTrue:[
- receiver codeOn:aStream inBlock:b.
- arg1 := argArray at:1.
- arg1 isConstant ifTrue:[
- (arg1 type == #Integer) ifTrue:[
- ((selector == #==) or:[selector == #~~]) ifTrue:[
- (arg1 value == 0) ifTrue:[
- (selector == #==) ifTrue:[
- aStream nextPut:#eq0
- ] ifFalse:[
- aStream nextPut:#ne0
- ].
- ^ self
- ]
- ].
- ((selector == #+) or:[selector == #-]) ifTrue:[
- (arg1 value == 1) ifTrue:[
- (selector == #+) ifTrue:[
- aStream nextPut:#plus1
- ] ifFalse:[
- aStream nextPut:#minus1
- ].
- aStream nextPut:lineNr.
- ^ self
- ]
- ]
- ]
- ].
- arg1 codeOn:aStream inBlock:b.
- aStream nextPut:selector.
- (self class hasLineNumber:selector) ifTrue:[
- aStream nextPut:lineNr.
- ].
- ^ self
- ]
+ ( #(== ~~ = ~= + - < <= > >=) includes:selector) ifTrue:[
+ receiver codeOn:aStream inBlock:b.
+ arg1 := argArray at:1.
+ arg1 isConstant ifTrue:[
+ (arg1 type == #Integer) ifTrue:[
+ ((selector == #==) or:[selector == #~~]) ifTrue:[
+ (arg1 value == 0) ifTrue:[
+ (selector == #==) ifTrue:[
+ aStream nextPut:#eq0
+ ] ifFalse:[
+ aStream nextPut:#ne0
+ ].
+ ^ self
+ ]
+ ].
+ ((selector == #+) or:[selector == #-]) ifTrue:[
+ (arg1 value == 1) ifTrue:[
+ (selector == #+) ifTrue:[
+ aStream nextPut:#plus1
+ ] ifFalse:[
+ aStream nextPut:#minus1
+ ].
+ aStream nextPut:lineNr.
+ ^ self
+ ]
+ ]
+ ]
+ ].
+ arg1 codeOn:aStream inBlock:b.
+ aStream nextPut:selector.
+ (self class hasLineNumber:selector) ifTrue:[
+ aStream nextPut:lineNr.
+ ].
+ ^ self
+ ]
].
^ super codeOn:aStream inBlock:b
! !
@@ -125,16 +125,16 @@
needParen := false.
receiver isMessage ifTrue:[
- receiver isUnaryMessage ifFalse:[
- needParen := true
- ].
+ receiver isUnaryMessage ifFalse:[
+ needParen := true
+ ].
].
needParen ifTrue:[
- aStream nextPutAll:'('
+ aStream nextPutAll:'('
].
receiver printOn:aStream.
needParen ifTrue:[
- aStream nextPutAll:') '
+ aStream nextPutAll:') '
].
aStream space.
@@ -143,15 +143,15 @@
needParen := false.
self arg isMessage ifTrue:[
- self arg isUnaryMessage ifFalse:[
- needParen := true
- ].
+ self arg isUnaryMessage ifFalse:[
+ needParen := true
+ ].
].
needParen ifTrue:[
- aStream nextPutAll:'('
+ aStream nextPutAll:'('
].
self arg printOn:aStream.
needParen ifTrue:[
- aStream nextPutAll:') '
+ aStream nextPutAll:') '
].
! !
--- a/BinaryNode.st Tue Nov 22 01:23:56 1994 +0100
+++ b/BinaryNode.st Mon Nov 28 21:58:48 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
BinaryNode comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/BinaryNode.st,v 1.8 1994-11-17 14:23:20 claus Exp $
+$Header: /cvs/stx/stx/libcomp/BinaryNode.st,v 1.9 1994-11-28 20:58:47 claus Exp $
'!
!BinaryNode class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/BinaryNode.st,v 1.8 1994-11-17 14:23:20 claus Exp $
+$Header: /cvs/stx/stx/libcomp/BinaryNode.st,v 1.9 1994-11-28 20:58:47 claus Exp $
"
!
@@ -68,7 +68,7 @@
evaluate
receiver isSuper ifTrue:[
- ^ super evaluate
+ ^ super evaluate
].
^ (receiver evaluate) perform:selector with:(argArray at:1) evaluate
! !
@@ -79,41 +79,41 @@
|arg1|
receiver isSuper ifFalse:[
- ( #(== ~~ = ~= + - < <= > >=) includes:selector) ifTrue:[
- receiver codeOn:aStream inBlock:b.
- arg1 := argArray at:1.
- arg1 isConstant ifTrue:[
- (arg1 type == #Integer) ifTrue:[
- ((selector == #==) or:[selector == #~~]) ifTrue:[
- (arg1 value == 0) ifTrue:[
- (selector == #==) ifTrue:[
- aStream nextPut:#eq0
- ] ifFalse:[
- aStream nextPut:#ne0
- ].
- ^ self
- ]
- ].
- ((selector == #+) or:[selector == #-]) ifTrue:[
- (arg1 value == 1) ifTrue:[
- (selector == #+) ifTrue:[
- aStream nextPut:#plus1
- ] ifFalse:[
- aStream nextPut:#minus1
- ].
- aStream nextPut:lineNr.
- ^ self
- ]
- ]
- ]
- ].
- arg1 codeOn:aStream inBlock:b.
- aStream nextPut:selector.
- (self class hasLineNumber:selector) ifTrue:[
- aStream nextPut:lineNr.
- ].
- ^ self
- ]
+ ( #(== ~~ = ~= + - < <= > >=) includes:selector) ifTrue:[
+ receiver codeOn:aStream inBlock:b.
+ arg1 := argArray at:1.
+ arg1 isConstant ifTrue:[
+ (arg1 type == #Integer) ifTrue:[
+ ((selector == #==) or:[selector == #~~]) ifTrue:[
+ (arg1 value == 0) ifTrue:[
+ (selector == #==) ifTrue:[
+ aStream nextPut:#eq0
+ ] ifFalse:[
+ aStream nextPut:#ne0
+ ].
+ ^ self
+ ]
+ ].
+ ((selector == #+) or:[selector == #-]) ifTrue:[
+ (arg1 value == 1) ifTrue:[
+ (selector == #+) ifTrue:[
+ aStream nextPut:#plus1
+ ] ifFalse:[
+ aStream nextPut:#minus1
+ ].
+ aStream nextPut:lineNr.
+ ^ self
+ ]
+ ]
+ ]
+ ].
+ arg1 codeOn:aStream inBlock:b.
+ aStream nextPut:selector.
+ (self class hasLineNumber:selector) ifTrue:[
+ aStream nextPut:lineNr.
+ ].
+ ^ self
+ ]
].
^ super codeOn:aStream inBlock:b
! !
@@ -125,16 +125,16 @@
needParen := false.
receiver isMessage ifTrue:[
- receiver isUnaryMessage ifFalse:[
- needParen := true
- ].
+ receiver isUnaryMessage ifFalse:[
+ needParen := true
+ ].
].
needParen ifTrue:[
- aStream nextPutAll:'('
+ aStream nextPutAll:'('
].
receiver printOn:aStream.
needParen ifTrue:[
- aStream nextPutAll:') '
+ aStream nextPutAll:') '
].
aStream space.
@@ -143,15 +143,15 @@
needParen := false.
self arg isMessage ifTrue:[
- self arg isUnaryMessage ifFalse:[
- needParen := true
- ].
+ self arg isUnaryMessage ifFalse:[
+ needParen := true
+ ].
].
needParen ifTrue:[
- aStream nextPutAll:'('
+ aStream nextPutAll:'('
].
self arg printOn:aStream.
needParen ifTrue:[
- aStream nextPutAll:') '
+ aStream nextPutAll:') '
].
! !
--- a/BlockNode.st Tue Nov 22 01:23:56 1994 +0100
+++ b/BlockNode.st Mon Nov 28 21:58:48 1994 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.10 1994-10-10 00:57:41 claus Exp $
+$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.11 1994-11-28 20:58:45 claus Exp $
'!
!BlockNode class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.10 1994-10-10 00:57:41 claus Exp $
+$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.11 1994-11-28 20:58:45 claus Exp $
"
!
@@ -428,7 +428,7 @@
"cannot currently compile this block inline (have to move blockvars into
surrounding method. generate a make-block and send it value"
- Transcript showCr:'cannot (yet) compile block with blockvars inline'.
+"/ Transcript showCr:'cannot (yet) compile block with blockvars inline'.
self codeOn:aStream inBlock:b.
aStream nextPut:#value.
(MessageNode hasLineNumber:#value) ifTrue:[
--- a/Make.proto Tue Nov 22 01:23:56 1994 +0100
+++ b/Make.proto Mon Nov 28 21:58:48 1994 +0100
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libcomp/Make.proto,v 1.11 1994-10-28 03:11:50 claus Exp $
+# $Header: /cvs/stx/stx/libcomp/Make.proto,v 1.12 1994-11-28 20:58:34 claus Exp $
#
# -------------- no need to change anything below ----------
@@ -94,7 +94,7 @@
I = $(INCLUDE)
-STCHDR=$(I)/stc.h $(I)/stcIntern.h
+STCHDR=$(I)/stc.h $(I)/stcIntern.h $(CPUINTERN_H)
OBJECT=$(I)/Object.H $(STCHDR)
SCANNER=$(I)/Scanner.H $(OBJECT)
PARSER=$(I)/Parser.H $(SCANNER)
--- a/MessageNd.st Tue Nov 22 01:23:56 1994 +0100
+++ b/MessageNd.st Mon Nov 28 21:58:48 1994 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.14 1994-11-17 14:22:46 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.15 1994-11-28 20:58:26 claus Exp $
'!
!MessageNode class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.14 1994-11-17 14:22:46 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.15 1994-11-28 20:58:26 claus Exp $
"
!
@@ -967,6 +967,13 @@
].
]
].
+
+ receiver isBlock ifTrue:[
+ selector == #value ifTrue:[
+ receiver codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded.
+ ^ self
+ ].
+ ].
isBuiltIn := self class isBuiltInUnarySelector:selector
].
--- a/MessageNode.st Tue Nov 22 01:23:56 1994 +0100
+++ b/MessageNode.st Mon Nov 28 21:58:48 1994 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.14 1994-11-17 14:22:46 claus Exp $
+$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.15 1994-11-28 20:58:26 claus Exp $
'!
!MessageNode class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.14 1994-11-17 14:22:46 claus Exp $
+$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.15 1994-11-28 20:58:26 claus Exp $
"
!
@@ -967,6 +967,13 @@
].
]
].
+
+ receiver isBlock ifTrue:[
+ selector == #value ifTrue:[
+ receiver codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded.
+ ^ self
+ ].
+ ].
isBuiltIn := self class isBuiltInUnarySelector:selector
].
--- a/Parser.st Tue Nov 22 01:23:56 1994 +0100
+++ b/Parser.st Mon Nov 28 21:58:48 1994 +0100
@@ -38,7 +38,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.20 1994-11-22 00:23:56 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.21 1994-11-28 20:58:37 claus Exp $
'!
!Parser class methodsFor:'documentation'!
@@ -59,7 +59,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.20 1994-11-22 00:23:56 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.21 1994-11-28 20:58:37 claus Exp $
"
!
@@ -256,7 +256,7 @@
If logged is true, an entry is added to the change-file. If the failBlock argument
is non-nil, it is evaluated if an error occurs."
- |parser tree mustBackup loggedString chgStream value|
+ |parser tree mustBackup loggedString chgStream value s sReal m|
aStringOrStream isNil ifTrue:[^ nil].
aStringOrStream isStream ifTrue:[
@@ -298,6 +298,9 @@
"
if the parse tree is that of a constant, quickly return its value
+ this is used for example, when reading objects simple objects
+ via readFrom:. The overhead of compiling a method is avoided in this
+ case.
"
tree isConstant ifTrue:[
^ tree evaluate
@@ -305,14 +308,37 @@
"
if I am the ByteCodeCompiler,
generate a dummy method, execute it and return the value.
- otherwise, just evaluate the tree; slow, but not too bad ...
+ otherwise, just evaluate the tree; slower, but not too bad ...
+ This allows systems to be delivered without the ByteCodeCompiler,
+ and still evaluate expressions (neede for example, to read resource
+ files).
"
-"/ self == Parser ifTrue:[
+ self == Parser ifTrue:[
parser evalExitBlock:[:value | parser release. ^ value].
value := tree evaluate.
parser evalExitBlock:nil.
-"/ ] ifFalse:[
-"/ ]
+ ] ifFalse:[
+ aStringOrStream isStream ifTrue:[
+ s := aStringOrStream contents.
+ ] ifFalse:[
+ s := aStringOrStream
+ ].
+ sReal := 'doIt ^[\' withCRs , s , '\] value' withCRs.
+ m := self compile:sReal forClass:anObject class
+ inCategory:'_temporary_' notifying:requestor
+ install:false skipIfSame:false silent:true.
+ m notNil ifTrue:[
+ "
+ fake: patch the source string, to what the user expects
+ in the browser
+ "
+ m source:' \' withCRs , s .
+ value := m valueWithReceiver:anObject
+ arguments:#()
+ selector:#doIt
+ search:nil.
+ ].
+ ]
]
].
parser release.
--- a/StatNode.st Tue Nov 22 01:23:56 1994 +0100
+++ b/StatNode.st Mon Nov 28 21:58:48 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
StatementNode comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.5 1994-08-22 12:41:08 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.6 1994-11-28 20:58:31 claus Exp $
'!
!StatementNode class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.5 1994-08-22 12:41:08 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.6 1994-11-28 20:58:31 claus Exp $
"
!
@@ -70,8 +70,8 @@
"this could be done more elegant - but with lots of recursion"
thisStatement := self.
[thisStatement notNil] whileTrue:[
- lastValue := thisStatement evaluateExpression.
- thisStatement := thisStatement nextStatement
+ lastValue := thisStatement evaluateExpression.
+ thisStatement := thisStatement nextStatement
].
^ lastValue
! !
@@ -101,8 +101,8 @@
last := self.
this := self.
[this notNil] whileTrue:[
- last := this.
- this := this nextStatement
+ last := this.
+ this := this nextStatement
].
^ last
!
@@ -123,6 +123,13 @@
^ expression
! !
+!StatementNode methodsFor:'queries'!
+
+isConstant
+ nextStatement notNil ifTrue:[^ false].
+ ^ expression isConstant
+! !
+
!StatementNode methodsFor:'printing'!
printOn:aStream indent:i
@@ -138,12 +145,12 @@
thisStatement := self.
[thisStatement notNil] whileTrue:[
- i timesRepeat:[aStream space].
- thisStatement printOn:aStream indent:i.
- thisStatement nextStatement notNil ifTrue:[
- aStream nextPut:$..
- aStream cr.
- ].
- thisStatement := thisStatement nextStatement
+ i timesRepeat:[aStream space].
+ thisStatement printOn:aStream indent:i.
+ thisStatement nextStatement notNil ifTrue:[
+ aStream nextPut:$..
+ aStream cr.
+ ].
+ thisStatement := thisStatement nextStatement
]
! !
--- a/StatementNode.st Tue Nov 22 01:23:56 1994 +0100
+++ b/StatementNode.st Mon Nov 28 21:58:48 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
StatementNode comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.5 1994-08-22 12:41:08 claus Exp $
+$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.6 1994-11-28 20:58:31 claus Exp $
'!
!StatementNode class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.5 1994-08-22 12:41:08 claus Exp $
+$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.6 1994-11-28 20:58:31 claus Exp $
"
!
@@ -70,8 +70,8 @@
"this could be done more elegant - but with lots of recursion"
thisStatement := self.
[thisStatement notNil] whileTrue:[
- lastValue := thisStatement evaluateExpression.
- thisStatement := thisStatement nextStatement
+ lastValue := thisStatement evaluateExpression.
+ thisStatement := thisStatement nextStatement
].
^ lastValue
! !
@@ -101,8 +101,8 @@
last := self.
this := self.
[this notNil] whileTrue:[
- last := this.
- this := this nextStatement
+ last := this.
+ this := this nextStatement
].
^ last
!
@@ -123,6 +123,13 @@
^ expression
! !
+!StatementNode methodsFor:'queries'!
+
+isConstant
+ nextStatement notNil ifTrue:[^ false].
+ ^ expression isConstant
+! !
+
!StatementNode methodsFor:'printing'!
printOn:aStream indent:i
@@ -138,12 +145,12 @@
thisStatement := self.
[thisStatement notNil] whileTrue:[
- i timesRepeat:[aStream space].
- thisStatement printOn:aStream indent:i.
- thisStatement nextStatement notNil ifTrue:[
- aStream nextPut:$..
- aStream cr.
- ].
- thisStatement := thisStatement nextStatement
+ i timesRepeat:[aStream space].
+ thisStatement printOn:aStream indent:i.
+ thisStatement nextStatement notNil ifTrue:[
+ aStream nextPut:$..
+ aStream cr.
+ ].
+ thisStatement := thisStatement nextStatement
]
! !