author | Claus Gittinger <cg@exept.de> |
Fri, 29 Aug 2003 20:28:24 +0200 | |
changeset 1449 | 612489f03d26 |
parent 1426 | 10e0bc348c01 |
child 1977 | 29f613954262 |
permissions | -rw-r--r-- |
0 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
84 | 3 |
All Rights Reserved |
0 | 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 |
||
1146 | 13 |
"{ Package: 'stx:libcomp' }" |
14 |
||
0 | 15 |
Object subclass:#UndefinedVariable |
261 | 16 |
instanceVariableNames:'name' |
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'System-Compiler-Support' |
|
0 | 20 |
! |
21 |
||
20 | 22 |
!UndefinedVariable class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
84 | 27 |
All Rights Reserved |
0 | 28 |
|
20 | 29 |
This software is furnished under a license and may be used |
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
0 | 37 |
|
20 | 38 |
documentation |
39 |
" |
|
40 |
node for parse-trees, representing undefined variables |
|
261 | 41 |
This is a helper class for the compiler. |
20 | 42 |
|
43 |
This class exists solely for the error message when accessing undefined |
|
44 |
variables - instead of returning nil, the compiler returns an instance |
|
45 |
of this class, which will not understand ANY message. |
|
46 |
The error message will then be 'UndefinedVariable ...' |
|
47 |
instead of 'UndefineObject ...', which is somewhat more informative. |
|
263 | 48 |
|
49 |
[author:] |
|
50 |
Claus Gittinger |
|
20 | 51 |
" |
52 |
! ! |
|
0 | 53 |
|
54 |
!UndefinedVariable class methodsFor:'instance creation'! |
|
55 |
||
56 |
name:aString |
|
57 |
^ (self basicNew) setName:aString |
|
58 |
! ! |
|
59 |
||
1426 | 60 |
!UndefinedVariable methodsFor:'accessing'! |
61 |
||
62 |
name |
|
63 |
"return the value of the instance variable 'name' (automatically generated)" |
|
64 |
||
65 |
^ name |
|
66 |
! ! |
|
67 |
||
0 | 68 |
!UndefinedVariable methodsFor:'catching messages'! |
69 |
||
70 |
class |
|
71 |
^ self |
|
72 |
! |
|
73 |
||
74 |
methods |
|
75 |
self methodError |
|
76 |
! |
|
77 |
||
1329 | 78 |
methodsFor |
79 |
^ self methodError |
|
80 |
||
81 |
"Modified: / 18.6.1998 / 14:43:33 / cg" |
|
82 |
! |
|
83 |
||
0 | 84 |
methodsFor:arg |
734
c75125f782a2
return the value from methodsFor: (even on error)
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
85 |
^ self methodError |
c75125f782a2
return the value from methodsFor: (even on error)
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
86 |
|
c75125f782a2
return the value from methodsFor: (even on error)
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
87 |
"Modified: / 18.6.1998 / 14:43:33 / cg" |
0 | 88 |
! |
89 |
||
621
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
90 |
methodsFor:aCategory stamp:time |
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
91 |
"This was added to allow squeak code to be filedIn." |
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
92 |
|
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
93 |
^ self methodsFor:aCategory |
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
94 |
|
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
95 |
"Created: 15.10.1997 / 18:52:04 / cg" |
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
96 |
! |
37592efa4daa
allow squeak code to be filedIn (methodsFor:stamp:)
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
97 |
|
0 | 98 |
subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s |
99 |
self subclassingError |
|
100 |
! |
|
101 |
||
102 |
subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat |
|
103 |
self subclassingError |
|
104 |
! |
|
105 |
||
1329 | 106 |
subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s classInstanceVariableNames:ci |
107 |
self subclassingError |
|
108 |
! |
|
109 |
||
0 | 110 |
variableByteSubclass:t instanceVariableNames:f |
84 | 111 |
classVariableNames:d poolDictionaries:s category:cat |
0 | 112 |
self subclassingError |
113 |
! |
|
114 |
||
115 |
variableSubclass:t instanceVariableNames:f |
|
84 | 116 |
classVariableNames:d poolDictionaries:s category:cat |
0 | 117 |
self subclassingError |
118 |
! |
|
119 |
||
120 |
variableWordSubclass:t instanceVariableNames:f |
|
84 | 121 |
classVariableNames:d poolDictionaries:s category:cat |
0 | 122 |
self subclassingError |
123 |
! ! |
|
124 |
||
140 | 125 |
!UndefinedVariable methodsFor:'error reporting'! |
126 |
||
127 |
methodError |
|
970 | 128 |
Parser::UndefinedSuperclassError |
1284
e1d9a27809d3
Raise nonproceedable errors non-proceedable.
Stefan Vogel <sv@exept.de>
parents:
1146
diff
changeset
|
129 |
raiseWith:self |
970 | 130 |
errorString:('trying to define methods for undefined class: ', name) |
140 | 131 |
! |
132 |
||
133 |
subclassingError |
|
970 | 134 |
Parser::UndefinedSuperclassError |
1284
e1d9a27809d3
Raise nonproceedable errors non-proceedable.
Stefan Vogel <sv@exept.de>
parents:
1146
diff
changeset
|
135 |
raiseWith:self |
970 | 136 |
errorString:('trying to create subclass of undefined class: ', name) |
140 | 137 |
! ! |
138 |
||
139 |
!UndefinedVariable methodsFor:'file skipping'! |
|
0 | 140 |
|
140 | 141 |
fileInFrom:aStream notifying:someOne passChunk:passChunk |
142 |
"this is sent, if you continue after a warning about |
|
143 |
methods for undefined class. |
|
144 |
It simply skips chunks and sends a warning to the Transcript." |
|
145 |
||
146 |
|aString done| |
|
147 |
||
148 |
done := false. |
|
149 |
[done] whileFalse:[ |
|
276 | 150 |
done := aStream atEnd. |
151 |
done ifFalse:[ |
|
152 |
aString := aStream nextChunk. |
|
814 | 153 |
done := (aString size == 0). |
276 | 154 |
done ifFalse:[ |
155 |
Transcript showCR:'*** skipping method for undefined class: ' , name |
|
156 |
] |
|
157 |
] |
|
140 | 158 |
]. |
276 | 159 |
|
160 |
"Modified: 18.5.1996 / 15:45:03 / cg" |
|
0 | 161 |
! ! |
162 |
||
163 |
!UndefinedVariable methodsFor:'printing & storing'! |
|
164 |
||
643
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
165 |
printOn:aStream |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
166 |
"print myself on aStream" |
0 | 167 |
|
643
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
168 |
aStream nextPutAll:'UndefinedVariable('. |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
169 |
name printOn:aStream. |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
170 |
aStream nextPut:$). |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
171 |
|
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
172 |
" |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
173 |
self new printOn:Transcript |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
174 |
" |
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
175 |
|
66ff59b7e2d3
Define #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
621
diff
changeset
|
176 |
"Created: / 20.1.1998 / 14:10:46 / stefan" |
0 | 177 |
! ! |
140 | 178 |
|
1416 | 179 |
!UndefinedVariable methodsFor:'private-accessing'! |
140 | 180 |
|
181 |
setName:aString |
|
182 |
name := aString |
|
183 |
! ! |
|
184 |
||
148 | 185 |
!UndefinedVariable class methodsFor:'documentation'! |
186 |
||
187 |
version |
|
1426 | 188 |
^ '$Header: /cvs/stx/stx/libcomp/UndefinedVariable.st,v 1.24 2003-06-10 13:53:08 cg Exp $' |
148 | 189 |
! ! |