Compiler-Tests.deploy.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. smalltalk.addPackage('Compiler-Tests', {});
  2. smalltalk.addClass('ASTInterpreterTest', smalltalk.TestCase, [], 'Compiler-Tests');
  3. smalltalk.addMethod(
  4. "_analyze_forClass_",
  5. smalltalk.method({
  6. selector: "analyze:forClass:",
  7. fn: function (aNode,aClass){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $1;
  10. _st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
  11. $1=aNode;
  12. return $1;
  13. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass}, smalltalk.ASTInterpreterTest)})}
  14. }),
  15. smalltalk.ASTInterpreterTest);
  16. smalltalk.addMethod(
  17. "_interpret_",
  18. smalltalk.method({
  19. selector: "interpret:",
  20. fn: function (aString){
  21. var self=this;
  22. return smalltalk.withContext(function($ctx1) { var $1;
  23. $1=_st(self)._interpret_withArguments_(aString,_st((smalltalk.Dictionary || Dictionary))._new());
  24. return $1;
  25. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aString:aString}, smalltalk.ASTInterpreterTest)})}
  26. }),
  27. smalltalk.ASTInterpreterTest);
  28. smalltalk.addMethod(
  29. "_interpret_receiver_withArguments_",
  30. smalltalk.method({
  31. selector: "interpret:receiver:withArguments:",
  32. fn: function (aString,anObject,aDictionary){
  33. var self=this;
  34. var ctx;
  35. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  36. ctx=_st((smalltalk.AIContext || AIContext))._new();
  37. _st(ctx)._receiver_(anObject);
  38. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  39. return smalltalk.withContext(function($ctx2) { return _st(ctx)._localAt_put_(key,value);
  40. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  41. $2=_st(self)._interpreter();
  42. _st($2)._context_(ctx);
  43. $3=_st($2)._interpret_(_st(_st(_st(self)._parse_forClass_(aString,_st(anObject)._class()))._nodes())._first());
  44. $1=$3;
  45. return $1;
  46. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx}, smalltalk.ASTInterpreterTest)})}
  47. }),
  48. smalltalk.ASTInterpreterTest);
  49. smalltalk.addMethod(
  50. "_interpret_withArguments_",
  51. smalltalk.method({
  52. selector: "interpret:withArguments:",
  53. fn: function (aString,aDictionary){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) { var $1;
  56. $1=_st(self)._interpret_receiver_withArguments_(aString,_st((smalltalk.Object || Object))._new(),aDictionary);
  57. return $1;
  58. }, function($ctx1) {$ctx1.fill(self,"interpret:withArguments:",{aString:aString,aDictionary:aDictionary}, smalltalk.ASTInterpreterTest)})}
  59. }),
  60. smalltalk.ASTInterpreterTest);
  61. smalltalk.addMethod(
  62. "_interpreter",
  63. smalltalk.method({
  64. selector: "interpreter",
  65. fn: function (){
  66. var self=this;
  67. return smalltalk.withContext(function($ctx1) { var $1;
  68. $1=_st((smalltalk.ASTInterpreter || ASTInterpreter))._new();
  69. return $1;
  70. }, function($ctx1) {$ctx1.fill(self,"interpreter",{}, smalltalk.ASTInterpreterTest)})}
  71. }),
  72. smalltalk.ASTInterpreterTest);
  73. smalltalk.addMethod(
  74. "_parse_",
  75. smalltalk.method({
  76. selector: "parse:",
  77. fn: function (aString){
  78. var self=this;
  79. return smalltalk.withContext(function($ctx1) { var $1;
  80. $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString}, smalltalk.ASTInterpreterTest)})}
  83. }),
  84. smalltalk.ASTInterpreterTest);
  85. smalltalk.addMethod(
  86. "_parse_forClass_",
  87. smalltalk.method({
  88. selector: "parse:forClass:",
  89. fn: function (aString,aClass){
  90. var self=this;
  91. return smalltalk.withContext(function($ctx1) { var $1;
  92. $1=_st(self)._analyze_forClass_(_st(self)._parse_(aString),aClass);
  93. return $1;
  94. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass}, smalltalk.ASTInterpreterTest)})}
  95. }),
  96. smalltalk.ASTInterpreterTest);
  97. smalltalk.addMethod(
  98. "_testBinarySend",
  99. smalltalk.method({
  100. selector: "testBinarySend",
  101. fn: function (){
  102. var self=this;
  103. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
  104. return self}, function($ctx1) {$ctx1.fill(self,"testBinarySend",{}, smalltalk.ASTInterpreterTest)})}
  105. }),
  106. smalltalk.ASTInterpreterTest);
  107. smalltalk.addMethod(
  108. "_testBlockLiteral",
  109. smalltalk.method({
  110. selector: "testBlockLiteral",
  111. fn: function (){
  112. var self=this;
  113. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self)._interpret_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]"),(1));
  114. _st(self)._assert_equals_(_st(self)._interpret_("foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]"),(1));
  115. _st(self)._assert_equals_(_st(self)._interpret_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]"),(2));
  116. return self}, function($ctx1) {$ctx1.fill(self,"testBlockLiteral",{}, smalltalk.ASTInterpreterTest)})}
  117. }),
  118. smalltalk.ASTInterpreterTest);
  119. smalltalk.addMethod(
  120. "_testCascade",
  121. smalltalk.method({
  122. selector: "testCascade",
  123. fn: function (){
  124. var self=this;
  125. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self)._interpret_("foo ^ OrderedCollection new add: 2; add: 3; yourself"),_st((smalltalk.OrderedCollection || OrderedCollection))._with_with_((2),(3)));
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCascade",{}, smalltalk.ASTInterpreterTest)})}
  127. }),
  128. smalltalk.ASTInterpreterTest);
  129. smalltalk.addMethod(
  130. "_testInlinedJSStatement",
  131. smalltalk.method({
  132. selector: "testInlinedJSStatement",
  133. fn: function (){
  134. var self=this;
  135. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self)._interpret_("foo <return 2+3>"),(5));
  136. _st(self)._assert_equals_(_st(self)._interpret_withArguments_("foo: anInteger <return 2 + anInteger>",smalltalk.HashedCollection._fromPairs_([_st("anInteger").__minus_gt((3))])),(5));
  137. return self}, function($ctx1) {$ctx1.fill(self,"testInlinedJSStatement",{}, smalltalk.ASTInterpreterTest)})}
  138. }),
  139. smalltalk.ASTInterpreterTest);
  140. smalltalk.addMethod(
  141. "_testInstVarAssignment",
  142. smalltalk.method({
  143. selector: "testInstVarAssignment",
  144. fn: function (){
  145. var self=this;
  146. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self)._interpret_receiver_withArguments_("foo: anInteger x := anInteger. ^ x",_st((smalltalk.Point || Point))._new(),smalltalk.HashedCollection._fromPairs_([_st("anInteger").__minus_gt((2))])),(2));
  147. return self}, function($ctx1) {$ctx1.fill(self,"testInstVarAssignment",{}, smalltalk.ASTInterpreterTest)})}
  148. }),
  149. smalltalk.ASTInterpreterTest);
  150. smalltalk.addMethod(
  151. "_testTempAssignment",
  152. smalltalk.method({
  153. selector: "testTempAssignment",
  154. fn: function (){
  155. var self=this;
  156. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self)._interpret_("foo | a | a := 2. ^ a"),(2));
  157. return self}, function($ctx1) {$ctx1.fill(self,"testTempAssignment",{}, smalltalk.ASTInterpreterTest)})}
  158. }),
  159. smalltalk.ASTInterpreterTest);
  160. smalltalk.addClass('CodeGeneratorTest', smalltalk.TestCase, ['receiver'], 'Compiler-Tests');
  161. smalltalk.addMethod(
  162. "_codeGeneratorClass",
  163. smalltalk.method({
  164. selector: "codeGeneratorClass",
  165. fn: function (){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) { var $1;
  168. $1=(smalltalk.CodeGenerator || CodeGenerator);
  169. return $1;
  170. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{}, smalltalk.CodeGeneratorTest)})}
  171. }),
  172. smalltalk.CodeGeneratorTest);
  173. smalltalk.addMethod(
  174. "_compiler",
  175. smalltalk.method({
  176. selector: "compiler",
  177. fn: function (){
  178. var self=this;
  179. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  180. $2=_st((smalltalk.Compiler || Compiler))._new();
  181. _st($2)._codeGeneratorClass_(_st(self)._codeGeneratorClass());
  182. $3=_st($2)._yourself();
  183. $1=$3;
  184. return $1;
  185. }, function($ctx1) {$ctx1.fill(self,"compiler",{}, smalltalk.CodeGeneratorTest)})}
  186. }),
  187. smalltalk.CodeGeneratorTest);
  188. smalltalk.addMethod(
  189. "_setUp",
  190. smalltalk.method({
  191. selector: "setUp",
  192. fn: function (){
  193. var self=this;
  194. return smalltalk.withContext(function($ctx1) { self["@receiver"]=_st(_st(self)._targetClass())._new();
  195. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.CodeGeneratorTest)})}
  196. }),
  197. smalltalk.CodeGeneratorTest);
  198. smalltalk.addMethod(
  199. "_should_return_",
  200. smalltalk.method({
  201. selector: "should:return:",
  202. fn: function (aString,anObject){
  203. var self=this;
  204. var method,result;
  205. return smalltalk.withContext(function($ctx1) { method=_st(_st(self)._compiler())._install_forClass_category_(aString,_st(self)._targetClass(),"tests");
  206. result=_st(self["@receiver"])._perform_(_st(method)._selector());
  207. _st(_st(self)._targetClass())._removeCompiledMethod_(method);
  208. _st(self)._assert_equals_(anObject,result);
  209. return self}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject,method:method,result:result}, smalltalk.CodeGeneratorTest)})}
  210. }),
  211. smalltalk.CodeGeneratorTest);
  212. smalltalk.addMethod(
  213. "_targetClass",
  214. smalltalk.method({
  215. selector: "targetClass",
  216. fn: function (){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) { var $1;
  219. $1=(smalltalk.DoIt || DoIt);
  220. return $1;
  221. }, function($ctx1) {$ctx1.fill(self,"targetClass",{}, smalltalk.CodeGeneratorTest)})}
  222. }),
  223. smalltalk.CodeGeneratorTest);
  224. smalltalk.addMethod(
  225. "_tearDown",
  226. smalltalk.method({
  227. selector: "tearDown",
  228. fn: function (){
  229. var self=this;
  230. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.CodeGeneratorTest)})}
  231. }),
  232. smalltalk.CodeGeneratorTest);
  233. smalltalk.addMethod(
  234. "_testAssignment",
  235. smalltalk.method({
  236. selector: "testAssignment",
  237. fn: function (){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  240. _st(self)._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  241. _st(self)._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  242. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{}, smalltalk.CodeGeneratorTest)})}
  243. }),
  244. smalltalk.CodeGeneratorTest);
  245. smalltalk.addMethod(
  246. "_testBlockReturn",
  247. smalltalk.method({
  248. selector: "testBlockReturn",
  249. fn: function (){
  250. var self=this;
  251. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  252. _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  253. _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  254. return self}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{}, smalltalk.CodeGeneratorTest)})}
  255. }),
  256. smalltalk.CodeGeneratorTest);
  257. smalltalk.addMethod(
  258. "_testCascades",
  259. smalltalk.method({
  260. selector: "testCascades",
  261. fn: function (){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  264. return self}, function($ctx1) {$ctx1.fill(self,"testCascades",{}, smalltalk.CodeGeneratorTest)})}
  265. }),
  266. smalltalk.CodeGeneratorTest);
  267. smalltalk.addMethod(
  268. "_testDynamicArrayElementsOrdered",
  269. smalltalk.method({
  270. selector: "testDynamicArrayElementsOrdered",
  271. fn: function (){
  272. var self=this;
  273. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo\x0a | x |\x0a x := 1.\x0a ^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  274. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{}, smalltalk.CodeGeneratorTest)})}
  275. }),
  276. smalltalk.CodeGeneratorTest);
  277. smalltalk.addMethod(
  278. "_testDynamicDictionaryElementsOrdered",
  279. smalltalk.method({
  280. selector: "testDynamicDictionaryElementsOrdered",
  281. fn: function (){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo\x0a | x |\x0a x := 'foo'->1.\x0a ^ #{ x. (true ifTrue: [ x := 'bar'->2 ]) }\x0a",smalltalk.HashedCollection._fromPairs_([_st("foo").__minus_gt((1)),_st("bar").__minus_gt((2))]));
  284. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{}, smalltalk.CodeGeneratorTest)})}
  285. }),
  286. smalltalk.CodeGeneratorTest);
  287. smalltalk.addMethod(
  288. "_testInnerTemporalDependentElementsOrdered",
  289. smalltalk.method({
  290. selector: "testInnerTemporalDependentElementsOrdered",
  291. fn: function (){
  292. var self=this;
  293. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo\x0a | x |\x0a x := Array.\x0a ^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",[_st("foo").__minus_gt((smalltalk.Array || Array)),_st("bar").__minus_gt((2))]);
  294. _st(self)._should_return_("foo\x0a | x |\x0a x := 1.\x0a ^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",[_st("foo").__minus_gt((1)),_st("bar").__minus_gt((2))]);
  295. _st(self)._should_return_("foo\x0a | x |\x0a x := 1.\x0a ^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",[_st("foo").__minus_gt((1)),_st("bar").__minus_gt((2))]);
  296. _st(self)._should_return_("foo\x0a | x |\x0a x := 1.\x0a ^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",smalltalk.HashedCollection._fromPairs_([_st("foo").__minus_gt((1)),_st("bar").__minus_gt((2))]));
  297. return self}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{}, smalltalk.CodeGeneratorTest)})}
  298. }),
  299. smalltalk.CodeGeneratorTest);
  300. smalltalk.addMethod(
  301. "_testLiterals",
  302. smalltalk.method({
  303. selector: "testLiterals",
  304. fn: function (){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ 1",(1));
  307. _st(self)._should_return_("foo ^ 'hello'","hello");
  308. _st(self)._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  309. _st(self)._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  310. _st(self)._should_return_("foo ^ true",true);
  311. _st(self)._should_return_("foo ^ false",false);
  312. _st(self)._should_return_("foo ^ #{1->2. 3->4}",smalltalk.HashedCollection._fromPairs_([_st((1)).__minus_gt((2)),_st((3)).__minus_gt((4))]));
  313. _st(self)._should_return_("foo ^ #hello",smalltalk.symbolFor("hello"));
  314. _st(self)._should_return_("foo ^ -123.456",(-123.456));
  315. return self}, function($ctx1) {$ctx1.fill(self,"testLiterals",{}, smalltalk.CodeGeneratorTest)})}
  316. }),
  317. smalltalk.CodeGeneratorTest);
  318. smalltalk.addMethod(
  319. "_testLocalReturn",
  320. smalltalk.method({
  321. selector: "testLocalReturn",
  322. fn: function (){
  323. var self=this;
  324. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ 1",(1));
  325. _st(self)._should_return_("foo ^ 1 + 1",(2));
  326. _st(self)._should_return_("foo ",self["@receiver"]);
  327. _st(self)._should_return_("foo self asString",self["@receiver"]);
  328. _st(self)._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  329. return self}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{}, smalltalk.CodeGeneratorTest)})}
  330. }),
  331. smalltalk.CodeGeneratorTest);
  332. smalltalk.addMethod(
  333. "_testMessageSends",
  334. smalltalk.method({
  335. selector: "testMessageSends",
  336. fn: function (){
  337. var self=this;
  338. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ 1 asString","1");
  339. _st(self)._should_return_("foo ^ 1 + 1",(2));
  340. _st(self)._should_return_("foo ^ 1 + 2 * 3",(9));
  341. _st(self)._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  342. _st(self)._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  343. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{}, smalltalk.CodeGeneratorTest)})}
  344. }),
  345. smalltalk.CodeGeneratorTest);
  346. smalltalk.addMethod(
  347. "_testNestedIfTrue",
  348. smalltalk.method({
  349. selector: "testNestedIfTrue",
  350. fn: function (){
  351. var self=this;
  352. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  353. _st(self)._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  354. _st(self)._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  355. _st(self)._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  356. return self}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{}, smalltalk.CodeGeneratorTest)})}
  357. }),
  358. smalltalk.CodeGeneratorTest);
  359. smalltalk.addMethod(
  360. "_testNonLocalReturn",
  361. smalltalk.method({
  362. selector: "testNonLocalReturn",
  363. fn: function (){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo [ ^ 1 ] value",(1));
  366. _st(self)._should_return_("foo [ ^ 1 + 1 ] value",(2));
  367. _st(self)._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  368. _st(self)._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  369. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{}, smalltalk.CodeGeneratorTest)})}
  370. }),
  371. smalltalk.CodeGeneratorTest);
  372. smalltalk.addMethod(
  373. "_testSendReceiverAndArgumentsOrdered",
  374. smalltalk.method({
  375. selector: "testSendReceiverAndArgumentsOrdered",
  376. fn: function (){
  377. var self=this;
  378. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo\x0a | x |\x0a x := 1.\x0a ^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  379. _st(self)._should_return_("foo\x0a | x |\x0a x := Array.\x0a ^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[(smalltalk.Array || Array),(2)]);
  380. return self}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{}, smalltalk.CodeGeneratorTest)})}
  381. }),
  382. smalltalk.CodeGeneratorTest);
  383. smalltalk.addMethod(
  384. "_testifFalse",
  385. smalltalk.method({
  386. selector: "testifFalse",
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  390. _st(self)._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  391. _st(self)._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  392. _st(self)._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  393. return self}, function($ctx1) {$ctx1.fill(self,"testifFalse",{}, smalltalk.CodeGeneratorTest)})}
  394. }),
  395. smalltalk.CodeGeneratorTest);
  396. smalltalk.addMethod(
  397. "_testifFalseIfTrue",
  398. smalltalk.method({
  399. selector: "testifFalseIfTrue",
  400. fn: function (){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  403. _st(self)._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  404. _st(self)._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  405. _st(self)._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  406. return self}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{}, smalltalk.CodeGeneratorTest)})}
  407. }),
  408. smalltalk.CodeGeneratorTest);
  409. smalltalk.addMethod(
  410. "_testifNil",
  411. smalltalk.method({
  412. selector: "testifNil",
  413. fn: function (){
  414. var self=this;
  415. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  416. _st(self)._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  417. _st(self)._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  418. _st(self)._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  419. return self}, function($ctx1) {$ctx1.fill(self,"testifNil",{}, smalltalk.CodeGeneratorTest)})}
  420. }),
  421. smalltalk.CodeGeneratorTest);
  422. smalltalk.addMethod(
  423. "_testifNilIfNotNil",
  424. smalltalk.method({
  425. selector: "testifNilIfNotNil",
  426. fn: function (){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  429. _st(self)._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  430. _st(self)._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  431. _st(self)._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  432. return self}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{}, smalltalk.CodeGeneratorTest)})}
  433. }),
  434. smalltalk.CodeGeneratorTest);
  435. smalltalk.addMethod(
  436. "_testifNotNil",
  437. smalltalk.method({
  438. selector: "testifNotNil",
  439. fn: function (){
  440. var self=this;
  441. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  442. _st(self)._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  443. _st(self)._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  444. _st(self)._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  445. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{}, smalltalk.CodeGeneratorTest)})}
  446. }),
  447. smalltalk.CodeGeneratorTest);
  448. smalltalk.addMethod(
  449. "_testifTrue",
  450. smalltalk.method({
  451. selector: "testifTrue",
  452. fn: function (){
  453. var self=this;
  454. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  455. _st(self)._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  456. _st(self)._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  457. _st(self)._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  458. return self}, function($ctx1) {$ctx1.fill(self,"testifTrue",{}, smalltalk.CodeGeneratorTest)})}
  459. }),
  460. smalltalk.CodeGeneratorTest);
  461. smalltalk.addMethod(
  462. "_testifTrueIfFalse",
  463. smalltalk.method({
  464. selector: "testifTrueIfFalse",
  465. fn: function (){
  466. var self=this;
  467. return smalltalk.withContext(function($ctx1) { _st(self)._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  468. _st(self)._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  469. _st(self)._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  470. _st(self)._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  471. return self}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{}, smalltalk.CodeGeneratorTest)})}
  472. }),
  473. smalltalk.CodeGeneratorTest);
  474. smalltalk.addClass('InliningCodeGeneratorTest', smalltalk.CodeGeneratorTest, [], 'Compiler-Tests');
  475. smalltalk.addMethod(
  476. "_codeGeneratorClass",
  477. smalltalk.method({
  478. selector: "codeGeneratorClass",
  479. fn: function (){
  480. var self=this;
  481. return smalltalk.withContext(function($ctx1) { var $1;
  482. $1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
  483. return $1;
  484. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{}, smalltalk.InliningCodeGeneratorTest)})}
  485. }),
  486. smalltalk.InliningCodeGeneratorTest);
  487. smalltalk.addClass('ScopeVarTest', smalltalk.TestCase, [], 'Compiler-Tests');
  488. smalltalk.addMethod(
  489. "_testClassRefVar",
  490. smalltalk.method({
  491. selector: "testClassRefVar",
  492. fn: function (){
  493. var self=this;
  494. var node;
  495. return smalltalk.withContext(function($ctx1) { var $1,$2;
  496. $1=_st((smalltalk.ClassReferenceNode || ClassReferenceNode))._new();
  497. _st($1)._value_("Object");
  498. $2=_st($1)._yourself();
  499. node=$2;
  500. _st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._new())._visit_(node);
  501. _st(self)._assert_(_st(_st(node)._binding())._isClassRefVar());
  502. return self}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node}, smalltalk.ScopeVarTest)})}
  503. }),
  504. smalltalk.ScopeVarTest);
  505. smalltalk.addMethod(
  506. "_testInstanceVar",
  507. smalltalk.method({
  508. selector: "testInstanceVar",
  509. fn: function (){
  510. var self=this;
  511. var node,scope;
  512. return smalltalk.withContext(function($ctx1) { var $1,$2;
  513. $1=_st((smalltalk.VariableNode || VariableNode))._new();
  514. _st($1)._value_("bzzz");
  515. $2=_st($1)._yourself();
  516. node=$2;
  517. scope=_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new();
  518. _st(scope)._addIVar_("bzzz");
  519. _st(self)._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
  520. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope}, smalltalk.ScopeVarTest)})}
  521. }),
  522. smalltalk.ScopeVarTest);
  523. smalltalk.addMethod(
  524. "_testPseudoVar",
  525. smalltalk.method({
  526. selector: "testPseudoVar",
  527. fn: function (){
  528. var self=this;
  529. var node,pseudoVars;
  530. return smalltalk.withContext(function($ctx1) { var $1,$2;
  531. pseudoVars=["self", "super", "true", "false", "nil"];
  532. _st(pseudoVars)._do_((function(each){
  533. return smalltalk.withContext(function($ctx2) { $1=_st((smalltalk.VariableNode || VariableNode))._new();
  534. _st($1)._value_(each);
  535. $2=_st($1)._yourself();
  536. node=$2;
  537. node;
  538. return _st(self)._assert_(_st(_st(_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new())._bindingFor_(node))._isPseudoVar());
  539. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  540. return self}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars}, smalltalk.ScopeVarTest)})}
  541. }),
  542. smalltalk.ScopeVarTest);
  543. smalltalk.addMethod(
  544. "_testTempVar",
  545. smalltalk.method({
  546. selector: "testTempVar",
  547. fn: function (){
  548. var self=this;
  549. var node,scope;
  550. return smalltalk.withContext(function($ctx1) { var $1,$2;
  551. $1=_st((smalltalk.VariableNode || VariableNode))._new();
  552. _st($1)._value_("bzzz");
  553. $2=_st($1)._yourself();
  554. node=$2;
  555. scope=_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new();
  556. _st(scope)._addTemp_("bzzz");
  557. _st(self)._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
  558. return self}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope}, smalltalk.ScopeVarTest)})}
  559. }),
  560. smalltalk.ScopeVarTest);
  561. smalltalk.addMethod(
  562. "_testUnknownVar",
  563. smalltalk.method({
  564. selector: "testUnknownVar",
  565. fn: function (){
  566. var self=this;
  567. var node;
  568. return smalltalk.withContext(function($ctx1) { var $1,$2;
  569. $1=_st((smalltalk.VariableNode || VariableNode))._new();
  570. _st($1)._value_("bzzz");
  571. $2=_st($1)._yourself();
  572. node=$2;
  573. _st(self)._assert_(_st(_st(_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new())._bindingFor_(node))._isNil());
  574. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node}, smalltalk.ScopeVarTest)})}
  575. }),
  576. smalltalk.ScopeVarTest);
  577. smalltalk.addClass('SemanticAnalyzerTest', smalltalk.TestCase, ['analyzer'], 'Compiler-Tests');
  578. smalltalk.addMethod(
  579. "_setUp",
  580. smalltalk.method({
  581. selector: "setUp",
  582. fn: function (){
  583. var self=this;
  584. return smalltalk.withContext(function($ctx1) { self["@analyzer"]=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_((smalltalk.Object || Object));
  585. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.SemanticAnalyzerTest)})}
  586. }),
  587. smalltalk.SemanticAnalyzerTest);
  588. smalltalk.addMethod(
  589. "_testAssignment",
  590. smalltalk.method({
  591. selector: "testAssignment",
  592. fn: function (){
  593. var self=this;
  594. var src,ast;
  595. return smalltalk.withContext(function($ctx1) { src="foo self := 1";
  596. ast=_st(smalltalk)._parse_(src);
  597. _st(self)._should_raise_((function(){
  598. return smalltalk.withContext(function($ctx2) { return _st(self["@analyzer"])._visit_(ast);
  599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.InvalidAssignmentError || InvalidAssignmentError));
  600. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  601. }),
  602. smalltalk.SemanticAnalyzerTest);
  603. smalltalk.addMethod(
  604. "_testNonLocalReturn",
  605. smalltalk.method({
  606. selector: "testNonLocalReturn",
  607. fn: function (){
  608. var self=this;
  609. var src,ast;
  610. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. ^ a";
  611. ast=_st(smalltalk)._parse_(src);
  612. _st(self["@analyzer"])._visit_(ast);
  613. _st(self)._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
  614. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  615. }),
  616. smalltalk.SemanticAnalyzerTest);
  617. smalltalk.addMethod(
  618. "_testNonLocalReturn2",
  619. smalltalk.method({
  620. selector: "testNonLocalReturn2",
  621. fn: function (){
  622. var self=this;
  623. var src,ast;
  624. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ [ ^ a] ]";
  625. ast=_st(smalltalk)._parse_(src);
  626. _st(self["@analyzer"])._visit_(ast);
  627. _st(self)._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
  628. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  629. }),
  630. smalltalk.SemanticAnalyzerTest);
  631. smalltalk.addMethod(
  632. "_testScope",
  633. smalltalk.method({
  634. selector: "testScope",
  635. fn: function (){
  636. var self=this;
  637. var src,ast;
  638. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ | b | b := a ]";
  639. ast=_st(smalltalk)._parse_(src);
  640. _st(self["@analyzer"])._visit_(ast);
  641. _st(self)._deny_(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()).__eq_eq(_st(ast)._scope()));
  642. return self}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  643. }),
  644. smalltalk.SemanticAnalyzerTest);
  645. smalltalk.addMethod(
  646. "_testScope2",
  647. smalltalk.method({
  648. selector: "testScope2",
  649. fn: function (){
  650. var self=this;
  651. var src,ast;
  652. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ [ | b | b := a ] ]";
  653. ast=_st(smalltalk)._parse_(src);
  654. _st(self["@analyzer"])._visit_(ast);
  655. _st(self)._deny_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope()).__eq_eq(_st(ast)._scope()));
  656. return self}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  657. }),
  658. smalltalk.SemanticAnalyzerTest);
  659. smalltalk.addMethod(
  660. "_testScopeLevel",
  661. smalltalk.method({
  662. selector: "testScopeLevel",
  663. fn: function (){
  664. var self=this;
  665. var src,ast;
  666. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ [ | b | b := a ] ]";
  667. ast=_st(smalltalk)._parse_(src);
  668. _st(self["@analyzer"])._visit_(ast);
  669. _st(self)._assert_(_st(_st(_st(ast)._scope())._scopeLevel()).__eq((1)));
  670. _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope())._scopeLevel()).__eq((3)));
  671. return self}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  672. }),
  673. smalltalk.SemanticAnalyzerTest);
  674. smalltalk.addMethod(
  675. "_testUnknownVariables",
  676. smalltalk.method({
  677. selector: "testUnknownVariables",
  678. fn: function (){
  679. var self=this;
  680. var src,ast;
  681. return smalltalk.withContext(function($ctx1) { src="foo | a | b + a";
  682. ast=_st(smalltalk)._parse_(src);
  683. _st(self)._should_raise_((function(){
  684. return smalltalk.withContext(function($ctx2) { return _st(self["@analyzer"])._visit_(ast);
  685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.UnknownVariableError || UnknownVariableError));
  686. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  687. }),
  688. smalltalk.SemanticAnalyzerTest);
  689. smalltalk.addMethod(
  690. "_testUnknownVariablesWithScope",
  691. smalltalk.method({
  692. selector: "testUnknownVariablesWithScope",
  693. fn: function (){
  694. var self=this;
  695. var src,ast;
  696. return smalltalk.withContext(function($ctx1) { src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  697. ast=_st(smalltalk)._parse_(src);
  698. _st(self)._should_raise_((function(){
  699. return smalltalk.withContext(function($ctx2) { return _st(self["@analyzer"])._visit_(ast);
  700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.UnknownVariableError || UnknownVariableError));
  701. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  702. }),
  703. smalltalk.SemanticAnalyzerTest);
  704. smalltalk.addMethod(
  705. "_testVariableShadowing",
  706. smalltalk.method({
  707. selector: "testVariableShadowing",
  708. fn: function (){
  709. var self=this;
  710. var src,ast;
  711. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1";
  712. ast=_st(smalltalk)._parse_(src);
  713. _st(self["@analyzer"])._visit_(ast);
  714. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  715. }),
  716. smalltalk.SemanticAnalyzerTest);
  717. smalltalk.addMethod(
  718. "_testVariableShadowing2",
  719. smalltalk.method({
  720. selector: "testVariableShadowing2",
  721. fn: function (){
  722. var self=this;
  723. var src,ast;
  724. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ | a | a := 2 ]";
  725. ast=_st(smalltalk)._parse_(src);
  726. _st(self)._should_raise_((function(){
  727. return smalltalk.withContext(function($ctx2) { return _st(self["@analyzer"])._visit_(ast);
  728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.ShadowingVariableError || ShadowingVariableError));
  729. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  730. }),
  731. smalltalk.SemanticAnalyzerTest);
  732. smalltalk.addMethod(
  733. "_testVariableShadowing3",
  734. smalltalk.method({
  735. selector: "testVariableShadowing3",
  736. fn: function (){
  737. var self=this;
  738. var src,ast;
  739. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ | b | b := 2 ]";
  740. ast=_st(smalltalk)._parse_(src);
  741. _st(self["@analyzer"])._visit_(ast);
  742. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  743. }),
  744. smalltalk.SemanticAnalyzerTest);
  745. smalltalk.addMethod(
  746. "_testVariableShadowing4",
  747. smalltalk.method({
  748. selector: "testVariableShadowing4",
  749. fn: function (){
  750. var self=this;
  751. var src,ast;
  752. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  753. ast=_st(smalltalk)._parse_(src);
  754. _st(self["@analyzer"])._visit_(ast);
  755. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  756. }),
  757. smalltalk.SemanticAnalyzerTest);
  758. smalltalk.addMethod(
  759. "_testVariableShadowing5",
  760. smalltalk.method({
  761. selector: "testVariableShadowing5",
  762. fn: function (){
  763. var self=this;
  764. var src,ast;
  765. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  766. ast=_st(smalltalk)._parse_(src);
  767. _st(self)._should_raise_((function(){
  768. return smalltalk.withContext(function($ctx2) { return _st(self["@analyzer"])._visit_(ast);
  769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.ShadowingVariableError || ShadowingVariableError));
  770. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  771. }),
  772. smalltalk.SemanticAnalyzerTest);
  773. smalltalk.addMethod(
  774. "_testVariablesLookup",
  775. smalltalk.method({
  776. selector: "testVariablesLookup",
  777. fn: function (){
  778. var self=this;
  779. var src,ast;
  780. return smalltalk.withContext(function($ctx1) { src="foo | a | a + 1. [ | b | b := a ]";
  781. ast=_st(smalltalk)._parse_(src);
  782. _st(self["@analyzer"])._visit_(ast);
  783. _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._first())._receiver())._binding())._isTempVar());
  784. _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._first())._receiver())._binding())._scope()).__eq_eq(_st(ast)._scope()));
  785. _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._left())._binding())._isTempVar());
  786. _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._left())._binding())._scope()).__eq_eq(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()));
  787. return self}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast}, smalltalk.SemanticAnalyzerTest)})}
  788. }),
  789. smalltalk.SemanticAnalyzerTest);