14
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
PrimaryNode subclass:#SelfNode
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'System-Compiler-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
SelfNode comment:'
|
|
21 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
|
22 |
All Rights Reserved
|
33
|
23 |
|
|
24 |
$Header: /cvs/stx/stx/libcomp/SelfNode.st,v 1.3 1994-08-22 12:41:07 claus Exp $
|
20
|
25 |
'!
|
14
|
26 |
|
20
|
27 |
!SelfNode class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
|
32 |
All Rights Reserved
|
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
33
|
45 |
$Header: /cvs/stx/stx/libcomp/SelfNode.st,v 1.3 1994-08-22 12:41:07 claus Exp $
|
20
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
node for parse-trees, representing self
|
|
52 |
"
|
|
53 |
! !
|
14
|
54 |
|
|
55 |
!SelfNode class methodsFor:'instance creation'!
|
|
56 |
|
|
57 |
value:val
|
|
58 |
^ (self basicNew) value:val
|
|
59 |
! !
|
|
60 |
|
|
61 |
!SelfNode methodsFor:'accessing'!
|
|
62 |
|
|
63 |
value:val
|
|
64 |
type := #Self.
|
|
65 |
value := val.
|
|
66 |
! !
|
|
67 |
|
|
68 |
!SelfNode methodsFor:'evaluating'!
|
|
69 |
|
|
70 |
evaluate
|
|
71 |
^ value
|
|
72 |
!
|
|
73 |
|
|
74 |
store:aValue
|
|
75 |
"not reached - parser has already checked this"
|
|
76 |
|
|
77 |
self error:'store into self - cannot happen'
|
|
78 |
! !
|
|
79 |
|
|
80 |
!SelfNode methodsFor:'code generation'!
|
|
81 |
|
|
82 |
codeOn:aStream inBlock:codeBlock
|
|
83 |
aStream nextPut:#pushSelf
|
|
84 |
!
|
|
85 |
|
|
86 |
codeStoreOn:aStream inBlock:codeBlock valueNeeded:valueNeeded
|
|
87 |
"not reached - parser has already checked this"
|
|
88 |
|
|
89 |
^ self error:'store into self - cannot happen'
|
|
90 |
! !
|
|
91 |
|
|
92 |
!SelfNode methodsFor:'printing'!
|
|
93 |
|
|
94 |
displayString
|
|
95 |
^ 'InterpreterVariable(self)'
|
|
96 |
!
|
|
97 |
|
|
98 |
printOn:aStream indent:i
|
|
99 |
aStream nextPutAll:'self'
|
|
100 |
! !
|