author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 24 Sep 2013 23:18:24 +0200 | |
branch | initialV |
changeset 1180 | 01c6be61f29c |
parent 656 | 21a4b2035a9e |
child 752 | 49a4488b4da3 |
permissions | -rw-r--r-- |
155 | 1 |
" |
2 |
COPYRIGHT (c) 2005 by eXept Software AG |
|
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 |
" |
|
39 | 12 |
"{ Package: 'stx:libjavascript' }" |
13 |
||
14 |
ParseNode subclass:#JavaScriptClassNode |
|
502 | 15 |
instanceVariableNames:'className superClassName privateVariables environment |
16 |
staticVariables' |
|
39 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
47 | 19 |
category:'Languages-JavaScript-Compiling & Parsing' |
39 | 20 |
! |
21 |
||
155 | 22 |
!JavaScriptClassNode class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 2005 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
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 |
! ! |
|
39 | 37 |
|
643 | 38 |
!JavaScriptClassNode methodsFor:'* As yet uncategorized *'! |
39 |
||
40 |
isInnerFunction |
|
41 |
^ false |
|
42 |
! ! |
|
43 |
||
39 | 44 |
!JavaScriptClassNode methodsFor:'accessing'! |
45 |
||
388 | 46 |
_argVariables |
47 |
^ nil |
|
48 |
! |
|
49 |
||
83 | 50 |
_localVariables |
51 |
^ self _variables |
|
52 |
! |
|
53 |
||
54 |
_localVariables:aCollection |
|
55 |
self _variables:aCollection |
|
56 |
! |
|
57 |
||
39 | 58 |
_outerEnvironment |
59 |
^ environment |
|
60 |
||
61 |
"Created: / 17.5.1998 / 00:41:00 / cg" |
|
62 |
! |
|
63 |
||
64 |
_outerEnvironment:anEnvironment |
|
65 |
environment := anEnvironment |
|
66 |
||
67 |
"Created: / 17.5.1998 / 00:41:11 / cg" |
|
68 |
! |
|
69 |
||
70 |
_variables |
|
71 |
^ privateVariables |
|
72 |
! |
|
73 |
||
74 |
_variables:aVariablesEnvironment |
|
75 |
privateVariables := aVariablesEnvironment |
|
76 |
! |
|
77 |
||
78 |
className |
|
79 |
"return the value of the instance variable 'className' (automatically generated)" |
|
80 |
||
47 | 81 |
^ className |
82 |
! |
|
39 | 83 |
|
84 |
className:something |
|
85 |
"set the value of the instance variable 'className' (automatically generated)" |
|
86 |
||
47 | 87 |
className := something. |
88 |
! |
|
39 | 89 |
|
502 | 90 |
staticVariables |
91 |
^ staticVariables |
|
92 |
! |
|
93 |
||
94 |
staticVariables:something |
|
95 |
staticVariables := something. |
|
96 |
! |
|
97 |
||
39 | 98 |
superClassName |
99 |
"return the value of the instance variable 'superClassName' (automatically generated)" |
|
100 |
||
47 | 101 |
^ superClassName |
102 |
! |
|
39 | 103 |
|
104 |
superClassName:something |
|
105 |
"set the value of the instance variable 'superClassName' (automatically generated)" |
|
106 |
||
47 | 107 |
superClassName := something. |
108 |
! ! |
|
39 | 109 |
|
110 |
!JavaScriptClassNode methodsFor:'evaluation'! |
|
111 |
||
112 |
evaluate |
|
502 | 113 |
|superClass oldClass newClass instVarNames classVarNames category environment| |
39 | 114 |
|
115 |
superClass := Smalltalk at:superClassName asSymbol. |
|
116 |
instVarNames := ''. |
|
117 |
privateVariables size > 0 ifTrue:[ |
|
83 | 118 |
privateVariables keysAndValuesDo:[:varName :var | |
119 |
instVarNames size ~= 0 ifTrue:[ |
|
120 |
instVarNames := instVarNames , ' ' |
|
121 |
]. |
|
122 |
instVarNames := instVarNames , varName |
|
123 |
] |
|
39 | 124 |
]. |
502 | 125 |
classVarNames := ''. |
126 |
staticVariables size > 0 ifTrue:[ |
|
127 |
staticVariables keysAndValuesDo:[:varName :var | |
|
128 |
classVarNames size ~= 0 ifTrue:[ |
|
129 |
classVarNames := classVarNames , ' ' |
|
130 |
]. |
|
131 |
classVarNames := classVarNames , varName |
|
132 |
] |
|
133 |
]. |
|
104 | 134 |
environment := Class nameSpaceQuerySignal query. |
135 |
oldClass := environment classNamed:className. |
|
136 |
||
388 | 137 |
category := Class classCategoryQuerySignal query. |
138 |
"/ oldClass notNil ifTrue:[ |
|
139 |
"/ category := oldClass category. |
|
140 |
"/ ] ifFalse:[ |
|
141 |
"/ category := superClass category |
|
142 |
"/ ]. |
|
83 | 143 |
newClass := JavaScriptMetaclass basicNew |
144 |
name:(className asSymbol) |
|
104 | 145 |
inEnvironment:environment |
83 | 146 |
subclassOf:superClass |
147 |
instanceVariableNames:instVarNames |
|
148 |
variable:false |
|
149 |
words:false |
|
150 |
pointers:false |
|
502 | 151 |
classVariableNames:classVarNames |
83 | 152 |
poolDictionaries:'' |
104 | 153 |
category:category |
83 | 154 |
comment:nil |
155 |
changed:true. |
|
529 | 156 |
|
157 |
"initialize static variables..." |
|
533 | 158 |
staticVariables notNil ifTrue:[ |
159 |
staticVariables keysAndValuesDo:[:varName :var | |
|
160 |
var expressionForSetup notNil ifTrue:[ |
|
161 |
newClass classVarAt: varName put: (var expressionForSetup evaluate). |
|
162 |
] |
|
163 |
]. |
|
529 | 164 |
]. |
39 | 165 |
^ newClass |
502 | 166 |
|
533 | 167 |
"Modified: / 17-07-2012 / 12:41:13 / cg" |
502 | 168 |
! ! |
169 |
||
170 |
!JavaScriptClassNode methodsFor:'testing'! |
|
171 |
||
172 |
_isFunctionEnvironment |
|
173 |
^ false |
|
174 |
||
175 |
"Created: / 30-01-2011 / 17:11:10 / cg" |
|
39 | 176 |
! ! |
177 |
||
656
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
178 |
!JavaScriptClassNode methodsFor:'visiting'! |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
179 |
|
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
180 |
acceptVisitor:visitor |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
181 |
"Double dispatch back to the visitor, passing my type encoded in |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
182 |
the selector (visitor pattern)" |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
183 |
|
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
184 |
"stub code automatically generated - please change if required" |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
185 |
|
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
186 |
^ visitor visitJavaScriptClassNode:self |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
187 |
! ! |
21a4b2035a9e
Added JavaScriptParseNodeVisitor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
643
diff
changeset
|
188 |
|
39 | 189 |
!JavaScriptClassNode class methodsFor:'documentation'! |
190 |
||
191 |
version |
|
192 |
^ '$Header$' |
|
388 | 193 |
! |
194 |
||
195 |
version_CVS |
|
196 |
^ '$Header$' |
|
39 | 197 |
! ! |
643 | 198 |