resin 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/amber/bin/amberc +10 -350
- data/amber/js/Benchfib.deploy.js +80 -89
- data/amber/js/Benchfib.js +80 -89
- data/amber/js/Canvas.deploy.js +558 -545
- data/amber/js/Canvas.js +563 -545
- data/amber/js/Compiler-AST.deploy.js +431 -243
- data/amber/js/Compiler-AST.js +487 -244
- data/amber/js/Compiler-Core.deploy.js +201 -1045
- data/amber/js/Compiler-Core.js +208 -1207
- data/amber/js/Compiler-Exceptions.deploy.js +37 -18
- data/amber/js/Compiler-Exceptions.js +42 -18
- data/amber/js/Compiler-IR.deploy.js +1071 -774
- data/amber/js/Compiler-IR.js +1194 -848
- data/amber/js/Compiler-Inlining.deploy.js +395 -373
- data/amber/js/Compiler-Inlining.js +395 -373
- data/amber/js/Compiler-Interpreter.deploy.js +1202 -0
- data/amber/js/Compiler-Interpreter.js +1631 -0
- data/amber/js/Compiler-Semantic.deploy.js +695 -600
- data/amber/js/Compiler-Semantic.js +721 -611
- data/amber/js/Compiler-Tests.deploy.js +699 -376
- data/amber/js/Compiler-Tests.js +834 -381
- data/amber/js/Compiler.deploy.js +8563 -1805
- data/amber/js/Compiler.js +11476 -2633
- data/amber/js/Examples.deploy.js +29 -29
- data/amber/js/Examples.js +29 -29
- data/amber/js/IDE.deploy.js +3292 -2649
- data/amber/js/IDE.js +3318 -2710
- data/amber/js/Importer-Exporter.deploy.js +393 -349
- data/amber/js/Importer-Exporter.js +398 -354
- data/amber/js/Kernel-Announcements.deploy.js +53 -44
- data/amber/js/Kernel-Announcements.js +55 -44
- data/amber/js/Kernel-Classes.deploy.js +566 -368
- data/amber/js/Kernel-Classes.js +660 -402
- data/amber/js/Kernel-Collections.deploy.js +1149 -1098
- data/amber/js/Kernel-Collections.js +1183 -1116
- data/amber/js/Kernel-Exceptions.deploy.js +173 -75
- data/amber/js/Kernel-Exceptions.js +215 -77
- data/amber/js/Kernel-Methods.deploy.js +530 -313
- data/amber/js/Kernel-Methods.js +632 -338
- data/amber/js/Kernel-Objects.deploy.js +1734 -1577
- data/amber/js/Kernel-Objects.js +1867 -1654
- data/amber/js/Kernel-Tests.deploy.js +1416 -973
- data/amber/js/Kernel-Tests.js +1495 -981
- data/amber/js/Kernel-Transcript.deploy.js +23 -24
- data/amber/js/Kernel-Transcript.js +25 -26
- data/amber/js/SUnit-Tests.deploy.js +402 -0
- data/amber/js/SUnit-Tests.js +518 -0
- data/amber/js/SUnit.deploy.js +535 -237
- data/amber/js/SUnit.js +634 -246
- data/amber/js/amber.js +90 -53
- data/amber/js/boot.js +441 -255
- data/amber/js/init.js +1 -3
- data/amber/js/lib/CodeMirror/codemirror.css +3 -0
- data/amber/js/lib/CodeMirror/codemirror.js +104 -55
- data/amber/js/lib/peg-0.7.0.min.js +9 -0
- data/amber/js/parser.js +1504 -802
- data/amber/js/parser.pegjs +170 -165
- data/amber/st/Canvas.st +6 -0
- data/amber/st/Compiler-AST.st +54 -3
- data/amber/st/Compiler-Core.st +6 -551
- data/amber/st/Compiler-Exceptions.st +4 -0
- data/amber/st/Compiler-IR.st +205 -87
- data/amber/st/Compiler-Interpreter.st +597 -0
- data/amber/st/Compiler-Semantic.st +46 -21
- data/amber/st/Compiler-Tests.st +254 -7
- data/amber/st/Compiler.st +3172 -1541
- data/amber/st/IDE.st +57 -93
- data/amber/st/Importer-Exporter.st +4 -7
- data/amber/st/Kernel-Announcements.st +8 -0
- data/amber/st/Kernel-Classes.st +149 -40
- data/amber/st/Kernel-Collections.st +43 -32
- data/amber/st/Kernel-Exceptions.st +70 -1
- data/amber/st/Kernel-Methods.st +165 -27
- data/amber/st/Kernel-Objects.st +215 -140
- data/amber/st/Kernel-Tests.st +195 -10
- data/amber/st/Kernel-Transcript.st +1 -3
- data/amber/st/SUnit-Tests.st +186 -0
- data/amber/st/SUnit.st +186 -14
- data/bin/resin +6 -0
- data/lib/resin/cli.rb +19 -0
- metadata +41 -25
- data/amber/js/lib/peg-0.6.2.min.js +0 -2
- data/bin/resin-compile +0 -6
- data/bin/runresin +0 -12
@@ -6,12 +6,11 @@ smalltalk.addMethod(
|
|
6
6
|
smalltalk.method({
|
7
7
|
selector: "addArg:",
|
8
8
|
category: 'adding',
|
9
|
-
fn: function (aString)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
},
|
9
|
+
fn: function (aString){
|
10
|
+
var self=this;
|
11
|
+
return smalltalk.withContext(function($ctx1) {
|
12
|
+
_st(_st(_st(self)._args())._at_(aString))._scope_(self);
|
13
|
+
return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString}, smalltalk.LexicalScope)})},
|
15
14
|
args: ["aString"],
|
16
15
|
source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
|
17
16
|
messageSends: ["at:put:", "on:", "args", "scope:", "at:"],
|
@@ -24,12 +23,11 @@ smalltalk.addMethod(
|
|
24
23
|
smalltalk.method({
|
25
24
|
selector: "addTemp:",
|
26
25
|
category: 'adding',
|
27
|
-
fn: function (aString)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
},
|
26
|
+
fn: function (aString){
|
27
|
+
var self=this;
|
28
|
+
return smalltalk.withContext(function($ctx1) {
|
29
|
+
_st(_st(_st(self)._temps())._at_(aString))._scope_(self);
|
30
|
+
return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString}, smalltalk.LexicalScope)})},
|
33
31
|
args: ["aString"],
|
34
32
|
source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
|
35
33
|
messageSends: ["at:put:", "on:", "temps", "scope:", "at:"],
|
@@ -37,17 +35,35 @@ referencedClasses: ["TempVar"]
|
|
37
35
|
}),
|
38
36
|
smalltalk.LexicalScope);
|
39
37
|
|
38
|
+
smalltalk.addMethod(
|
39
|
+
"_alias",
|
40
|
+
smalltalk.method({
|
41
|
+
selector: "alias",
|
42
|
+
category: 'accessing',
|
43
|
+
fn: function (){
|
44
|
+
var self=this;
|
45
|
+
return smalltalk.withContext(function($ctx1) {
|
46
|
+
$1=_st("$ctx").__comma(_st(_st(self)._scopeLevel())._asString());
|
47
|
+
return $1;
|
48
|
+
}, function($ctx1) {$ctx1.fill(self,"alias",{}, smalltalk.LexicalScope)})},
|
49
|
+
args: [],
|
50
|
+
source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
|
51
|
+
messageSends: [",", "asString", "scopeLevel"],
|
52
|
+
referencedClasses: []
|
53
|
+
}),
|
54
|
+
smalltalk.LexicalScope);
|
55
|
+
|
40
56
|
smalltalk.addMethod(
|
41
57
|
"_allVariableNames",
|
42
58
|
smalltalk.method({
|
43
59
|
selector: "allVariableNames",
|
44
60
|
category: 'accessing',
|
45
|
-
fn: function ()
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
},
|
61
|
+
fn: function (){
|
62
|
+
var self=this;
|
63
|
+
return smalltalk.withContext(function($ctx1) {
|
64
|
+
$1=_st(_st(_st(self)._args())._keys()).__comma(_st(_st(self)._temps())._keys());
|
65
|
+
return $1;
|
66
|
+
}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{}, smalltalk.LexicalScope)})},
|
51
67
|
args: [],
|
52
68
|
source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
|
53
69
|
messageSends: [",", "keys", "temps", "args"],
|
@@ -60,17 +76,18 @@ smalltalk.addMethod(
|
|
60
76
|
smalltalk.method({
|
61
77
|
selector: "args",
|
62
78
|
category: 'accessing',
|
63
|
-
fn: function ()
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
79
|
+
fn: function (){
|
80
|
+
var self=this;
|
81
|
+
return smalltalk.withContext(function($ctx1) {
|
82
|
+
$2=self["@args"];
|
83
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
84
|
+
self["@args"]=_st((smalltalk.Dictionary || Dictionary))._new();
|
85
|
+
$1=self["@args"];
|
86
|
+
} else {
|
87
|
+
$1=$2;
|
88
|
+
};
|
89
|
+
return $1;
|
90
|
+
}, function($ctx1) {$ctx1.fill(self,"args",{}, smalltalk.LexicalScope)})},
|
74
91
|
args: [],
|
75
92
|
source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
|
76
93
|
messageSends: ["ifNil:", "new"],
|
@@ -83,12 +100,18 @@ smalltalk.addMethod(
|
|
83
100
|
smalltalk.method({
|
84
101
|
selector: "bindingFor:",
|
85
102
|
category: 'accessing',
|
86
|
-
fn: function (aStringOrNode)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
103
|
+
fn: function (aStringOrNode){
|
104
|
+
var self=this;
|
105
|
+
return smalltalk.withContext(function($ctx1) {
|
106
|
+
$1=_st(_st(self)._pseudoVars())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
|
107
|
+
return smalltalk.withContext(function($ctx2) {
|
108
|
+
return smalltalk.withContext(function($ctx3) {
|
109
|
+
return smalltalk.withContext(function($ctx4) {
|
110
|
+
}, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
|
111
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
112
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
113
|
+
return $1;
|
114
|
+
}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode}, smalltalk.LexicalScope)})},
|
92
115
|
args: ["aStringOrNode"],
|
93
116
|
source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [ \x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
|
94
117
|
messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"],
|
@@ -101,12 +124,14 @@ smalltalk.addMethod(
|
|
101
124
|
smalltalk.method({
|
102
125
|
selector: "canInlineNonLocalReturns",
|
103
126
|
category: 'testing',
|
104
|
-
fn: function ()
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
},
|
127
|
+
fn: function (){
|
128
|
+
var self=this;
|
129
|
+
return smalltalk.withContext(function($ctx1) {
|
130
|
+
$1=_st(_st(self)._isInlined())._and_((function(){
|
131
|
+
return smalltalk.withContext(function($ctx2) {
|
132
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
133
|
+
return $1;
|
134
|
+
}, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{}, smalltalk.LexicalScope)})},
|
110
135
|
args: [],
|
111
136
|
source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
|
112
137
|
messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"],
|
@@ -119,10 +144,12 @@ smalltalk.addMethod(
|
|
119
144
|
smalltalk.method({
|
120
145
|
selector: "instruction",
|
121
146
|
category: 'accessing',
|
122
|
-
fn: function ()
|
123
|
-
|
124
|
-
|
125
|
-
|
147
|
+
fn: function (){
|
148
|
+
var self=this;
|
149
|
+
return smalltalk.withContext(function($ctx1) {
|
150
|
+
$1=self["@instruction"];
|
151
|
+
return $1;
|
152
|
+
}, function($ctx1) {$ctx1.fill(self,"instruction",{}, smalltalk.LexicalScope)})},
|
126
153
|
args: [],
|
127
154
|
source: "instruction\x0a\x09^ instruction",
|
128
155
|
messageSends: [],
|
@@ -135,11 +162,10 @@ smalltalk.addMethod(
|
|
135
162
|
smalltalk.method({
|
136
163
|
selector: "instruction:",
|
137
164
|
category: 'accessing',
|
138
|
-
fn: function (anIRInstruction)
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
},
|
165
|
+
fn: function (anIRInstruction){
|
166
|
+
var self=this;
|
167
|
+
return smalltalk.withContext(function($ctx1) {
|
168
|
+
return self}, function($ctx1) {$ctx1.fill(self,"instruction:",{anIRInstruction:anIRInstruction}, smalltalk.LexicalScope)})},
|
143
169
|
args: ["anIRInstruction"],
|
144
170
|
source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
|
145
171
|
messageSends: [],
|
@@ -152,12 +178,12 @@ smalltalk.addMethod(
|
|
152
178
|
smalltalk.method({
|
153
179
|
selector: "isBlockScope",
|
154
180
|
category: 'testing',
|
155
|
-
fn: function ()
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
},
|
181
|
+
fn: function (){
|
182
|
+
var self=this;
|
183
|
+
return smalltalk.withContext(function($ctx1) {
|
184
|
+
$1=_st(_st(self)._isMethodScope())._not();
|
185
|
+
return $1;
|
186
|
+
}, function($ctx1) {$ctx1.fill(self,"isBlockScope",{}, smalltalk.LexicalScope)})},
|
161
187
|
args: [],
|
162
188
|
source: "isBlockScope\x0a\x09^ self isMethodScope not",
|
163
189
|
messageSends: ["not", "isMethodScope"],
|
@@ -170,15 +196,17 @@ smalltalk.addMethod(
|
|
170
196
|
smalltalk.method({
|
171
197
|
selector: "isInlined",
|
172
198
|
category: 'testing',
|
173
|
-
fn: function ()
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
},
|
199
|
+
fn: function (){
|
200
|
+
var self=this;
|
201
|
+
return smalltalk.withContext(function($ctx1) {
|
202
|
+
$1=_st(_st(_st(self)._instruction())._notNil())._and_((function(){
|
203
|
+
return smalltalk.withContext(function($ctx2) {
|
204
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
205
|
+
return $1;
|
206
|
+
}, function($ctx1) {$ctx1.fill(self,"isInlined",{}, smalltalk.LexicalScope)})},
|
179
207
|
args: [],
|
180
|
-
source: "isInlined\x0a\x09^ self instruction isInlined",
|
181
|
-
messageSends: ["isInlined", "instruction"],
|
208
|
+
source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a \x09self instruction isInlined ]",
|
209
|
+
messageSends: ["and:", "isInlined", "instruction", "notNil"],
|
182
210
|
referencedClasses: []
|
183
211
|
}),
|
184
212
|
smalltalk.LexicalScope);
|
@@ -188,10 +216,10 @@ smalltalk.addMethod(
|
|
188
216
|
smalltalk.method({
|
189
217
|
selector: "isMethodScope",
|
190
218
|
category: 'testing',
|
191
|
-
fn: function ()
|
192
|
-
|
193
|
-
|
194
|
-
},
|
219
|
+
fn: function (){
|
220
|
+
var self=this;
|
221
|
+
return smalltalk.withContext(function($ctx1) {
|
222
|
+
}, function($ctx1) {$ctx1.fill(self,"isMethodScope",{}, smalltalk.LexicalScope)})},
|
195
223
|
args: [],
|
196
224
|
source: "isMethodScope\x0a\x09^ false",
|
197
225
|
messageSends: [],
|
@@ -204,22 +232,25 @@ smalltalk.addMethod(
|
|
204
232
|
smalltalk.method({
|
205
233
|
selector: "lookupVariable:",
|
206
234
|
category: 'accessing',
|
207
|
-
fn: function (aNode)
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
235
|
+
fn: function (aNode){
|
236
|
+
var self=this;
|
237
|
+
var lookup;
|
238
|
+
return smalltalk.withContext(function($ctx1) {
|
239
|
+
lookup=_st(self)._bindingFor_(aNode);
|
240
|
+
$1=lookup;
|
241
|
+
$2=(function(){
|
242
|
+
return smalltalk.withContext(function($ctx2) {
|
243
|
+
if(($receiver = $3) == nil || $receiver == undefined){
|
244
|
+
lookup=$3;
|
245
|
+
} else {
|
246
|
+
lookup=_st(_st(self)._outerScope())._lookupVariable_(aNode);
|
247
|
+
};
|
248
|
+
return lookup;
|
249
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
|
250
|
+
_st($1)._ifNil_($2);
|
251
|
+
$4=lookup;
|
252
|
+
return $4;
|
253
|
+
}, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup}, smalltalk.LexicalScope)})},
|
223
254
|
args: ["aNode"],
|
224
255
|
source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [ \x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
|
225
256
|
messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"],
|
@@ -232,17 +263,17 @@ smalltalk.addMethod(
|
|
232
263
|
smalltalk.method({
|
233
264
|
selector: "methodScope",
|
234
265
|
category: 'accessing',
|
235
|
-
fn: function ()
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
},
|
266
|
+
fn: function (){
|
267
|
+
var self=this;
|
268
|
+
return smalltalk.withContext(function($ctx1) {
|
269
|
+
$2=_st(self)._outerScope();
|
270
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
271
|
+
$1=$2;
|
272
|
+
} else {
|
273
|
+
$1=_st(_st(self)._outerScope())._methodScope();
|
274
|
+
};
|
275
|
+
return $1;
|
276
|
+
}, function($ctx1) {$ctx1.fill(self,"methodScope",{}, smalltalk.LexicalScope)})},
|
246
277
|
args: [],
|
247
278
|
source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
|
248
279
|
messageSends: ["ifNotNil:", "methodScope", "outerScope"],
|
@@ -255,10 +286,12 @@ smalltalk.addMethod(
|
|
255
286
|
smalltalk.method({
|
256
287
|
selector: "node",
|
257
288
|
category: 'accessing',
|
258
|
-
fn: function ()
|
259
|
-
|
260
|
-
|
261
|
-
|
289
|
+
fn: function (){
|
290
|
+
var self=this;
|
291
|
+
return smalltalk.withContext(function($ctx1) {
|
292
|
+
$1=self["@node"];
|
293
|
+
return $1;
|
294
|
+
}, function($ctx1) {$ctx1.fill(self,"node",{}, smalltalk.LexicalScope)})},
|
262
295
|
args: [],
|
263
296
|
source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
|
264
297
|
messageSends: [],
|
@@ -271,11 +304,10 @@ smalltalk.addMethod(
|
|
271
304
|
smalltalk.method({
|
272
305
|
selector: "node:",
|
273
306
|
category: 'accessing',
|
274
|
-
fn: function (aNode)
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
},
|
307
|
+
fn: function (aNode){
|
308
|
+
var self=this;
|
309
|
+
return smalltalk.withContext(function($ctx1) {
|
310
|
+
return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode}, smalltalk.LexicalScope)})},
|
279
311
|
args: ["aNode"],
|
280
312
|
source: "node: aNode\x0a\x09node := aNode",
|
281
313
|
messageSends: [],
|
@@ -288,10 +320,12 @@ smalltalk.addMethod(
|
|
288
320
|
smalltalk.method({
|
289
321
|
selector: "outerScope",
|
290
322
|
category: 'accessing',
|
291
|
-
fn: function ()
|
292
|
-
|
293
|
-
|
294
|
-
|
323
|
+
fn: function (){
|
324
|
+
var self=this;
|
325
|
+
return smalltalk.withContext(function($ctx1) {
|
326
|
+
$1=self["@outerScope"];
|
327
|
+
return $1;
|
328
|
+
}, function($ctx1) {$ctx1.fill(self,"outerScope",{}, smalltalk.LexicalScope)})},
|
295
329
|
args: [],
|
296
330
|
source: "outerScope\x0a\x09^ outerScope",
|
297
331
|
messageSends: [],
|
@@ -304,11 +338,10 @@ smalltalk.addMethod(
|
|
304
338
|
smalltalk.method({
|
305
339
|
selector: "outerScope:",
|
306
340
|
category: 'accessing',
|
307
|
-
fn: function (aLexicalScope)
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
},
|
341
|
+
fn: function (aLexicalScope){
|
342
|
+
var self=this;
|
343
|
+
return smalltalk.withContext(function($ctx1) {
|
344
|
+
return self}, function($ctx1) {$ctx1.fill(self,"outerScope:",{aLexicalScope:aLexicalScope}, smalltalk.LexicalScope)})},
|
312
345
|
args: ["aLexicalScope"],
|
313
346
|
source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
|
314
347
|
messageSends: [],
|
@@ -321,12 +354,12 @@ smalltalk.addMethod(
|
|
321
354
|
smalltalk.method({
|
322
355
|
selector: "pseudoVars",
|
323
356
|
category: 'accessing',
|
324
|
-
fn: function ()
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
},
|
357
|
+
fn: function (){
|
358
|
+
var self=this;
|
359
|
+
return smalltalk.withContext(function($ctx1) {
|
360
|
+
$1=_st(_st(self)._methodScope())._pseudoVars();
|
361
|
+
return $1;
|
362
|
+
}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{}, smalltalk.LexicalScope)})},
|
330
363
|
args: [],
|
331
364
|
source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
|
332
365
|
messageSends: ["pseudoVars", "methodScope"],
|
@@ -339,21 +372,26 @@ smalltalk.addMethod(
|
|
339
372
|
smalltalk.method({
|
340
373
|
selector: "scopeLevel",
|
341
374
|
category: 'accessing',
|
342
|
-
fn: function ()
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
375
|
+
fn: function (){
|
376
|
+
var self=this;
|
377
|
+
return smalltalk.withContext(function($ctx1) {
|
378
|
+
$1=_st(self)._outerScope();
|
379
|
+
if(($receiver = $1) == nil || $receiver == undefined){
|
380
|
+
return (1);
|
381
|
+
} else {
|
382
|
+
$1;
|
383
|
+
};
|
384
|
+
$2=_st(self)._isInlined();
|
385
|
+
if(smalltalk.assert($2)){
|
386
|
+
$3=_st(_st(self)._outerScope())._scopeLevel();
|
387
|
+
return $3;
|
388
|
+
};
|
389
|
+
$4=_st(_st(_st(self)._outerScope())._scopeLevel()).__plus((1));
|
390
|
+
return $4;
|
391
|
+
}, function($ctx1) {$ctx1.fill(self,"scopeLevel",{}, smalltalk.LexicalScope)})},
|
354
392
|
args: [],
|
355
|
-
source: "scopeLevel\x0a\
|
356
|
-
messageSends: ["
|
393
|
+
source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a \x0a\x09^ self outerScope scopeLevel + 1",
|
394
|
+
messageSends: ["ifNil:", "outerScope", "ifTrue:", "scopeLevel", "isInlined", "+"],
|
357
395
|
referencedClasses: []
|
358
396
|
}),
|
359
397
|
smalltalk.LexicalScope);
|
@@ -363,17 +401,18 @@ smalltalk.addMethod(
|
|
363
401
|
smalltalk.method({
|
364
402
|
selector: "temps",
|
365
403
|
category: 'accessing',
|
366
|
-
fn: function ()
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
404
|
+
fn: function (){
|
405
|
+
var self=this;
|
406
|
+
return smalltalk.withContext(function($ctx1) {
|
407
|
+
$2=self["@temps"];
|
408
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
409
|
+
self["@temps"]=_st((smalltalk.Dictionary || Dictionary))._new();
|
410
|
+
$1=self["@temps"];
|
411
|
+
} else {
|
412
|
+
$1=$2;
|
413
|
+
};
|
414
|
+
return $1;
|
415
|
+
}, function($ctx1) {$ctx1.fill(self,"temps",{}, smalltalk.LexicalScope)})},
|
377
416
|
args: [],
|
378
417
|
source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
|
379
418
|
messageSends: ["ifNil:", "new"],
|
@@ -390,12 +429,11 @@ smalltalk.addMethod(
|
|
390
429
|
smalltalk.method({
|
391
430
|
selector: "addIVar:",
|
392
431
|
category: 'adding',
|
393
|
-
fn: function (aString)
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
},
|
432
|
+
fn: function (aString){
|
433
|
+
var self=this;
|
434
|
+
return smalltalk.withContext(function($ctx1) {
|
435
|
+
_st(_st(_st(self)._iVars())._at_(aString))._scope_(self);
|
436
|
+
return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString}, smalltalk.MethodLexicalScope)})},
|
399
437
|
args: ["aString"],
|
400
438
|
source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
|
401
439
|
messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"],
|
@@ -408,11 +446,10 @@ smalltalk.addMethod(
|
|
408
446
|
smalltalk.method({
|
409
447
|
selector: "addNonLocalReturn:",
|
410
448
|
category: 'adding',
|
411
|
-
fn: function (aScope)
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
},
|
449
|
+
fn: function (aScope){
|
450
|
+
var self=this;
|
451
|
+
return smalltalk.withContext(function($ctx1) {
|
452
|
+
return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope}, smalltalk.MethodLexicalScope)})},
|
416
453
|
args: ["aScope"],
|
417
454
|
source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
|
418
455
|
messageSends: ["add:", "nonLocalReturns"],
|
@@ -425,12 +462,12 @@ smalltalk.addMethod(
|
|
425
462
|
smalltalk.method({
|
426
463
|
selector: "allVariableNames",
|
427
464
|
category: 'accessing',
|
428
|
-
fn: function ()
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
},
|
465
|
+
fn: function (){
|
466
|
+
var self=this;
|
467
|
+
return smalltalk.withContext(function($ctx1) {
|
468
|
+
$1=_st(smalltalk.LexicalScope.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(_st(self)._iVars())._keys());
|
469
|
+
return $1;
|
470
|
+
}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{}, smalltalk.MethodLexicalScope)})},
|
434
471
|
args: [],
|
435
472
|
source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
|
436
473
|
messageSends: [",", "keys", "iVars", "allVariableNames"],
|
@@ -443,17 +480,19 @@ smalltalk.addMethod(
|
|
443
480
|
smalltalk.method({
|
444
481
|
selector: "bindingFor:",
|
445
482
|
category: 'accessing',
|
446
|
-
fn: function (aNode)
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
}
|
483
|
+
fn: function (aNode){
|
484
|
+
var self=this;
|
485
|
+
return smalltalk.withContext(function($ctx1) {
|
486
|
+
$2=smalltalk.LexicalScope.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
|
487
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
488
|
+
$1=_st(_st(self)._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
|
489
|
+
return smalltalk.withContext(function($ctx2) {
|
490
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
491
|
+
} else {
|
492
|
+
$1=$2;
|
493
|
+
};
|
494
|
+
return $1;
|
495
|
+
}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode}, smalltalk.MethodLexicalScope)})},
|
457
496
|
args: ["aNode"],
|
458
497
|
source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
|
459
498
|
messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"],
|
@@ -466,10 +505,10 @@ smalltalk.addMethod(
|
|
466
505
|
smalltalk.method({
|
467
506
|
selector: "canInlineNonLocalReturns",
|
468
507
|
category: 'testing',
|
469
|
-
fn: function ()
|
470
|
-
|
471
|
-
|
472
|
-
},
|
508
|
+
fn: function (){
|
509
|
+
var self=this;
|
510
|
+
return smalltalk.withContext(function($ctx1) {
|
511
|
+
}, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{}, smalltalk.MethodLexicalScope)})},
|
473
512
|
args: [],
|
474
513
|
source: "canInlineNonLocalReturns\x0a\x09^ true",
|
475
514
|
messageSends: [],
|
@@ -482,12 +521,12 @@ smalltalk.addMethod(
|
|
482
521
|
smalltalk.method({
|
483
522
|
selector: "hasLocalReturn",
|
484
523
|
category: 'testing',
|
485
|
-
fn: function ()
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
},
|
524
|
+
fn: function (){
|
525
|
+
var self=this;
|
526
|
+
return smalltalk.withContext(function($ctx1) {
|
527
|
+
$1=_st(self)._localReturn();
|
528
|
+
return $1;
|
529
|
+
}, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{}, smalltalk.MethodLexicalScope)})},
|
491
530
|
args: [],
|
492
531
|
source: "hasLocalReturn\x0a\x09^ self localReturn",
|
493
532
|
messageSends: ["localReturn"],
|
@@ -500,12 +539,12 @@ smalltalk.addMethod(
|
|
500
539
|
smalltalk.method({
|
501
540
|
selector: "hasNonLocalReturn",
|
502
541
|
category: 'testing',
|
503
|
-
fn: function ()
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
},
|
542
|
+
fn: function (){
|
543
|
+
var self=this;
|
544
|
+
return smalltalk.withContext(function($ctx1) {
|
545
|
+
$1=_st(_st(self)._nonLocalReturns())._notEmpty();
|
546
|
+
return $1;
|
547
|
+
}, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{}, smalltalk.MethodLexicalScope)})},
|
509
548
|
args: [],
|
510
549
|
source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
|
511
550
|
messageSends: ["notEmpty", "nonLocalReturns"],
|
@@ -518,17 +557,18 @@ smalltalk.addMethod(
|
|
518
557
|
smalltalk.method({
|
519
558
|
selector: "iVars",
|
520
559
|
category: 'accessing',
|
521
|
-
fn: function ()
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
560
|
+
fn: function (){
|
561
|
+
var self=this;
|
562
|
+
return smalltalk.withContext(function($ctx1) {
|
563
|
+
$2=self["@iVars"];
|
564
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
565
|
+
self["@iVars"]=_st((smalltalk.Dictionary || Dictionary))._new();
|
566
|
+
$1=self["@iVars"];
|
567
|
+
} else {
|
568
|
+
$1=$2;
|
569
|
+
};
|
570
|
+
return $1;
|
571
|
+
}, function($ctx1) {$ctx1.fill(self,"iVars",{}, smalltalk.MethodLexicalScope)})},
|
532
572
|
args: [],
|
533
573
|
source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
|
534
574
|
messageSends: ["ifNil:", "new"],
|
@@ -541,10 +581,10 @@ smalltalk.addMethod(
|
|
541
581
|
smalltalk.method({
|
542
582
|
selector: "isMethodScope",
|
543
583
|
category: 'testing',
|
544
|
-
fn: function ()
|
545
|
-
|
546
|
-
|
547
|
-
},
|
584
|
+
fn: function (){
|
585
|
+
var self=this;
|
586
|
+
return smalltalk.withContext(function($ctx1) {
|
587
|
+
}, function($ctx1) {$ctx1.fill(self,"isMethodScope",{}, smalltalk.MethodLexicalScope)})},
|
548
588
|
args: [],
|
549
589
|
source: "isMethodScope\x0a\x09^ true",
|
550
590
|
messageSends: [],
|
@@ -557,16 +597,17 @@ smalltalk.addMethod(
|
|
557
597
|
smalltalk.method({
|
558
598
|
selector: "localReturn",
|
559
599
|
category: 'accessing',
|
560
|
-
fn: function ()
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
600
|
+
fn: function (){
|
601
|
+
var self=this;
|
602
|
+
return smalltalk.withContext(function($ctx1) {
|
603
|
+
$2=self["@localReturn"];
|
604
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
605
|
+
$1=false;
|
606
|
+
} else {
|
607
|
+
$1=$2;
|
608
|
+
};
|
609
|
+
return $1;
|
610
|
+
}, function($ctx1) {$ctx1.fill(self,"localReturn",{}, smalltalk.MethodLexicalScope)})},
|
570
611
|
args: [],
|
571
612
|
source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
|
572
613
|
messageSends: ["ifNil:"],
|
@@ -579,11 +620,10 @@ smalltalk.addMethod(
|
|
579
620
|
smalltalk.method({
|
580
621
|
selector: "localReturn:",
|
581
622
|
category: 'accessing',
|
582
|
-
fn: function (aBoolean)
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
},
|
623
|
+
fn: function (aBoolean){
|
624
|
+
var self=this;
|
625
|
+
return smalltalk.withContext(function($ctx1) {
|
626
|
+
return self}, function($ctx1) {$ctx1.fill(self,"localReturn:",{aBoolean:aBoolean}, smalltalk.MethodLexicalScope)})},
|
587
627
|
args: ["aBoolean"],
|
588
628
|
source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
|
589
629
|
messageSends: [],
|
@@ -596,10 +636,12 @@ smalltalk.addMethod(
|
|
596
636
|
smalltalk.method({
|
597
637
|
selector: "methodScope",
|
598
638
|
category: 'accessing',
|
599
|
-
fn: function ()
|
600
|
-
|
601
|
-
|
602
|
-
|
639
|
+
fn: function (){
|
640
|
+
var self=this;
|
641
|
+
return smalltalk.withContext(function($ctx1) {
|
642
|
+
$1=self;
|
643
|
+
return $1;
|
644
|
+
}, function($ctx1) {$ctx1.fill(self,"methodScope",{}, smalltalk.MethodLexicalScope)})},
|
603
645
|
args: [],
|
604
646
|
source: "methodScope\x0a\x09^ self",
|
605
647
|
messageSends: [],
|
@@ -612,18 +654,18 @@ smalltalk.addMethod(
|
|
612
654
|
smalltalk.method({
|
613
655
|
selector: "nonLocalReturns",
|
614
656
|
category: 'accessing',
|
615
|
-
fn: function ()
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
},
|
657
|
+
fn: function (){
|
658
|
+
var self=this;
|
659
|
+
return smalltalk.withContext(function($ctx1) {
|
660
|
+
$2=self["@nonLocalReturns"];
|
661
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
662
|
+
self["@nonLocalReturns"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
|
663
|
+
$1=self["@nonLocalReturns"];
|
664
|
+
} else {
|
665
|
+
$1=$2;
|
666
|
+
};
|
667
|
+
return $1;
|
668
|
+
}, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{}, smalltalk.MethodLexicalScope)})},
|
627
669
|
args: [],
|
628
670
|
source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
|
629
671
|
messageSends: ["ifNil:", "new"],
|
@@ -636,18 +678,25 @@ smalltalk.addMethod(
|
|
636
678
|
smalltalk.method({
|
637
679
|
selector: "pseudoVars",
|
638
680
|
category: 'accessing',
|
639
|
-
fn: function ()
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
681
|
+
fn: function (){
|
682
|
+
var self=this;
|
683
|
+
return smalltalk.withContext(function($ctx1) {
|
684
|
+
$1=self["@pseudoVars"];
|
685
|
+
if(($receiver = $1) == nil || $receiver == undefined){
|
686
|
+
self["@pseudoVars"]=_st((smalltalk.Dictionary || Dictionary))._new();
|
687
|
+
self["@pseudoVars"];
|
688
|
+
_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._pseudoVariableNames())._do_((function(each){
|
689
|
+
return smalltalk.withContext(function($ctx2) {
|
690
|
+
_st($2)._scope_(_st(self)._methodScope());
|
691
|
+
$3=_st($2)._yourself();
|
692
|
+
return _st(self["@pseudoVars"])._at_put_(each,$3);
|
693
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
694
|
+
} else {
|
695
|
+
$1;
|
696
|
+
};
|
697
|
+
$4=self["@pseudoVars"];
|
698
|
+
return $4;
|
699
|
+
}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{}, smalltalk.MethodLexicalScope)})},
|
651
700
|
args: [],
|
652
701
|
source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk current pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
|
653
702
|
messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"],
|
@@ -660,11 +709,11 @@ smalltalk.addMethod(
|
|
660
709
|
smalltalk.method({
|
661
710
|
selector: "removeNonLocalReturn:",
|
662
711
|
category: 'adding',
|
663
|
-
fn: function (aScope)
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
},
|
712
|
+
fn: function (aScope){
|
713
|
+
var self=this;
|
714
|
+
return smalltalk.withContext(function($ctx1) {
|
715
|
+
return smalltalk.withContext(function($ctx2) {
|
716
|
+
return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope}, smalltalk.MethodLexicalScope)})},
|
668
717
|
args: ["aScope"],
|
669
718
|
source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
|
670
719
|
messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
|
@@ -677,18 +726,18 @@ smalltalk.addMethod(
|
|
677
726
|
smalltalk.method({
|
678
727
|
selector: "unknownVariables",
|
679
728
|
category: 'accessing',
|
680
|
-
fn: function ()
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
},
|
729
|
+
fn: function (){
|
730
|
+
var self=this;
|
731
|
+
return smalltalk.withContext(function($ctx1) {
|
732
|
+
$2=self["@unknownVariables"];
|
733
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
734
|
+
self["@unknownVariables"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
|
735
|
+
$1=self["@unknownVariables"];
|
736
|
+
} else {
|
737
|
+
$1=$2;
|
738
|
+
};
|
739
|
+
return $1;
|
740
|
+
}, function($ctx1) {$ctx1.fill(self,"unknownVariables",{}, smalltalk.MethodLexicalScope)})},
|
692
741
|
args: [],
|
693
742
|
source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
|
694
743
|
messageSends: ["ifNil:", "new"],
|
@@ -705,12 +754,12 @@ smalltalk.addMethod(
|
|
705
754
|
smalltalk.method({
|
706
755
|
selector: "alias",
|
707
756
|
category: 'accessing',
|
708
|
-
fn: function ()
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
},
|
757
|
+
fn: function (){
|
758
|
+
var self=this;
|
759
|
+
return smalltalk.withContext(function($ctx1) {
|
760
|
+
$1=_st(_st(self)._name())._asVariableName();
|
761
|
+
return $1;
|
762
|
+
}, function($ctx1) {$ctx1.fill(self,"alias",{}, smalltalk.ScopeVar)})},
|
714
763
|
args: [],
|
715
764
|
source: "alias\x0a\x09^ self name asVariableName",
|
716
765
|
messageSends: ["asVariableName", "name"],
|
@@ -723,10 +772,10 @@ smalltalk.addMethod(
|
|
723
772
|
smalltalk.method({
|
724
773
|
selector: "isArgVar",
|
725
774
|
category: 'testing',
|
726
|
-
fn: function ()
|
727
|
-
|
728
|
-
|
729
|
-
},
|
775
|
+
fn: function (){
|
776
|
+
var self=this;
|
777
|
+
return smalltalk.withContext(function($ctx1) {
|
778
|
+
}, function($ctx1) {$ctx1.fill(self,"isArgVar",{}, smalltalk.ScopeVar)})},
|
730
779
|
args: [],
|
731
780
|
source: "isArgVar\x0a\x09^ false",
|
732
781
|
messageSends: [],
|
@@ -739,10 +788,10 @@ smalltalk.addMethod(
|
|
739
788
|
smalltalk.method({
|
740
789
|
selector: "isClassRefVar",
|
741
790
|
category: 'testing',
|
742
|
-
fn: function ()
|
743
|
-
|
744
|
-
|
745
|
-
},
|
791
|
+
fn: function (){
|
792
|
+
var self=this;
|
793
|
+
return smalltalk.withContext(function($ctx1) {
|
794
|
+
}, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{}, smalltalk.ScopeVar)})},
|
746
795
|
args: [],
|
747
796
|
source: "isClassRefVar\x0a\x09^ false",
|
748
797
|
messageSends: [],
|
@@ -755,10 +804,10 @@ smalltalk.addMethod(
|
|
755
804
|
smalltalk.method({
|
756
805
|
selector: "isInstanceVar",
|
757
806
|
category: 'testing',
|
758
|
-
fn: function ()
|
759
|
-
|
760
|
-
|
761
|
-
},
|
807
|
+
fn: function (){
|
808
|
+
var self=this;
|
809
|
+
return smalltalk.withContext(function($ctx1) {
|
810
|
+
}, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{}, smalltalk.ScopeVar)})},
|
762
811
|
args: [],
|
763
812
|
source: "isInstanceVar\x0a\x09^ false",
|
764
813
|
messageSends: [],
|
@@ -771,10 +820,10 @@ smalltalk.addMethod(
|
|
771
820
|
smalltalk.method({
|
772
821
|
selector: "isPseudoVar",
|
773
822
|
category: 'testing',
|
774
|
-
fn: function ()
|
775
|
-
|
776
|
-
|
777
|
-
},
|
823
|
+
fn: function (){
|
824
|
+
var self=this;
|
825
|
+
return smalltalk.withContext(function($ctx1) {
|
826
|
+
}, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{}, smalltalk.ScopeVar)})},
|
778
827
|
args: [],
|
779
828
|
source: "isPseudoVar\x0a\x09^ false",
|
780
829
|
messageSends: [],
|
@@ -787,10 +836,10 @@ smalltalk.addMethod(
|
|
787
836
|
smalltalk.method({
|
788
837
|
selector: "isTempVar",
|
789
838
|
category: 'testing',
|
790
|
-
fn: function ()
|
791
|
-
|
792
|
-
|
793
|
-
},
|
839
|
+
fn: function (){
|
840
|
+
var self=this;
|
841
|
+
return smalltalk.withContext(function($ctx1) {
|
842
|
+
}, function($ctx1) {$ctx1.fill(self,"isTempVar",{}, smalltalk.ScopeVar)})},
|
794
843
|
args: [],
|
795
844
|
source: "isTempVar\x0a\x09^ false",
|
796
845
|
messageSends: [],
|
@@ -803,10 +852,10 @@ smalltalk.addMethod(
|
|
803
852
|
smalltalk.method({
|
804
853
|
selector: "isUnknownVar",
|
805
854
|
category: 'testing',
|
806
|
-
fn: function ()
|
807
|
-
|
808
|
-
|
809
|
-
},
|
855
|
+
fn: function (){
|
856
|
+
var self=this;
|
857
|
+
return smalltalk.withContext(function($ctx1) {
|
858
|
+
}, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{}, smalltalk.ScopeVar)})},
|
810
859
|
args: [],
|
811
860
|
source: "isUnknownVar\x0a\x09^ false",
|
812
861
|
messageSends: [],
|
@@ -819,10 +868,12 @@ smalltalk.addMethod(
|
|
819
868
|
smalltalk.method({
|
820
869
|
selector: "name",
|
821
870
|
category: 'accessing',
|
822
|
-
fn: function ()
|
823
|
-
|
824
|
-
|
825
|
-
|
871
|
+
fn: function (){
|
872
|
+
var self=this;
|
873
|
+
return smalltalk.withContext(function($ctx1) {
|
874
|
+
$1=self["@name"];
|
875
|
+
return $1;
|
876
|
+
}, function($ctx1) {$ctx1.fill(self,"name",{}, smalltalk.ScopeVar)})},
|
826
877
|
args: [],
|
827
878
|
source: "name\x0a\x09^ name",
|
828
879
|
messageSends: [],
|
@@ -835,11 +886,10 @@ smalltalk.addMethod(
|
|
835
886
|
smalltalk.method({
|
836
887
|
selector: "name:",
|
837
888
|
category: 'accessing',
|
838
|
-
fn: function (aString)
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
},
|
889
|
+
fn: function (aString){
|
890
|
+
var self=this;
|
891
|
+
return smalltalk.withContext(function($ctx1) {
|
892
|
+
return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString}, smalltalk.ScopeVar)})},
|
843
893
|
args: ["aString"],
|
844
894
|
source: "name: aString\x0a\x09name := aString",
|
845
895
|
messageSends: [],
|
@@ -852,10 +902,12 @@ smalltalk.addMethod(
|
|
852
902
|
smalltalk.method({
|
853
903
|
selector: "scope",
|
854
904
|
category: 'accessing',
|
855
|
-
fn: function ()
|
856
|
-
|
857
|
-
|
858
|
-
|
905
|
+
fn: function (){
|
906
|
+
var self=this;
|
907
|
+
return smalltalk.withContext(function($ctx1) {
|
908
|
+
$1=self["@scope"];
|
909
|
+
return $1;
|
910
|
+
}, function($ctx1) {$ctx1.fill(self,"scope",{}, smalltalk.ScopeVar)})},
|
859
911
|
args: [],
|
860
912
|
source: "scope\x0a\x09^ scope",
|
861
913
|
messageSends: [],
|
@@ -868,11 +920,10 @@ smalltalk.addMethod(
|
|
868
920
|
smalltalk.method({
|
869
921
|
selector: "scope:",
|
870
922
|
category: 'accessing',
|
871
|
-
fn: function (aScope)
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
},
|
923
|
+
fn: function (aScope){
|
924
|
+
var self=this;
|
925
|
+
return smalltalk.withContext(function($ctx1) {
|
926
|
+
return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope}, smalltalk.ScopeVar)})},
|
876
927
|
args: ["aScope"],
|
877
928
|
source: "scope: aScope\x0a\x09scope := aScope",
|
878
929
|
messageSends: [],
|
@@ -885,17 +936,19 @@ smalltalk.addMethod(
|
|
885
936
|
smalltalk.method({
|
886
937
|
selector: "validateAssignment",
|
887
938
|
category: 'testing',
|
888
|
-
fn: function ()
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
939
|
+
fn: function (){
|
940
|
+
var self=this;
|
941
|
+
return smalltalk.withContext(function($ctx1) {
|
942
|
+
$1=_st(_st(self)._isArgVar())._or_((function(){
|
943
|
+
return smalltalk.withContext(function($ctx2) {
|
944
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
945
|
+
if(smalltalk.assert($1)){
|
946
|
+
$2=_st((smalltalk.InvalidAssignmentError || InvalidAssignmentError))._new();
|
947
|
+
_st($2)._variableName_(_st(self)._name());
|
948
|
+
$3=_st($2)._signal();
|
949
|
+
$3;
|
950
|
+
};
|
951
|
+
return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{}, smalltalk.ScopeVar)})},
|
899
952
|
args: [],
|
900
953
|
source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
|
901
954
|
messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"],
|
@@ -909,15 +962,15 @@ smalltalk.addMethod(
|
|
909
962
|
smalltalk.method({
|
910
963
|
selector: "on:",
|
911
964
|
category: 'instance creation',
|
912
|
-
fn: function (aString)
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
},
|
965
|
+
fn: function (aString){
|
966
|
+
var self=this;
|
967
|
+
return smalltalk.withContext(function($ctx1) {
|
968
|
+
$2=_st(self)._new();
|
969
|
+
_st($2)._name_(aString);
|
970
|
+
$3=_st($2)._yourself();
|
971
|
+
$1=$3;
|
972
|
+
return $1;
|
973
|
+
}, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString}, smalltalk.ScopeVar.klass)})},
|
921
974
|
args: ["aString"],
|
922
975
|
source: "on: aString\x0a\x09^ self new \x0a\x09\x09name: aString;\x0a\x09\x09yourself",
|
923
976
|
messageSends: ["name:", "new", "yourself"],
|
@@ -933,10 +986,12 @@ smalltalk.addMethod(
|
|
933
986
|
smalltalk.method({
|
934
987
|
selector: "node",
|
935
988
|
category: 'accessing',
|
936
|
-
fn: function ()
|
937
|
-
|
938
|
-
|
939
|
-
|
989
|
+
fn: function (){
|
990
|
+
var self=this;
|
991
|
+
return smalltalk.withContext(function($ctx1) {
|
992
|
+
$1=self["@node"];
|
993
|
+
return $1;
|
994
|
+
}, function($ctx1) {$ctx1.fill(self,"node",{}, smalltalk.AliasVar)})},
|
940
995
|
args: [],
|
941
996
|
source: "node\x0a\x09^ node",
|
942
997
|
messageSends: [],
|
@@ -949,11 +1004,10 @@ smalltalk.addMethod(
|
|
949
1004
|
smalltalk.method({
|
950
1005
|
selector: "node:",
|
951
1006
|
category: 'accessing',
|
952
|
-
fn: function (aNode)
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
},
|
1007
|
+
fn: function (aNode){
|
1008
|
+
var self=this;
|
1009
|
+
return smalltalk.withContext(function($ctx1) {
|
1010
|
+
return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode}, smalltalk.AliasVar)})},
|
957
1011
|
args: ["aNode"],
|
958
1012
|
source: "node: aNode\x0a\x09node := aNode",
|
959
1013
|
messageSends: [],
|
@@ -970,10 +1024,10 @@ smalltalk.addMethod(
|
|
970
1024
|
smalltalk.method({
|
971
1025
|
selector: "isArgVar",
|
972
1026
|
category: 'testing',
|
973
|
-
fn: function ()
|
974
|
-
|
975
|
-
|
976
|
-
},
|
1027
|
+
fn: function (){
|
1028
|
+
var self=this;
|
1029
|
+
return smalltalk.withContext(function($ctx1) {
|
1030
|
+
}, function($ctx1) {$ctx1.fill(self,"isArgVar",{}, smalltalk.ArgVar)})},
|
977
1031
|
args: [],
|
978
1032
|
source: "isArgVar\x0a\x09^ true",
|
979
1033
|
messageSends: [],
|
@@ -990,12 +1044,12 @@ smalltalk.addMethod(
|
|
990
1044
|
smalltalk.method({
|
991
1045
|
selector: "alias",
|
992
1046
|
category: 'accessing',
|
993
|
-
fn: function ()
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
},
|
1047
|
+
fn: function (){
|
1048
|
+
var self=this;
|
1049
|
+
return smalltalk.withContext(function($ctx1) {
|
1050
|
+
$1=_st(_st(_st(_st("(smalltalk.").__comma(_st(self)._name())).__comma(" || ")).__comma(_st(self)._name())).__comma(")");
|
1051
|
+
return $1;
|
1052
|
+
}, function($ctx1) {$ctx1.fill(self,"alias",{}, smalltalk.ClassRefVar)})},
|
999
1053
|
args: [],
|
1000
1054
|
source: "alias\x0a\x09^ '(smalltalk.', self name, ' || ', self name, ')'",
|
1001
1055
|
messageSends: [",", "name"],
|
@@ -1008,10 +1062,10 @@ smalltalk.addMethod(
|
|
1008
1062
|
smalltalk.method({
|
1009
1063
|
selector: "isClassRefVar",
|
1010
1064
|
category: 'testing',
|
1011
|
-
fn: function ()
|
1012
|
-
|
1013
|
-
|
1014
|
-
},
|
1065
|
+
fn: function (){
|
1066
|
+
var self=this;
|
1067
|
+
return smalltalk.withContext(function($ctx1) {
|
1068
|
+
}, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{}, smalltalk.ClassRefVar)})},
|
1015
1069
|
args: [],
|
1016
1070
|
source: "isClassRefVar\x0a\x09^ true",
|
1017
1071
|
messageSends: [],
|
@@ -1028,12 +1082,12 @@ smalltalk.addMethod(
|
|
1028
1082
|
smalltalk.method({
|
1029
1083
|
selector: "alias",
|
1030
1084
|
category: 'testing',
|
1031
|
-
fn: function ()
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
},
|
1085
|
+
fn: function (){
|
1086
|
+
var self=this;
|
1087
|
+
return smalltalk.withContext(function($ctx1) {
|
1088
|
+
$1=_st(_st("self[\x22@").__comma(_st(self)._name())).__comma("\x22]");
|
1089
|
+
return $1;
|
1090
|
+
}, function($ctx1) {$ctx1.fill(self,"alias",{}, smalltalk.InstanceVar)})},
|
1037
1091
|
args: [],
|
1038
1092
|
source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
|
1039
1093
|
messageSends: [",", "name"],
|
@@ -1046,10 +1100,10 @@ smalltalk.addMethod(
|
|
1046
1100
|
smalltalk.method({
|
1047
1101
|
selector: "isInstanceVar",
|
1048
1102
|
category: 'testing',
|
1049
|
-
fn: function ()
|
1050
|
-
|
1051
|
-
|
1052
|
-
},
|
1103
|
+
fn: function (){
|
1104
|
+
var self=this;
|
1105
|
+
return smalltalk.withContext(function($ctx1) {
|
1106
|
+
}, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{}, smalltalk.InstanceVar)})},
|
1053
1107
|
args: [],
|
1054
1108
|
source: "isInstanceVar\x0a\x09^ true",
|
1055
1109
|
messageSends: [],
|
@@ -1066,12 +1120,12 @@ smalltalk.addMethod(
|
|
1066
1120
|
smalltalk.method({
|
1067
1121
|
selector: "alias",
|
1068
1122
|
category: 'accessing',
|
1069
|
-
fn: function ()
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
},
|
1123
|
+
fn: function (){
|
1124
|
+
var self=this;
|
1125
|
+
return smalltalk.withContext(function($ctx1) {
|
1126
|
+
$1=_st(self)._name();
|
1127
|
+
return $1;
|
1128
|
+
}, function($ctx1) {$ctx1.fill(self,"alias",{}, smalltalk.PseudoVar)})},
|
1075
1129
|
args: [],
|
1076
1130
|
source: "alias\x0a\x09^ self name",
|
1077
1131
|
messageSends: ["name"],
|
@@ -1084,10 +1138,10 @@ smalltalk.addMethod(
|
|
1084
1138
|
smalltalk.method({
|
1085
1139
|
selector: "isPseudoVar",
|
1086
1140
|
category: 'testing',
|
1087
|
-
fn: function ()
|
1088
|
-
|
1089
|
-
|
1090
|
-
},
|
1141
|
+
fn: function (){
|
1142
|
+
var self=this;
|
1143
|
+
return smalltalk.withContext(function($ctx1) {
|
1144
|
+
}, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{}, smalltalk.PseudoVar)})},
|
1091
1145
|
args: [],
|
1092
1146
|
source: "isPseudoVar\x0a\x09^ true",
|
1093
1147
|
messageSends: [],
|
@@ -1104,10 +1158,10 @@ smalltalk.addMethod(
|
|
1104
1158
|
smalltalk.method({
|
1105
1159
|
selector: "isTempVar",
|
1106
1160
|
category: 'testing',
|
1107
|
-
fn: function ()
|
1108
|
-
|
1109
|
-
|
1110
|
-
},
|
1161
|
+
fn: function (){
|
1162
|
+
var self=this;
|
1163
|
+
return smalltalk.withContext(function($ctx1) {
|
1164
|
+
}, function($ctx1) {$ctx1.fill(self,"isTempVar",{}, smalltalk.TempVar)})},
|
1111
1165
|
args: [],
|
1112
1166
|
source: "isTempVar\x0a\x09^ true",
|
1113
1167
|
messageSends: [],
|
@@ -1124,10 +1178,10 @@ smalltalk.addMethod(
|
|
1124
1178
|
smalltalk.method({
|
1125
1179
|
selector: "isUnknownVar",
|
1126
1180
|
category: 'testing',
|
1127
|
-
fn: function ()
|
1128
|
-
|
1129
|
-
|
1130
|
-
},
|
1181
|
+
fn: function (){
|
1182
|
+
var self=this;
|
1183
|
+
return smalltalk.withContext(function($ctx1) {
|
1184
|
+
}, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{}, smalltalk.UnknownVar)})},
|
1131
1185
|
args: [],
|
1132
1186
|
source: "isUnknownVar\x0a\x09^ true",
|
1133
1187
|
messageSends: [],
|
@@ -1137,25 +1191,25 @@ smalltalk.UnknownVar);
|
|
1137
1191
|
|
1138
1192
|
|
1139
1193
|
|
1140
|
-
smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
|
1194
|
+
smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
|
1141
1195
|
smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."
|
1142
1196
|
smalltalk.addMethod(
|
1143
1197
|
"_classReferences",
|
1144
1198
|
smalltalk.method({
|
1145
1199
|
selector: "classReferences",
|
1146
1200
|
category: 'accessing',
|
1147
|
-
fn: function ()
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
},
|
1201
|
+
fn: function (){
|
1202
|
+
var self=this;
|
1203
|
+
return smalltalk.withContext(function($ctx1) {
|
1204
|
+
$2=self["@classReferences"];
|
1205
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
1206
|
+
self["@classReferences"]=_st((smalltalk.Set || Set))._new();
|
1207
|
+
$1=self["@classReferences"];
|
1208
|
+
} else {
|
1209
|
+
$1=$2;
|
1210
|
+
};
|
1211
|
+
return $1;
|
1212
|
+
}, function($ctx1) {$ctx1.fill(self,"classReferences",{}, smalltalk.SemanticAnalyzer)})},
|
1159
1213
|
args: [],
|
1160
1214
|
source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
|
1161
1215
|
messageSends: ["ifNil:", "new"],
|
@@ -1168,14 +1222,13 @@ smalltalk.addMethod(
|
|
1168
1222
|
smalltalk.method({
|
1169
1223
|
selector: "errorShadowingVariable:",
|
1170
1224
|
category: 'error handling',
|
1171
|
-
fn: function (aString)
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
},
|
1225
|
+
fn: function (aString){
|
1226
|
+
var self=this;
|
1227
|
+
return smalltalk.withContext(function($ctx1) {
|
1228
|
+
$1=_st((smalltalk.ShadowingVariableError || ShadowingVariableError))._new();
|
1229
|
+
_st($1)._variableName_(aString);
|
1230
|
+
$2=_st($1)._signal();
|
1231
|
+
return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString}, smalltalk.SemanticAnalyzer)})},
|
1179
1232
|
args: ["aString"],
|
1180
1233
|
source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
|
1181
1234
|
messageSends: ["variableName:", "new", "signal"],
|
@@ -1188,44 +1241,63 @@ smalltalk.addMethod(
|
|
1188
1241
|
smalltalk.method({
|
1189
1242
|
selector: "errorUnknownVariable:",
|
1190
1243
|
category: 'error handling',
|
1191
|
-
fn: function (aNode)
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
}
|
1244
|
+
fn: function (aNode){
|
1245
|
+
var self=this;
|
1246
|
+
var identifier;
|
1247
|
+
return smalltalk.withContext(function($ctx1) {
|
1248
|
+
identifier=_st(aNode)._value();
|
1249
|
+
$1=_st(_st(_st(["jQuery", "window", "process", "global"])._includes_(identifier))._not())._and_((function(){
|
1250
|
+
return smalltalk.withContext(function($ctx2) {
|
1251
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
1252
|
+
if(smalltalk.assert($1)){
|
1253
|
+
$2=_st((smalltalk.UnknownVariableError || UnknownVariableError))._new();
|
1254
|
+
_st($2)._variableName_(_st(aNode)._value());
|
1255
|
+
$3=_st($2)._signal();
|
1256
|
+
$3;
|
1257
|
+
} else {
|
1258
|
+
_st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
|
1259
|
+
};
|
1260
|
+
return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier}, smalltalk.SemanticAnalyzer)})},
|
1205
1261
|
args: ["aNode"],
|
1206
|
-
source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window)\x22\x0a\x0a\x09|
|
1207
|
-
messageSends: ["ifTrue:ifFalse:", "variableName:", "
|
1262
|
+
source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a We allow four variable names in addition: `jQuery`, `window`, `process` and `global` \x0a for nodejs and browser environments. \x0a \x0a This is only to make sure compilation works on both browser-based and nodejs environments.\x0a The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a identifier := aNode value.\x0a \x0a\x09((#('jQuery' 'window' 'process' 'global') includes: identifier) not \x0a and: [ self isVariableGloballyUndefined: identifier ]) \x0a \x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
|
1263
|
+
messageSends: ["value", "ifTrue:ifFalse:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope", "and:", "isVariableGloballyUndefined:", "not", "includes:"],
|
1208
1264
|
referencedClasses: ["UnknownVariableError"]
|
1209
1265
|
}),
|
1210
1266
|
smalltalk.SemanticAnalyzer);
|
1211
1267
|
|
1268
|
+
smalltalk.addMethod(
|
1269
|
+
"_isVariableGloballyUndefined_",
|
1270
|
+
smalltalk.method({
|
1271
|
+
selector: "isVariableGloballyUndefined:",
|
1272
|
+
category: 'testing',
|
1273
|
+
fn: function (aString){
|
1274
|
+
var self=this;
|
1275
|
+
return smalltalk.withContext(function($ctx1) {
|
1276
|
+
return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString}, smalltalk.SemanticAnalyzer)})},
|
1277
|
+
args: ["aString"],
|
1278
|
+
source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
|
1279
|
+
messageSends: [],
|
1280
|
+
referencedClasses: []
|
1281
|
+
}),
|
1282
|
+
smalltalk.SemanticAnalyzer);
|
1283
|
+
|
1212
1284
|
smalltalk.addMethod(
|
1213
1285
|
"_messageSends",
|
1214
1286
|
smalltalk.method({
|
1215
1287
|
selector: "messageSends",
|
1216
1288
|
category: 'accessing',
|
1217
|
-
fn: function ()
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
},
|
1289
|
+
fn: function (){
|
1290
|
+
var self=this;
|
1291
|
+
return smalltalk.withContext(function($ctx1) {
|
1292
|
+
$2=self["@messageSends"];
|
1293
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
1294
|
+
self["@messageSends"]=_st((smalltalk.Dictionary || Dictionary))._new();
|
1295
|
+
$1=self["@messageSends"];
|
1296
|
+
} else {
|
1297
|
+
$1=$2;
|
1298
|
+
};
|
1299
|
+
return $1;
|
1300
|
+
}, function($ctx1) {$ctx1.fill(self,"messageSends",{}, smalltalk.SemanticAnalyzer)})},
|
1229
1301
|
args: [],
|
1230
1302
|
source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
|
1231
1303
|
messageSends: ["ifNil:", "new"],
|
@@ -1238,12 +1310,12 @@ smalltalk.addMethod(
|
|
1238
1310
|
smalltalk.method({
|
1239
1311
|
selector: "newBlockScope",
|
1240
1312
|
category: 'factory',
|
1241
|
-
fn: function ()
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
},
|
1313
|
+
fn: function (){
|
1314
|
+
var self=this;
|
1315
|
+
return smalltalk.withContext(function($ctx1) {
|
1316
|
+
$1=_st(self)._newScopeOfClass_((smalltalk.LexicalScope || LexicalScope));
|
1317
|
+
return $1;
|
1318
|
+
}, function($ctx1) {$ctx1.fill(self,"newBlockScope",{}, smalltalk.SemanticAnalyzer)})},
|
1247
1319
|
args: [],
|
1248
1320
|
source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
|
1249
1321
|
messageSends: ["newScopeOfClass:"],
|
@@ -1256,12 +1328,12 @@ smalltalk.addMethod(
|
|
1256
1328
|
smalltalk.method({
|
1257
1329
|
selector: "newMethodScope",
|
1258
1330
|
category: 'factory',
|
1259
|
-
fn: function ()
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
},
|
1331
|
+
fn: function (){
|
1332
|
+
var self=this;
|
1333
|
+
return smalltalk.withContext(function($ctx1) {
|
1334
|
+
$1=_st(self)._newScopeOfClass_((smalltalk.MethodLexicalScope || MethodLexicalScope));
|
1335
|
+
return $1;
|
1336
|
+
}, function($ctx1) {$ctx1.fill(self,"newMethodScope",{}, smalltalk.SemanticAnalyzer)})},
|
1265
1337
|
args: [],
|
1266
1338
|
source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
|
1267
1339
|
messageSends: ["newScopeOfClass:"],
|
@@ -1274,15 +1346,15 @@ smalltalk.addMethod(
|
|
1274
1346
|
smalltalk.method({
|
1275
1347
|
selector: "newScopeOfClass:",
|
1276
1348
|
category: 'factory',
|
1277
|
-
fn: function (aLexicalScopeClass)
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
},
|
1349
|
+
fn: function (aLexicalScopeClass){
|
1350
|
+
var self=this;
|
1351
|
+
return smalltalk.withContext(function($ctx1) {
|
1352
|
+
$2=_st(aLexicalScopeClass)._new();
|
1353
|
+
_st($2)._outerScope_(self["@currentScope"]);
|
1354
|
+
$3=_st($2)._yourself();
|
1355
|
+
$1=$3;
|
1356
|
+
return $1;
|
1357
|
+
}, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass}, smalltalk.SemanticAnalyzer)})},
|
1286
1358
|
args: ["aLexicalScopeClass"],
|
1287
1359
|
source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new \x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
|
1288
1360
|
messageSends: ["outerScope:", "new", "yourself"],
|
@@ -1295,17 +1367,17 @@ smalltalk.addMethod(
|
|
1295
1367
|
smalltalk.method({
|
1296
1368
|
selector: "popScope",
|
1297
1369
|
category: 'scope',
|
1298
|
-
fn: function ()
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
},
|
1370
|
+
fn: function (){
|
1371
|
+
var self=this;
|
1372
|
+
return smalltalk.withContext(function($ctx1) {
|
1373
|
+
$1=self["@currentScope"];
|
1374
|
+
if(($receiver = $1) == nil || $receiver == undefined){
|
1375
|
+
$1;
|
1376
|
+
} else {
|
1377
|
+
self["@currentScope"]=_st(self["@currentScope"])._outerScope();
|
1378
|
+
self["@currentScope"];
|
1379
|
+
};
|
1380
|
+
return self}, function($ctx1) {$ctx1.fill(self,"popScope",{}, smalltalk.SemanticAnalyzer)})},
|
1309
1381
|
args: [],
|
1310
1382
|
source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
|
1311
1383
|
messageSends: ["ifNotNil:", "outerScope"],
|
@@ -1318,12 +1390,11 @@ smalltalk.addMethod(
|
|
1318
1390
|
smalltalk.method({
|
1319
1391
|
selector: "pushScope:",
|
1320
1392
|
category: 'scope',
|
1321
|
-
fn: function (aScope)
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
},
|
1393
|
+
fn: function (aScope){
|
1394
|
+
var self=this;
|
1395
|
+
return smalltalk.withContext(function($ctx1) {
|
1396
|
+
self["@currentScope"]=aScope;
|
1397
|
+
return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope}, smalltalk.SemanticAnalyzer)})},
|
1327
1398
|
args: ["aScope"],
|
1328
1399
|
source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
|
1329
1400
|
messageSends: ["outerScope:"],
|
@@ -1331,15 +1402,41 @@ referencedClasses: []
|
|
1331
1402
|
}),
|
1332
1403
|
smalltalk.SemanticAnalyzer);
|
1333
1404
|
|
1405
|
+
smalltalk.addMethod(
|
1406
|
+
"_superSends",
|
1407
|
+
smalltalk.method({
|
1408
|
+
selector: "superSends",
|
1409
|
+
category: 'accessing',
|
1410
|
+
fn: function (){
|
1411
|
+
var self=this;
|
1412
|
+
return smalltalk.withContext(function($ctx1) {
|
1413
|
+
$2=self["@superSends"];
|
1414
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
1415
|
+
self["@superSends"]=_st((smalltalk.Dictionary || Dictionary))._new();
|
1416
|
+
$1=self["@superSends"];
|
1417
|
+
} else {
|
1418
|
+
$1=$2;
|
1419
|
+
};
|
1420
|
+
return $1;
|
1421
|
+
}, function($ctx1) {$ctx1.fill(self,"superSends",{}, smalltalk.SemanticAnalyzer)})},
|
1422
|
+
args: [],
|
1423
|
+
source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
|
1424
|
+
messageSends: ["ifNil:", "new"],
|
1425
|
+
referencedClasses: ["Dictionary"]
|
1426
|
+
}),
|
1427
|
+
smalltalk.SemanticAnalyzer);
|
1428
|
+
|
1334
1429
|
smalltalk.addMethod(
|
1335
1430
|
"_theClass",
|
1336
1431
|
smalltalk.method({
|
1337
1432
|
selector: "theClass",
|
1338
1433
|
category: 'accessing',
|
1339
|
-
fn: function ()
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1434
|
+
fn: function (){
|
1435
|
+
var self=this;
|
1436
|
+
return smalltalk.withContext(function($ctx1) {
|
1437
|
+
$1=self["@theClass"];
|
1438
|
+
return $1;
|
1439
|
+
}, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.SemanticAnalyzer)})},
|
1343
1440
|
args: [],
|
1344
1441
|
source: "theClass\x0a\x09^ theClass",
|
1345
1442
|
messageSends: [],
|
@@ -1352,11 +1449,10 @@ smalltalk.addMethod(
|
|
1352
1449
|
smalltalk.method({
|
1353
1450
|
selector: "theClass:",
|
1354
1451
|
category: 'accessing',
|
1355
|
-
fn: function (aClass)
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
},
|
1452
|
+
fn: function (aClass){
|
1453
|
+
var self=this;
|
1454
|
+
return smalltalk.withContext(function($ctx1) {
|
1455
|
+
return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass}, smalltalk.SemanticAnalyzer)})},
|
1360
1456
|
args: ["aClass"],
|
1361
1457
|
source: "theClass: aClass\x0a\x09theClass := aClass",
|
1362
1458
|
messageSends: [],
|
@@ -1369,16 +1465,16 @@ smalltalk.addMethod(
|
|
1369
1465
|
smalltalk.method({
|
1370
1466
|
selector: "validateVariableScope:",
|
1371
1467
|
category: 'scope',
|
1372
|
-
fn: function (aString)
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
},
|
1468
|
+
fn: function (aString){
|
1469
|
+
var self=this;
|
1470
|
+
return smalltalk.withContext(function($ctx1) {
|
1471
|
+
$1=_st(self["@currentScope"])._lookupVariable_(aString);
|
1472
|
+
if(($receiver = $1) == nil || $receiver == undefined){
|
1473
|
+
$1;
|
1474
|
+
} else {
|
1475
|
+
_st(self)._errorShadowingVariable_(aString);
|
1476
|
+
};
|
1477
|
+
return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString}, smalltalk.SemanticAnalyzer)})},
|
1382
1478
|
args: ["aString"],
|
1383
1479
|
source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
|
1384
1480
|
messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"],
|
@@ -1391,12 +1487,11 @@ smalltalk.addMethod(
|
|
1391
1487
|
smalltalk.method({
|
1392
1488
|
selector: "visitAssignmentNode:",
|
1393
1489
|
category: 'visiting',
|
1394
|
-
fn: function (aNode)
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
},
|
1490
|
+
fn: function (aNode){
|
1491
|
+
var self=this;
|
1492
|
+
return smalltalk.withContext(function($ctx1) {
|
1493
|
+
_st(_st(aNode)._left())._beAssigned();
|
1494
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1400
1495
|
args: ["aNode"],
|
1401
1496
|
source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
|
1402
1497
|
messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
|
@@ -1409,16 +1504,18 @@ smalltalk.addMethod(
|
|
1409
1504
|
smalltalk.method({
|
1410
1505
|
selector: "visitBlockNode:",
|
1411
1506
|
category: 'visiting',
|
1412
|
-
fn: function (aNode)
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1507
|
+
fn: function (aNode){
|
1508
|
+
var self=this;
|
1509
|
+
return smalltalk.withContext(function($ctx1) {
|
1510
|
+
_st(aNode)._scope_(self["@currentScope"]);
|
1511
|
+
_st(self["@currentScope"])._node_(aNode);
|
1512
|
+
_st(_st(aNode)._parameters())._do_((function(each){
|
1513
|
+
return smalltalk.withContext(function($ctx2) {
|
1514
|
+
return _st(self["@currentScope"])._addArg_(each);
|
1515
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
1516
|
+
smalltalk.NodeVisitor.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
|
1517
|
+
_st(self)._popScope();
|
1518
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1422
1519
|
args: ["aNode"],
|
1423
1520
|
source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09\x0a\x09aNode parameters do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
|
1424
1521
|
messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"],
|
@@ -1431,17 +1528,20 @@ smalltalk.addMethod(
|
|
1431
1528
|
smalltalk.method({
|
1432
1529
|
selector: "visitCascadeNode:",
|
1433
1530
|
category: 'visiting',
|
1434
|
-
fn: function (aNode)
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1531
|
+
fn: function (aNode){
|
1532
|
+
var self=this;
|
1533
|
+
return smalltalk.withContext(function($ctx1) {
|
1534
|
+
_st(_st(aNode)._nodes())._do_((function(each){
|
1535
|
+
return smalltalk.withContext(function($ctx2) {
|
1536
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
1537
|
+
smalltalk.NodeVisitor.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
|
1538
|
+
$1=_st(_st(_st(aNode)._nodes())._first())._superSend();
|
1539
|
+
if(smalltalk.assert($1)){
|
1540
|
+
_st(_st(aNode)._nodes())._do_((function(each){
|
1541
|
+
return smalltalk.withContext(function($ctx2) {
|
1542
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
1543
|
+
};
|
1544
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1445
1545
|
args: ["aNode"],
|
1446
1546
|
source: "visitCascadeNode: aNode\x0a\x09\x22Populate the receiver into all children\x22\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09each receiver: aNode receiver ].\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ]]",
|
1447
1547
|
messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"],
|
@@ -1454,16 +1554,15 @@ smalltalk.addMethod(
|
|
1454
1554
|
smalltalk.method({
|
1455
1555
|
selector: "visitClassReferenceNode:",
|
1456
1556
|
category: 'visiting',
|
1457
|
-
fn: function (aNode)
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
},
|
1557
|
+
fn: function (aNode){
|
1558
|
+
var self=this;
|
1559
|
+
return smalltalk.withContext(function($ctx1) {
|
1560
|
+
_st(_st(self)._classReferences())._add_(_st(aNode)._value());
|
1561
|
+
$1=_st((smalltalk.ClassRefVar || ClassRefVar))._new();
|
1562
|
+
_st($1)._name_(_st(aNode)._value());
|
1563
|
+
$2=_st($1)._yourself();
|
1564
|
+
_st(aNode)._binding_($2);
|
1565
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1467
1566
|
args: ["aNode"],
|
1468
1567
|
source: "visitClassReferenceNode: aNode\x0a\x09self classReferences add: aNode value.\x0a\x09aNode binding: (ClassRefVar new name: aNode value; yourself)",
|
1469
1568
|
messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"],
|
@@ -1476,23 +1575,29 @@ smalltalk.addMethod(
|
|
1476
1575
|
smalltalk.method({
|
1477
1576
|
selector: "visitMethodNode:",
|
1478
1577
|
category: 'visiting',
|
1479
|
-
fn: function (aNode)
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1578
|
+
fn: function (aNode){
|
1579
|
+
var self=this;
|
1580
|
+
return smalltalk.withContext(function($ctx1) {
|
1581
|
+
_st(self)._pushScope_(_st(self)._newMethodScope());
|
1582
|
+
_st(aNode)._scope_(self["@currentScope"]);
|
1583
|
+
_st(self["@currentScope"])._node_(aNode);
|
1584
|
+
_st(_st(_st(self)._theClass())._allInstanceVariableNames())._do_((function(each){
|
1585
|
+
return smalltalk.withContext(function($ctx2) {
|
1586
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
1587
|
+
_st(_st(aNode)._arguments())._do_((function(each){
|
1588
|
+
return smalltalk.withContext(function($ctx2) {
|
1589
|
+
return _st(self["@currentScope"])._addArg_(each);
|
1590
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
1591
|
+
smalltalk.NodeVisitor.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
|
1592
|
+
$1=aNode;
|
1593
|
+
_st($1)._classReferences_(_st(self)._classReferences());
|
1594
|
+
_st($1)._messageSends_(_st(_st(self)._messageSends())._keys());
|
1595
|
+
$2=_st($1)._superSends_(_st(_st(self)._superSends())._keys());
|
1596
|
+
_st(self)._popScope();
|
1597
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1493
1598
|
args: ["aNode"],
|
1494
|
-
source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [:each | \x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode \x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09messageSends: self messageSends keys.\x0a\x09self popScope",
|
1495
|
-
messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "popScope"],
|
1599
|
+
source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [:each | \x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode \x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09messageSends: self messageSends keys;\x0a superSends: self superSends keys.\x0a\x09self popScope",
|
1600
|
+
messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "superSends:", "superSends", "popScope"],
|
1496
1601
|
referencedClasses: []
|
1497
1602
|
}),
|
1498
1603
|
smalltalk.SemanticAnalyzer);
|
@@ -1502,19 +1607,18 @@ smalltalk.addMethod(
|
|
1502
1607
|
smalltalk.method({
|
1503
1608
|
selector: "visitReturnNode:",
|
1504
1609
|
category: 'visiting',
|
1505
|
-
fn: function (aNode)
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
},
|
1610
|
+
fn: function (aNode){
|
1611
|
+
var self=this;
|
1612
|
+
return smalltalk.withContext(function($ctx1) {
|
1613
|
+
_st(aNode)._scope_(self["@currentScope"]);
|
1614
|
+
$1=_st(self["@currentScope"])._isMethodScope();
|
1615
|
+
if(smalltalk.assert($1)){
|
1616
|
+
_st(self["@currentScope"])._localReturn_(true);
|
1617
|
+
} else {
|
1618
|
+
_st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
|
1619
|
+
};
|
1620
|
+
smalltalk.NodeVisitor.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
|
1621
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1518
1622
|
args: ["aNode"],
|
1519
1623
|
source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
|
1520
1624
|
messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"],
|
@@ -1527,33 +1631,37 @@ smalltalk.addMethod(
|
|
1527
1631
|
smalltalk.method({
|
1528
1632
|
selector: "visitSendNode:",
|
1529
1633
|
category: 'visiting',
|
1530
|
-
fn: function (aNode)
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
},
|
1634
|
+
fn: function (aNode){
|
1635
|
+
var self=this;
|
1636
|
+
return smalltalk.withContext(function($ctx1) {
|
1637
|
+
$1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
|
1638
|
+
$2=(function(){
|
1639
|
+
return smalltalk.withContext(function($ctx2) {
|
1640
|
+
_st(_st(aNode)._receiver())._value_("self");
|
1641
|
+
_st(_st(self)._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
|
1642
|
+
return smalltalk.withContext(function($ctx3) {
|
1643
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
1644
|
+
return _st(_st(_st(self)._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
|
1645
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
|
1646
|
+
$3=(function(){
|
1647
|
+
return smalltalk.withContext(function($ctx2) {
|
1648
|
+
if(smalltalk.assert($4)){
|
1649
|
+
_st(aNode)._shouldBeInlined_(true);
|
1650
|
+
return _st(_st(aNode)._receiver())._shouldBeAliased_(true);
|
1651
|
+
};
|
1652
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
|
1653
|
+
_st($1)._ifTrue_ifFalse_($2,$3);
|
1654
|
+
_st(_st(self)._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
|
1655
|
+
return smalltalk.withContext(function($ctx2) {
|
1656
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
1657
|
+
_st(_st(_st(self)._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
|
1658
|
+
_st(aNode)._index_(_st(_st(_st(self)._messageSends())._at_(_st(aNode)._selector()))._size());
|
1659
|
+
smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
|
1660
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1553
1661
|
args: ["aNode"],
|
1554
|
-
source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super' \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self' ]\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver
|
1555
|
-
messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "
|
1556
|
-
referencedClasses: ["
|
1662
|
+
source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super' \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a \x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver shouldBeAliased: true ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
|
1663
|
+
messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "at:ifAbsentPut:", "selector", "new", "superSends", "add:", "at:", "ifTrue:", "shouldBeInlined:", "shouldBeAliased:", "includes:", "inlinedSelectors", "=", "value", "messageSends", "index:", "size", "visitSendNode:"],
|
1664
|
+
referencedClasses: ["Set", "IRSendInliner"]
|
1557
1665
|
}),
|
1558
1666
|
smalltalk.SemanticAnalyzer);
|
1559
1667
|
|
@@ -1562,12 +1670,14 @@ smalltalk.addMethod(
|
|
1562
1670
|
smalltalk.method({
|
1563
1671
|
selector: "visitSequenceNode:",
|
1564
1672
|
category: 'visiting',
|
1565
|
-
fn: function (aNode)
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
},
|
1673
|
+
fn: function (aNode){
|
1674
|
+
var self=this;
|
1675
|
+
return smalltalk.withContext(function($ctx1) {
|
1676
|
+
return smalltalk.withContext(function($ctx2) {
|
1677
|
+
return _st(self["@currentScope"])._addTemp_(each);
|
1678
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
1679
|
+
smalltalk.NodeVisitor.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
|
1680
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1571
1681
|
args: ["aNode"],
|
1572
1682
|
source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
|
1573
1683
|
messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"],
|
@@ -1580,22 +1690,22 @@ smalltalk.addMethod(
|
|
1580
1690
|
smalltalk.method({
|
1581
1691
|
selector: "visitVariableNode:",
|
1582
1692
|
category: 'visiting',
|
1583
|
-
fn: function (aNode)
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
},
|
1693
|
+
fn: function (aNode){
|
1694
|
+
var self=this;
|
1695
|
+
return smalltalk.withContext(function($ctx1) {
|
1696
|
+
$1=aNode;
|
1697
|
+
$3=_st(self["@currentScope"])._lookupVariable_(aNode);
|
1698
|
+
if(($receiver = $3) == nil || $receiver == undefined){
|
1699
|
+
_st(self)._errorUnknownVariable_(aNode);
|
1700
|
+
$4=_st((smalltalk.UnknownVar || UnknownVar))._new();
|
1701
|
+
_st($4)._name_(_st(aNode)._value());
|
1702
|
+
$5=_st($4)._yourself();
|
1703
|
+
$2=$5;
|
1704
|
+
} else {
|
1705
|
+
$2=$3;
|
1706
|
+
};
|
1707
|
+
_st($1)._binding_($2);
|
1708
|
+
return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode}, smalltalk.SemanticAnalyzer)})},
|
1599
1709
|
args: ["aNode"],
|
1600
1710
|
source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error\x22\x0a\x0a\x09aNode binding: ((currentScope lookupVariable: aNode) ifNil: [ \x0a\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09UnknownVar new name: aNode value; yourself ])",
|
1601
1711
|
messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"],
|
@@ -1609,15 +1719,15 @@ smalltalk.addMethod(
|
|
1609
1719
|
smalltalk.method({
|
1610
1720
|
selector: "on:",
|
1611
1721
|
category: 'instance creation',
|
1612
|
-
fn: function (aClass)
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
},
|
1722
|
+
fn: function (aClass){
|
1723
|
+
var self=this;
|
1724
|
+
return smalltalk.withContext(function($ctx1) {
|
1725
|
+
$2=_st(self)._new();
|
1726
|
+
_st($2)._theClass_(aClass);
|
1727
|
+
$3=_st($2)._yourself();
|
1728
|
+
$1=$3;
|
1729
|
+
return $1;
|
1730
|
+
}, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass}, smalltalk.SemanticAnalyzer.klass)})},
|
1621
1731
|
args: ["aClass"],
|
1622
1732
|
source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
|
1623
1733
|
messageSends: ["theClass:", "new", "yourself"],
|