equal
deleted
inserted
replaced
92 ]. |
92 ]. |
93 ] |
93 ] |
94 ! |
94 ! |
95 |
95 |
96 execute:code for:receiver arguments:arguments |
96 execute:code for:receiver arguments:arguments |
97 |f result| |
97 |parser f result| |
|
98 |
|
99 "/ First, validate the tree |
|
100 parser := JavaScriptParser parseMethod: code in: nil. |
|
101 self assert: parser tree notNil. |
|
102 JavaScriptParseNodeValidator validate: parser tree source: code. |
98 |
103 |
99 "/ Transcript showCR:(thisContext sender selector , '...'). |
104 "/ Transcript showCR:(thisContext sender selector , '...'). |
100 |
105 |
101 f := JavaScriptCompiler |
106 f := JavaScriptCompiler |
102 compile:code |
107 compile:code |
113 |
118 |
114 result := f valueWithReceiver:receiver arguments:arguments. |
119 result := f valueWithReceiver:receiver arguments:arguments. |
115 ^ result |
120 ^ result |
116 |
121 |
117 "Modified: / 09-10-2011 / 11:41:51 / cg" |
122 "Modified: / 09-10-2011 / 11:41:51 / cg" |
|
123 "Modified (format): / 20-09-2013 / 11:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
118 ! |
124 ! |
119 |
125 |
120 execute:code for:receiver arguments:arguments expect:expectedResult |
126 execute:code for:receiver arguments:arguments expect:expectedResult |
121 |result| |
127 |result| |
122 |
128 |
168 ^ output contents |
174 ^ output contents |
169 ! |
175 ! |
170 |
176 |
171 setUp |
177 setUp |
172 JavaScriptCompiler isNil ifTrue:[ |
178 JavaScriptCompiler isNil ifTrue:[ |
173 Smalltalk loadPackage:'stx:libjavascript' |
179 Smalltalk loadPackage:'stx:libjavascript'. |
|
180 JavaScriptParseNodeValidator autoload. |
174 ]. |
181 ]. |
175 |
182 |
176 "Created: / 09-08-2011 / 23:12:13 / cg" |
183 "Created: / 09-08-2011 / 23:12:13 / cg" |
|
184 "Modified: / 20-09-2013 / 11:58:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
177 ! |
185 ! |
178 |
186 |
179 withTranscriptRedirectedTo:aStream do:aBlock |
187 withTranscriptRedirectedTo:aStream do:aBlock |
180 "yes, globals are bad - that's what we need stuff like this for..." |
188 "yes, globals are bad - that's what we need stuff like this for..." |
181 |
189 |