2
0

Compiler-Tests.deploy.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. smalltalk.addPackage('Compiler-Tests');
  2. smalltalk.addClass('ASTVisitorTest', smalltalk.TestCase, [], 'Compiler-Tests');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "analyze:forClass:",
  6. fn: function (aNode,aClass){
  7. var self=this;
  8. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  9. return smalltalk.withContext(function($ctx1) {
  10. var $1;
  11. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  12. $1=aNode;
  13. return $1;
  14. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},smalltalk.ASTVisitorTest)})},
  15. messageSends: ["visit:", "on:"]}),
  16. smalltalk.ASTVisitorTest);
  17. smalltalk.addMethod(
  18. smalltalk.method({
  19. selector: "parse:",
  20. fn: function (aString){
  21. var self=this;
  22. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23. return smalltalk.withContext(function($ctx1) {
  24. var $1;
  25. $1=_st(_st($Smalltalk())._current())._parse_(aString);
  26. return $1;
  27. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.ASTVisitorTest)})},
  28. messageSends: ["parse:", "current"]}),
  29. smalltalk.ASTVisitorTest);
  30. smalltalk.addMethod(
  31. smalltalk.method({
  32. selector: "parse:forClass:",
  33. fn: function (aString,aClass){
  34. var self=this;
  35. return smalltalk.withContext(function($ctx1) {
  36. var $1;
  37. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  38. return $1;
  39. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},smalltalk.ASTVisitorTest)})},
  40. messageSends: ["analyze:forClass:", "parse:"]}),
  41. smalltalk.ASTVisitorTest);
  42. smalltalk.addClass('ASTPCNodeVisitorTest', smalltalk.ASTVisitorTest, [], 'Compiler-Tests');
  43. smalltalk.addMethod(
  44. smalltalk.method({
  45. selector: "astPCNodeVisitor",
  46. fn: function (){
  47. var self=this;
  48. return smalltalk.withContext(function($ctx1) {
  49. var $1;
  50. $1=self._astPCNodeVisitorForPC_((0));
  51. return $1;
  52. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},smalltalk.ASTPCNodeVisitorTest)})},
  53. messageSends: ["astPCNodeVisitorForPC:"]}),
  54. smalltalk.ASTPCNodeVisitorTest);
  55. smalltalk.addMethod(
  56. smalltalk.method({
  57. selector: "astPCNodeVisitorForPC:",
  58. fn: function (anInteger){
  59. var self=this;
  60. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  61. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  62. return smalltalk.withContext(function($ctx1) {
  63. var $2,$3,$4,$5,$1;
  64. $2=_st($ASTPCNodeVisitor())._new();
  65. _st($2)._pc_((0));
  66. $3=_st($AIContext())._new();
  67. _st($3)._pc_(anInteger);
  68. $4=_st($3)._yourself();
  69. _st($2)._context_($4);
  70. $5=_st($2)._yourself();
  71. $1=$5;
  72. return $1;
  73. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForPC:",{anInteger:anInteger},smalltalk.ASTPCNodeVisitorTest)})},
  74. messageSends: ["pc:", "new", "context:", "yourself"]}),
  75. smalltalk.ASTPCNodeVisitorTest);
  76. smalltalk.addMethod(
  77. smalltalk.method({
  78. selector: "testJSStatementNode",
  79. fn: function (){
  80. var self=this;
  81. var ast,visitor;
  82. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  83. return smalltalk.withContext(function($ctx1) {
  84. var $1,$2;
  85. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  86. $1=self._astPCNodeVisitor();
  87. _st($1)._visit_(ast);
  88. $2=_st($1)._currentNode();
  89. self._assert_(_st($2)._isJSStatementNode());
  90. return self}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},smalltalk.ASTPCNodeVisitorTest)})},
  91. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]}),
  92. smalltalk.ASTPCNodeVisitorTest);
  93. smalltalk.addMethod(
  94. smalltalk.method({
  95. selector: "testMessageSend",
  96. fn: function (){
  97. var self=this;
  98. var ast;
  99. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  100. return smalltalk.withContext(function($ctx1) {
  101. var $1,$2;
  102. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  103. $1=self._astPCNodeVisitorForPC_((2));
  104. _st($1)._visit_(ast);
  105. $2=_st($1)._currentNode();
  106. self._assert_equals_(_st($2)._selector(),"yourself");
  107. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},smalltalk.ASTPCNodeVisitorTest)})},
  108. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForPC:", "currentNode"]}),
  109. smalltalk.ASTPCNodeVisitorTest);
  110. smalltalk.addMethod(
  111. smalltalk.method({
  112. selector: "testMessageSendWithInlining",
  113. fn: function (){
  114. var self=this;
  115. var ast;
  116. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  117. return smalltalk.withContext(function($ctx1) {
  118. var $1,$2,$3,$4;
  119. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  120. $1=self._astPCNodeVisitorForPC_((2));
  121. _st($1)._visit_(ast);
  122. $2=_st($1)._currentNode();
  123. self._assert_equals_(_st($2)._selector(),"yourself");
  124. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  125. $3=self._astPCNodeVisitorForPC_((3));
  126. _st($3)._visit_(ast);
  127. $4=_st($3)._currentNode();
  128. self._assert_equals_(_st($4)._selector(),"asBoolean");
  129. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},smalltalk.ASTPCNodeVisitorTest)})},
  130. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForPC:", "currentNode"]}),
  131. smalltalk.ASTPCNodeVisitorTest);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "testNoMessageSend",
  135. fn: function (){
  136. var self=this;
  137. var ast;
  138. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  139. return smalltalk.withContext(function($ctx1) {
  140. var $1,$2;
  141. ast=self._parse_forClass_("foo ^ self",$Object());
  142. $1=self._astPCNodeVisitor();
  143. _st($1)._visit_(ast);
  144. $2=_st($1)._currentNode();
  145. self._assert_(_st($2)._isNil());
  146. return self}, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},smalltalk.ASTPCNodeVisitorTest)})},
  147. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]}),
  148. smalltalk.ASTPCNodeVisitorTest);
  149. smalltalk.addMethod(
  150. smalltalk.method({
  151. selector: "testPC",
  152. fn: function (){
  153. var self=this;
  154. var ast,visitor;
  155. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  156. return smalltalk.withContext(function($ctx1) {
  157. var $1,$2;
  158. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  159. $1=self._astPCNodeVisitor();
  160. _st($1)._visit_(ast);
  161. $2=_st($1)._currentNode();
  162. self._assert_(_st($2)._isJSStatementNode());
  163. return self}, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},smalltalk.ASTPCNodeVisitorTest)})},
  164. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]}),
  165. smalltalk.ASTPCNodeVisitorTest);
  166. smalltalk.addClass('AbstractASTInterpreterTest', smalltalk.ASTVisitorTest, [], 'Compiler-Tests');
  167. smalltalk.addMethod(
  168. smalltalk.method({
  169. selector: "interpret:",
  170. fn: function (aString){
  171. var self=this;
  172. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  173. return smalltalk.withContext(function($ctx1) {
  174. var $1;
  175. $1=self._interpret_withArguments_(aString,_st($Dictionary())._new());
  176. return $1;
  177. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aString:aString},smalltalk.AbstractASTInterpreterTest)})},
  178. messageSends: ["interpret:withArguments:", "new"]}),
  179. smalltalk.AbstractASTInterpreterTest);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "interpret:receiver:withArguments:",
  183. fn: function (aString,anObject,aDictionary){
  184. var self=this;
  185. var ctx;
  186. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  187. return smalltalk.withContext(function($ctx1) {
  188. var $2,$3,$1;
  189. ctx=_st($AIContext())._new();
  190. _st(ctx)._receiver_(anObject);
  191. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  192. return smalltalk.withContext(function($ctx2) {
  193. return _st(ctx)._localAt_put_(key,value);
  194. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  195. $2=self._interpreter();
  196. _st($2)._context_(ctx);
  197. _st($2)._interpret_(_st(_st(self._parse_forClass_(aString,_st(anObject)._class()))._nodes())._first());
  198. $3=_st($2)._result();
  199. $1=$3;
  200. return $1;
  201. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx},smalltalk.AbstractASTInterpreterTest)})},
  202. messageSends: ["new", "receiver:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "interpret:", "first", "nodes", "parse:forClass:", "class", "result"]}),
  203. smalltalk.AbstractASTInterpreterTest);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "interpret:withArguments:",
  207. fn: function (aString,aDictionary){
  208. var self=this;
  209. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  210. return smalltalk.withContext(function($ctx1) {
  211. var $1;
  212. $1=self._interpret_receiver_withArguments_(aString,_st($Object())._new(),aDictionary);
  213. return $1;
  214. }, function($ctx1) {$ctx1.fill(self,"interpret:withArguments:",{aString:aString,aDictionary:aDictionary},smalltalk.AbstractASTInterpreterTest)})},
  215. messageSends: ["interpret:receiver:withArguments:", "new"]}),
  216. smalltalk.AbstractASTInterpreterTest);
  217. smalltalk.addMethod(
  218. smalltalk.method({
  219. selector: "interpreter",
  220. fn: function (){
  221. var self=this;
  222. return smalltalk.withContext(function($ctx1) {
  223. var $1;
  224. $1=self._subclassResponsibility();
  225. return $1;
  226. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.AbstractASTInterpreterTest)})},
  227. messageSends: ["subclassResponsibility"]}),
  228. smalltalk.AbstractASTInterpreterTest);
  229. smalltalk.addClass('ASTInterpreterTest', smalltalk.AbstractASTInterpreterTest, [], 'Compiler-Tests');
  230. smalltalk.addMethod(
  231. smalltalk.method({
  232. selector: "interpreter",
  233. fn: function (){
  234. var self=this;
  235. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  236. return smalltalk.withContext(function($ctx1) {
  237. var $1;
  238. $1=_st($ASTInterpreter())._new();
  239. return $1;
  240. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTInterpreterTest)})},
  241. messageSends: ["new"]}),
  242. smalltalk.ASTInterpreterTest);
  243. smalltalk.addMethod(
  244. smalltalk.method({
  245. selector: "testBinarySend",
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. self._assert_equals_(self._interpret_("foo 2+3+4"),(9));
  250. return self}, function($ctx1) {$ctx1.fill(self,"testBinarySend",{},smalltalk.ASTInterpreterTest)})},
  251. messageSends: ["assert:equals:", "interpret:"]}),
  252. smalltalk.ASTInterpreterTest);
  253. smalltalk.addMethod(
  254. smalltalk.method({
  255. selector: "testBlockLiteral",
  256. fn: function (){
  257. var self=this;
  258. return smalltalk.withContext(function($ctx1) {
  259. self._assert_equals_(self._interpret_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]"),(1));
  260. self._assert_equals_(self._interpret_("foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]"),(1));
  261. self._assert_equals_(self._interpret_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]"),(2));
  262. return self}, function($ctx1) {$ctx1.fill(self,"testBlockLiteral",{},smalltalk.ASTInterpreterTest)})},
  263. messageSends: ["assert:equals:", "interpret:"]}),
  264. smalltalk.ASTInterpreterTest);
  265. smalltalk.addMethod(
  266. smalltalk.method({
  267. selector: "testCascade",
  268. fn: function (){
  269. var self=this;
  270. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  271. return smalltalk.withContext(function($ctx1) {
  272. self._assert_equals_(self._interpret_("foo ^ OrderedCollection new add: 2; add: 3; yourself"),_st($OrderedCollection())._with_with_((2),(3)));
  273. return self}, function($ctx1) {$ctx1.fill(self,"testCascade",{},smalltalk.ASTInterpreterTest)})},
  274. messageSends: ["assert:equals:", "interpret:", "with:with:"]}),
  275. smalltalk.ASTInterpreterTest);
  276. smalltalk.addMethod(
  277. smalltalk.method({
  278. selector: "testDynamicArray",
  279. fn: function (){
  280. var self=this;
  281. return smalltalk.withContext(function($ctx1) {
  282. self._assert_equals_(self._interpret_("foo ^ {1+1. 2+2}"),[(2), (4)]);
  283. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicArray",{},smalltalk.ASTInterpreterTest)})},
  284. messageSends: ["assert:equals:", "interpret:"]}),
  285. smalltalk.ASTInterpreterTest);
  286. smalltalk.addMethod(
  287. smalltalk.method({
  288. selector: "testDynamicDictionary",
  289. fn: function (){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) {
  292. self._assert_equals_(self._interpret_("foo ^ #{1->1. 2->3}"),smalltalk.HashedCollection._from_([(1).__minus_gt((1)),(2).__minus_gt((3))]));
  293. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionary",{},smalltalk.ASTInterpreterTest)})},
  294. messageSends: ["assert:equals:", "interpret:", "->"]}),
  295. smalltalk.ASTInterpreterTest);
  296. smalltalk.addMethod(
  297. smalltalk.method({
  298. selector: "testInlinedJSStatement",
  299. fn: function (){
  300. var self=this;
  301. return smalltalk.withContext(function($ctx1) {
  302. self._assert_equals_(self._interpret_("foo <return 2+3>"),(5));
  303. self._assert_equals_(self._interpret_withArguments_("foo: anInteger <return 2 + anInteger>",smalltalk.HashedCollection._from_(["anInteger".__minus_gt((3))])),(5));
  304. return self}, function($ctx1) {$ctx1.fill(self,"testInlinedJSStatement",{},smalltalk.ASTInterpreterTest)})},
  305. messageSends: ["assert:equals:", "interpret:", "interpret:withArguments:", "->"]}),
  306. smalltalk.ASTInterpreterTest);
  307. smalltalk.addMethod(
  308. smalltalk.method({
  309. selector: "testInstVarAccess",
  310. fn: function (){
  311. var self=this;
  312. return smalltalk.withContext(function($ctx1) {
  313. self._assert_equals_(self._interpret_receiver_withArguments_("foo ^ x",(2).__at((3)),smalltalk.HashedCollection._from_([])),(2));
  314. return self}, function($ctx1) {$ctx1.fill(self,"testInstVarAccess",{},smalltalk.ASTInterpreterTest)})},
  315. messageSends: ["assert:equals:", "interpret:receiver:withArguments:", "@"]}),
  316. smalltalk.ASTInterpreterTest);
  317. smalltalk.addMethod(
  318. smalltalk.method({
  319. selector: "testInstVarAssignment",
  320. fn: function (){
  321. var self=this;
  322. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  323. return smalltalk.withContext(function($ctx1) {
  324. self._assert_equals_(self._interpret_receiver_withArguments_("foo: anInteger x := anInteger. ^ x",_st($Point())._new(),smalltalk.HashedCollection._from_(["anInteger".__minus_gt((2))])),(2));
  325. return self}, function($ctx1) {$ctx1.fill(self,"testInstVarAssignment",{},smalltalk.ASTInterpreterTest)})},
  326. messageSends: ["assert:equals:", "interpret:receiver:withArguments:", "new", "->"]}),
  327. smalltalk.ASTInterpreterTest);
  328. smalltalk.addMethod(
  329. smalltalk.method({
  330. selector: "testNonlocalReturn",
  331. fn: function (){
  332. var self=this;
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_equals_(self._interpret_("foo true ifTrue: [ ^ 1 ]. ^2"),(1));
  335. return self}, function($ctx1) {$ctx1.fill(self,"testNonlocalReturn",{},smalltalk.ASTInterpreterTest)})},
  336. messageSends: ["assert:equals:", "interpret:"]}),
  337. smalltalk.ASTInterpreterTest);
  338. smalltalk.addMethod(
  339. smalltalk.method({
  340. selector: "testReceiver",
  341. fn: function (){
  342. var self=this;
  343. return smalltalk.withContext(function($ctx1) {
  344. self._assert_equals_(self._interpret_receiver_withArguments_("foo ^ self",(2).__at((3)),smalltalk.HashedCollection._from_([])),(2).__at((3)));
  345. return self}, function($ctx1) {$ctx1.fill(self,"testReceiver",{},smalltalk.ASTInterpreterTest)})},
  346. messageSends: ["assert:equals:", "interpret:receiver:withArguments:", "@"]}),
  347. smalltalk.ASTInterpreterTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testSuper",
  351. fn: function (){
  352. var self=this;
  353. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  354. return smalltalk.withContext(function($ctx1) {
  355. self._assert_equals_(self._interpret_receiver_withArguments_("foo ^ super isBoolean",true,_st($Dictionary())._new()),false);
  356. return self}, function($ctx1) {$ctx1.fill(self,"testSuper",{},smalltalk.ASTInterpreterTest)})},
  357. messageSends: ["assert:equals:", "interpret:receiver:withArguments:", "new"]}),
  358. smalltalk.ASTInterpreterTest);
  359. smalltalk.addMethod(
  360. smalltalk.method({
  361. selector: "testTempAssignment",
  362. fn: function (){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) {
  365. self._assert_equals_(self._interpret_("foo | a | a := 2. ^ a"),(2));
  366. return self}, function($ctx1) {$ctx1.fill(self,"testTempAssignment",{},smalltalk.ASTInterpreterTest)})},
  367. messageSends: ["assert:equals:", "interpret:"]}),
  368. smalltalk.ASTInterpreterTest);
  369. smalltalk.addMethod(
  370. smalltalk.method({
  371. selector: "testThisContext",
  372. fn: function (){
  373. var self=this;
  374. return smalltalk.withContext(function($ctx1) {
  375. self._assert_(_st(_st(self._interpret_("foo ^ thisContext"))._outerContext())._isNil());
  376. self._assert_(_st(_st(self._interpret_("foo ^ [ thisContext ] value"))._outerContext())._notNil());
  377. self._assert_(self._interpret_("foo ^ [ thisContext ] value outerContext == thisContext"));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testThisContext",{},smalltalk.ASTInterpreterTest)})},
  379. messageSends: ["assert:", "isNil", "outerContext", "interpret:", "notNil"]}),
  380. smalltalk.ASTInterpreterTest);
  381. smalltalk.addClass('ASTSteppingInterpreterTest', smalltalk.AbstractASTInterpreterTest, ['interpreter'], 'Compiler-Tests');
  382. smalltalk.addMethod(
  383. smalltalk.method({
  384. selector: "interpreter",
  385. fn: function (){
  386. var self=this;
  387. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  388. return smalltalk.withContext(function($ctx1) {
  389. var $2,$1;
  390. $2=self["@interpreter"];
  391. if(($receiver = $2) == nil || $receiver == undefined){
  392. self["@interpreter"]=_st($ASTSteppingInterpreter())._new();
  393. $1=self["@interpreter"];
  394. } else {
  395. $1=$2;
  396. };
  397. return $1;
  398. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTSteppingInterpreterTest)})},
  399. messageSends: ["ifNil:", "new"]}),
  400. smalltalk.ASTSteppingInterpreterTest);
  401. smalltalk.addMethod(
  402. smalltalk.method({
  403. selector: "testAtEnd",
  404. fn: function (){
  405. var self=this;
  406. return smalltalk.withContext(function($ctx1) {
  407. self._interpret_("foo 1 + 2");
  408. self._deny_(_st(self._interpreter())._atEnd());
  409. _st(self._interpreter())._step();
  410. self._deny_(_st(self._interpreter())._atEnd());
  411. _st(self._interpreter())._step();
  412. self._deny_(_st(self._interpreter())._atEnd());
  413. _st(self._interpreter())._step();
  414. self._deny_(_st(self._interpreter())._atEnd());
  415. _st(self._interpreter())._step();
  416. self._assert_(_st(self._interpreter())._atEnd());
  417. return self}, function($ctx1) {$ctx1.fill(self,"testAtEnd",{},smalltalk.ASTSteppingInterpreterTest)})},
  418. messageSends: ["interpret:", "deny:", "atEnd", "interpreter", "step", "assert:"]}),
  419. smalltalk.ASTSteppingInterpreterTest);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "testMessageSend",
  423. fn: function (){
  424. var self=this;
  425. return smalltalk.withContext(function($ctx1) {
  426. self._interpret_("foo 1 + 2");
  427. _st(self._interpreter())._step();
  428. _st(self._interpreter())._step();
  429. _st(self._interpreter())._step();
  430. self._assert_equals_(_st(_st(self._interpreter())._currentNode())._value(),(1));
  431. _st(self._interpreter())._step();
  432. self._assert_equals_(_st(_st(self._interpreter())._currentNode())._value(),(2));
  433. _st(self._interpreter())._step();
  434. self._assert_equals_(_st(self._interpreter())._result(),(3));
  435. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.ASTSteppingInterpreterTest)})},
  436. messageSends: ["interpret:", "step", "interpreter", "assert:equals:", "value", "currentNode", "result"]}),
  437. smalltalk.ASTSteppingInterpreterTest);
  438. smalltalk.addMethod(
  439. smalltalk.method({
  440. selector: "testSimpleStepping",
  441. fn: function (){
  442. var self=this;
  443. return smalltalk.withContext(function($ctx1) {
  444. self._interpret_("foo 1");
  445. _st(self._interpreter())._step();
  446. self._assert_(_st(_st(self._interpreter())._result())._isNil());
  447. _st(self._interpreter())._step();
  448. self._assert_equals_(_st(self._interpreter())._result(),(1));
  449. return self}, function($ctx1) {$ctx1.fill(self,"testSimpleStepping",{},smalltalk.ASTSteppingInterpreterTest)})},
  450. messageSends: ["interpret:", "step", "interpreter", "assert:", "isNil", "result", "assert:equals:"]}),
  451. smalltalk.ASTSteppingInterpreterTest);
  452. smalltalk.addClass('CodeGeneratorTest', smalltalk.TestCase, ['receiver'], 'Compiler-Tests');
  453. smalltalk.addMethod(
  454. smalltalk.method({
  455. selector: "codeGeneratorClass",
  456. fn: function (){
  457. var self=this;
  458. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  459. return smalltalk.withContext(function($ctx1) {
  460. var $1;
  461. $1=$CodeGenerator();
  462. return $1;
  463. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.CodeGeneratorTest)})},
  464. messageSends: []}),
  465. smalltalk.CodeGeneratorTest);
  466. smalltalk.addMethod(
  467. smalltalk.method({
  468. selector: "compiler",
  469. fn: function (){
  470. var self=this;
  471. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  472. return smalltalk.withContext(function($ctx1) {
  473. var $2,$3,$1;
  474. $2=_st($Compiler())._new();
  475. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  476. $3=_st($2)._yourself();
  477. $1=$3;
  478. return $1;
  479. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.CodeGeneratorTest)})},
  480. messageSends: ["codeGeneratorClass:", "codeGeneratorClass", "new", "yourself"]}),
  481. smalltalk.CodeGeneratorTest);
  482. smalltalk.addMethod(
  483. smalltalk.method({
  484. selector: "setUp",
  485. fn: function (){
  486. var self=this;
  487. return smalltalk.withContext(function($ctx1) {
  488. self["@receiver"]=_st(self._targetClass())._new();
  489. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.CodeGeneratorTest)})},
  490. messageSends: ["new", "targetClass"]}),
  491. smalltalk.CodeGeneratorTest);
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "should:return:",
  495. fn: function (aString,anObject){
  496. var self=this;
  497. var method,result;
  498. return smalltalk.withContext(function($ctx1) {
  499. method=_st(self._compiler())._install_forClass_category_(aString,self._targetClass(),"tests");
  500. result=_st(self["@receiver"])._perform_(_st(method)._selector());
  501. _st(self._targetClass())._removeCompiledMethod_(method);
  502. self._assert_equals_(anObject,result);
  503. return self}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject,method:method,result:result},smalltalk.CodeGeneratorTest)})},
  504. messageSends: ["install:forClass:category:", "targetClass", "compiler", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]}),
  505. smalltalk.CodeGeneratorTest);
  506. smalltalk.addMethod(
  507. smalltalk.method({
  508. selector: "targetClass",
  509. fn: function (){
  510. var self=this;
  511. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  512. return smalltalk.withContext(function($ctx1) {
  513. var $1;
  514. $1=$DoIt();
  515. return $1;
  516. }, function($ctx1) {$ctx1.fill(self,"targetClass",{},smalltalk.CodeGeneratorTest)})},
  517. messageSends: []}),
  518. smalltalk.CodeGeneratorTest);
  519. smalltalk.addMethod(
  520. smalltalk.method({
  521. selector: "tearDown",
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) {
  525. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.CodeGeneratorTest)})},
  526. messageSends: []}),
  527. smalltalk.CodeGeneratorTest);
  528. smalltalk.addMethod(
  529. smalltalk.method({
  530. selector: "testAssignment",
  531. fn: function (){
  532. var self=this;
  533. return smalltalk.withContext(function($ctx1) {
  534. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  535. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  536. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  537. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},smalltalk.CodeGeneratorTest)})},
  538. messageSends: ["should:return:"]}),
  539. smalltalk.CodeGeneratorTest);
  540. smalltalk.addMethod(
  541. smalltalk.method({
  542. selector: "testBackslashSelectors",
  543. fn: function (){
  544. var self=this;
  545. return smalltalk.withContext(function($ctx1) {
  546. self._should_return_("\x5c arg ^ 4",(4));
  547. self._should_return_("\x5c\x5c arg ^ 42",(42));
  548. return self}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},smalltalk.CodeGeneratorTest)})},
  549. messageSends: ["should:return:"]}),
  550. smalltalk.CodeGeneratorTest);
  551. smalltalk.addMethod(
  552. smalltalk.method({
  553. selector: "testBlockReturn",
  554. fn: function (){
  555. var self=this;
  556. return smalltalk.withContext(function($ctx1) {
  557. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  558. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  559. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  560. return self}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},smalltalk.CodeGeneratorTest)})},
  561. messageSends: ["should:return:"]}),
  562. smalltalk.CodeGeneratorTest);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "testCascades",
  566. fn: function (){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) {
  569. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  570. return self}, function($ctx1) {$ctx1.fill(self,"testCascades",{},smalltalk.CodeGeneratorTest)})},
  571. messageSends: ["should:return:"]}),
  572. smalltalk.CodeGeneratorTest);
  573. smalltalk.addMethod(
  574. smalltalk.method({
  575. selector: "testDynamicArrayElementsOrdered",
  576. fn: function (){
  577. var self=this;
  578. return smalltalk.withContext(function($ctx1) {
  579. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  580. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},smalltalk.CodeGeneratorTest)})},
  581. messageSends: ["should:return:"]}),
  582. smalltalk.CodeGeneratorTest);
  583. smalltalk.addMethod(
  584. smalltalk.method({
  585. selector: "testDynamicDictionaryElementsOrdered",
  586. fn: function (){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) {
  589. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'->1.\x0a\x09^ #{ x. (true ifTrue: [ x := 'bar'->2 ]) }\x0a",smalltalk.HashedCollection._from_(["foo".__minus_gt((1)),"bar".__minus_gt((2))]));
  590. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},smalltalk.CodeGeneratorTest)})},
  591. messageSends: ["should:return:", "->"]}),
  592. smalltalk.CodeGeneratorTest);
  593. smalltalk.addMethod(
  594. smalltalk.method({
  595. selector: "testInnerTemporalDependentElementsOrdered",
  596. fn: function (){
  597. var self=this;
  598. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  599. return smalltalk.withContext(function($ctx1) {
  600. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",["foo".__minus_gt($Array()),"bar".__minus_gt((2))]);
  601. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",["foo".__minus_gt((1)),"bar".__minus_gt((2))]);
  602. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",["foo".__minus_gt((1)),"bar".__minus_gt((2))]);
  603. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",smalltalk.HashedCollection._from_(["foo".__minus_gt((1)),"bar".__minus_gt((2))]));
  604. return self}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},smalltalk.CodeGeneratorTest)})},
  605. messageSends: ["should:return:", "->"]}),
  606. smalltalk.CodeGeneratorTest);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "testLiterals",
  610. fn: function (){
  611. var self=this;
  612. return smalltalk.withContext(function($ctx1) {
  613. self._should_return_("foo ^ 1",(1));
  614. self._should_return_("foo ^ 'hello'","hello");
  615. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  616. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  617. self._should_return_("foo ^ true",true);
  618. self._should_return_("foo ^ false",false);
  619. self._should_return_("foo ^ #{1->2. 3->4}",smalltalk.HashedCollection._from_([(1).__minus_gt((2)),(3).__minus_gt((4))]));
  620. self._should_return_("foo ^ #hello","hello");
  621. self._should_return_("foo ^ -123.456",(-123.456));
  622. return self}, function($ctx1) {$ctx1.fill(self,"testLiterals",{},smalltalk.CodeGeneratorTest)})},
  623. messageSends: ["should:return:", "->"]}),
  624. smalltalk.CodeGeneratorTest);
  625. smalltalk.addMethod(
  626. smalltalk.method({
  627. selector: "testLocalReturn",
  628. fn: function (){
  629. var self=this;
  630. return smalltalk.withContext(function($ctx1) {
  631. self._should_return_("foo ^ 1",(1));
  632. self._should_return_("foo ^ 1 + 1",(2));
  633. self._should_return_("foo ",self["@receiver"]);
  634. self._should_return_("foo self asString",self["@receiver"]);
  635. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  636. return self}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},smalltalk.CodeGeneratorTest)})},
  637. messageSends: ["should:return:"]}),
  638. smalltalk.CodeGeneratorTest);
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "testMessageSends",
  642. fn: function (){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. self._should_return_("foo ^ 1 asString","1");
  646. self._should_return_("foo ^ 1 + 1",(2));
  647. self._should_return_("foo ^ 1 + 2 * 3",(9));
  648. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  649. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  650. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},smalltalk.CodeGeneratorTest)})},
  651. messageSends: ["should:return:"]}),
  652. smalltalk.CodeGeneratorTest);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "testMutableLiterals",
  656. fn: function (){
  657. var self=this;
  658. return smalltalk.withContext(function($ctx1) {
  659. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  660. return self}, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},smalltalk.CodeGeneratorTest)})},
  661. messageSends: ["should:return:"]}),
  662. smalltalk.CodeGeneratorTest);
  663. smalltalk.addMethod(
  664. smalltalk.method({
  665. selector: "testNestedIfTrue",
  666. fn: function (){
  667. var self=this;
  668. return smalltalk.withContext(function($ctx1) {
  669. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  670. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  671. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  672. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  673. return self}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},smalltalk.CodeGeneratorTest)})},
  674. messageSends: ["should:return:"]}),
  675. smalltalk.CodeGeneratorTest);
  676. smalltalk.addMethod(
  677. smalltalk.method({
  678. selector: "testNonLocalReturn",
  679. fn: function (){
  680. var self=this;
  681. return smalltalk.withContext(function($ctx1) {
  682. self._should_return_("foo [ ^ 1 ] value",(1));
  683. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  684. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  685. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  686. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},smalltalk.CodeGeneratorTest)})},
  687. messageSends: ["should:return:"]}),
  688. smalltalk.CodeGeneratorTest);
  689. smalltalk.addMethod(
  690. smalltalk.method({
  691. selector: "testPascalCaseGlobal",
  692. fn: function (){
  693. var self=this;
  694. return smalltalk.withContext(function($ctx1) {
  695. self._should_return_("foo ^Object",_st(smalltalk)._at_("Object"));
  696. self._should_return_("foo ^NonExistent",nil);
  697. return self}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},smalltalk.CodeGeneratorTest)})},
  698. messageSends: ["should:return:", "at:"]}),
  699. smalltalk.CodeGeneratorTest);
  700. smalltalk.addMethod(
  701. smalltalk.method({
  702. selector: "testSendReceiverAndArgumentsOrdered",
  703. fn: function (){
  704. var self=this;
  705. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  706. return smalltalk.withContext(function($ctx1) {
  707. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  708. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  709. return self}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},smalltalk.CodeGeneratorTest)})},
  710. messageSends: ["should:return:"]}),
  711. smalltalk.CodeGeneratorTest);
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "testifFalse",
  715. fn: function (){
  716. var self=this;
  717. return smalltalk.withContext(function($ctx1) {
  718. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  719. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  720. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  721. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  722. return self}, function($ctx1) {$ctx1.fill(self,"testifFalse",{},smalltalk.CodeGeneratorTest)})},
  723. messageSends: ["should:return:"]}),
  724. smalltalk.CodeGeneratorTest);
  725. smalltalk.addMethod(
  726. smalltalk.method({
  727. selector: "testifFalseIfTrue",
  728. fn: function (){
  729. var self=this;
  730. return smalltalk.withContext(function($ctx1) {
  731. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  732. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  733. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  734. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  735. return self}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},smalltalk.CodeGeneratorTest)})},
  736. messageSends: ["should:return:"]}),
  737. smalltalk.CodeGeneratorTest);
  738. smalltalk.addMethod(
  739. smalltalk.method({
  740. selector: "testifNil",
  741. fn: function (){
  742. var self=this;
  743. return smalltalk.withContext(function($ctx1) {
  744. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  745. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  746. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  747. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  748. return self}, function($ctx1) {$ctx1.fill(self,"testifNil",{},smalltalk.CodeGeneratorTest)})},
  749. messageSends: ["should:return:"]}),
  750. smalltalk.CodeGeneratorTest);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "testifNilIfNotNil",
  754. fn: function (){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  758. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  759. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  760. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  761. return self}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},smalltalk.CodeGeneratorTest)})},
  762. messageSends: ["should:return:"]}),
  763. smalltalk.CodeGeneratorTest);
  764. smalltalk.addMethod(
  765. smalltalk.method({
  766. selector: "testifNotNil",
  767. fn: function (){
  768. var self=this;
  769. return smalltalk.withContext(function($ctx1) {
  770. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  771. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  772. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  773. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  774. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},smalltalk.CodeGeneratorTest)})},
  775. messageSends: ["should:return:"]}),
  776. smalltalk.CodeGeneratorTest);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "testifNotNilWithArgument",
  780. fn: function (){
  781. var self=this;
  782. return smalltalk.withContext(function($ctx1) {
  783. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  784. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  785. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  786. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  787. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  788. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  789. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},smalltalk.CodeGeneratorTest)})},
  790. messageSends: ["should:return:"]}),
  791. smalltalk.CodeGeneratorTest);
  792. smalltalk.addMethod(
  793. smalltalk.method({
  794. selector: "testifTrue",
  795. fn: function (){
  796. var self=this;
  797. return smalltalk.withContext(function($ctx1) {
  798. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  799. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  800. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  801. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  802. return self}, function($ctx1) {$ctx1.fill(self,"testifTrue",{},smalltalk.CodeGeneratorTest)})},
  803. messageSends: ["should:return:"]}),
  804. smalltalk.CodeGeneratorTest);
  805. smalltalk.addMethod(
  806. smalltalk.method({
  807. selector: "testifTrueIfFalse",
  808. fn: function (){
  809. var self=this;
  810. return smalltalk.withContext(function($ctx1) {
  811. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  812. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  813. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  814. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  815. return self}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},smalltalk.CodeGeneratorTest)})},
  816. messageSends: ["should:return:"]}),
  817. smalltalk.CodeGeneratorTest);
  818. smalltalk.addClass('InliningCodeGeneratorTest', smalltalk.CodeGeneratorTest, [], 'Compiler-Tests');
  819. smalltalk.addMethod(
  820. smalltalk.method({
  821. selector: "codeGeneratorClass",
  822. fn: function (){
  823. var self=this;
  824. function $InliningCodeGenerator(){return smalltalk.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  825. return smalltalk.withContext(function($ctx1) {
  826. var $1;
  827. $1=$InliningCodeGenerator();
  828. return $1;
  829. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.InliningCodeGeneratorTest)})},
  830. messageSends: []}),
  831. smalltalk.InliningCodeGeneratorTest);
  832. smalltalk.addClass('ScopeVarTest', smalltalk.TestCase, [], 'Compiler-Tests');
  833. smalltalk.addMethod(
  834. smalltalk.method({
  835. selector: "testClassRefVar",
  836. fn: function (){
  837. var self=this;
  838. var node;
  839. function $ClassReferenceNode(){return smalltalk.ClassReferenceNode||(typeof ClassReferenceNode=="undefined"?nil:ClassReferenceNode)}
  840. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  841. return smalltalk.withContext(function($ctx1) {
  842. var $1,$2;
  843. $1=_st($ClassReferenceNode())._new();
  844. _st($1)._value_("Object");
  845. $2=_st($1)._yourself();
  846. node=$2;
  847. _st(_st($SemanticAnalyzer())._new())._visit_(node);
  848. self._assert_(_st(_st(node)._binding())._isClassRefVar());
  849. return self}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},smalltalk.ScopeVarTest)})},
  850. messageSends: ["value:", "new", "yourself", "visit:", "assert:", "isClassRefVar", "binding"]}),
  851. smalltalk.ScopeVarTest);
  852. smalltalk.addMethod(
  853. smalltalk.method({
  854. selector: "testInstanceVar",
  855. fn: function (){
  856. var self=this;
  857. var node,scope;
  858. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  859. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  860. return smalltalk.withContext(function($ctx1) {
  861. var $1,$2;
  862. $1=_st($VariableNode())._new();
  863. _st($1)._value_("bzzz");
  864. $2=_st($1)._yourself();
  865. node=$2;
  866. scope=_st($MethodLexicalScope())._new();
  867. _st(scope)._addIVar_("bzzz");
  868. self._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
  869. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},smalltalk.ScopeVarTest)})},
  870. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]}),
  871. smalltalk.ScopeVarTest);
  872. smalltalk.addMethod(
  873. smalltalk.method({
  874. selector: "testPseudoVar",
  875. fn: function (){
  876. var self=this;
  877. var node,pseudoVars;
  878. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  879. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  880. return smalltalk.withContext(function($ctx1) {
  881. var $1,$2;
  882. pseudoVars=["self", "super", "true", "false", "nil"];
  883. _st(pseudoVars)._do_((function(each){
  884. return smalltalk.withContext(function($ctx2) {
  885. $1=_st($VariableNode())._new();
  886. _st($1)._value_(each);
  887. $2=_st($1)._yourself();
  888. node=$2;
  889. node;
  890. return self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  892. return self}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},smalltalk.ScopeVarTest)})},
  893. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]}),
  894. smalltalk.ScopeVarTest);
  895. smalltalk.addMethod(
  896. smalltalk.method({
  897. selector: "testTempVar",
  898. fn: function (){
  899. var self=this;
  900. var node,scope;
  901. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  902. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  903. return smalltalk.withContext(function($ctx1) {
  904. var $1,$2;
  905. $1=_st($VariableNode())._new();
  906. _st($1)._value_("bzzz");
  907. $2=_st($1)._yourself();
  908. node=$2;
  909. scope=_st($MethodLexicalScope())._new();
  910. _st(scope)._addTemp_("bzzz");
  911. self._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
  912. return self}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},smalltalk.ScopeVarTest)})},
  913. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]}),
  914. smalltalk.ScopeVarTest);
  915. smalltalk.addMethod(
  916. smalltalk.method({
  917. selector: "testUnknownVar",
  918. fn: function (){
  919. var self=this;
  920. var node;
  921. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  922. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  923. return smalltalk.withContext(function($ctx1) {
  924. var $1,$2;
  925. $1=_st($VariableNode())._new();
  926. _st($1)._value_("bzzz");
  927. $2=_st($1)._yourself();
  928. node=$2;
  929. self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  930. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},smalltalk.ScopeVarTest)})},
  931. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]}),
  932. smalltalk.ScopeVarTest);
  933. smalltalk.addClass('SemanticAnalyzerTest', smalltalk.TestCase, ['analyzer'], 'Compiler-Tests');
  934. smalltalk.addMethod(
  935. smalltalk.method({
  936. selector: "setUp",
  937. fn: function (){
  938. var self=this;
  939. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  940. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  941. return smalltalk.withContext(function($ctx1) {
  942. self["@analyzer"]=_st($SemanticAnalyzer())._on_($Object());
  943. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.SemanticAnalyzerTest)})},
  944. messageSends: ["on:"]}),
  945. smalltalk.SemanticAnalyzerTest);
  946. smalltalk.addMethod(
  947. smalltalk.method({
  948. selector: "testAssignment",
  949. fn: function (){
  950. var self=this;
  951. var src,ast;
  952. function $InvalidAssignmentError(){return smalltalk.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  953. return smalltalk.withContext(function($ctx1) {
  954. src="foo self := 1";
  955. ast=_st(smalltalk)._parse_(src);
  956. self._should_raise_((function(){
  957. return smalltalk.withContext(function($ctx2) {
  958. return _st(self["@analyzer"])._visit_(ast);
  959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$InvalidAssignmentError());
  960. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  961. messageSends: ["parse:", "should:raise:", "visit:"]}),
  962. smalltalk.SemanticAnalyzerTest);
  963. smalltalk.addMethod(
  964. smalltalk.method({
  965. selector: "testNonLocalReturn",
  966. fn: function (){
  967. var self=this;
  968. var src,ast;
  969. return smalltalk.withContext(function($ctx1) {
  970. src="foo | a | a + 1. ^ a";
  971. ast=_st(smalltalk)._parse_(src);
  972. _st(self["@analyzer"])._visit_(ast);
  973. self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
  974. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  975. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]}),
  976. smalltalk.SemanticAnalyzerTest);
  977. smalltalk.addMethod(
  978. smalltalk.method({
  979. selector: "testNonLocalReturn2",
  980. fn: function (){
  981. var self=this;
  982. var src,ast;
  983. return smalltalk.withContext(function($ctx1) {
  984. src="foo | a | a + 1. [ [ ^ a] ]";
  985. ast=_st(smalltalk)._parse_(src);
  986. _st(self["@analyzer"])._visit_(ast);
  987. self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
  988. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  989. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]}),
  990. smalltalk.SemanticAnalyzerTest);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "testScope",
  994. fn: function (){
  995. var self=this;
  996. var src,ast;
  997. return smalltalk.withContext(function($ctx1) {
  998. src="foo | a | a + 1. [ | b | b := a ]";
  999. ast=_st(smalltalk)._parse_(src);
  1000. _st(self["@analyzer"])._visit_(ast);
  1001. self._deny_(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()).__eq_eq(_st(ast)._scope()));
  1002. return self}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1003. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]}),
  1004. smalltalk.SemanticAnalyzerTest);
  1005. smalltalk.addMethod(
  1006. smalltalk.method({
  1007. selector: "testScope2",
  1008. fn: function (){
  1009. var self=this;
  1010. var src,ast;
  1011. return smalltalk.withContext(function($ctx1) {
  1012. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  1013. ast=_st(smalltalk)._parse_(src);
  1014. _st(self["@analyzer"])._visit_(ast);
  1015. 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()));
  1016. return self}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1017. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]}),
  1018. smalltalk.SemanticAnalyzerTest);
  1019. smalltalk.addMethod(
  1020. smalltalk.method({
  1021. selector: "testScopeLevel",
  1022. fn: function (){
  1023. var self=this;
  1024. var src,ast;
  1025. return smalltalk.withContext(function($ctx1) {
  1026. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  1027. ast=_st(smalltalk)._parse_(src);
  1028. _st(self["@analyzer"])._visit_(ast);
  1029. self._assert_equals_(_st(_st(ast)._scope())._scopeLevel(),(1));
  1030. self._assert_equals_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope())._scopeLevel(),(3));
  1031. return self}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1032. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]}),
  1033. smalltalk.SemanticAnalyzerTest);
  1034. smalltalk.addMethod(
  1035. smalltalk.method({
  1036. selector: "testUnknownVariables",
  1037. fn: function (){
  1038. var self=this;
  1039. var src,ast;
  1040. function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  1041. return smalltalk.withContext(function($ctx1) {
  1042. src="foo | a | b + a";
  1043. ast=_st(smalltalk)._parse_(src);
  1044. self._should_raise_((function(){
  1045. return smalltalk.withContext(function($ctx2) {
  1046. return _st(self["@analyzer"])._visit_(ast);
  1047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$UnknownVariableError());
  1048. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1049. messageSends: ["parse:", "should:raise:", "visit:"]}),
  1050. smalltalk.SemanticAnalyzerTest);
  1051. smalltalk.addMethod(
  1052. smalltalk.method({
  1053. selector: "testUnknownVariablesWithScope",
  1054. fn: function (){
  1055. var self=this;
  1056. var src,ast;
  1057. function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  1058. return smalltalk.withContext(function($ctx1) {
  1059. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  1060. ast=_st(smalltalk)._parse_(src);
  1061. self._should_raise_((function(){
  1062. return smalltalk.withContext(function($ctx2) {
  1063. return _st(self["@analyzer"])._visit_(ast);
  1064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$UnknownVariableError());
  1065. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1066. messageSends: ["parse:", "should:raise:", "visit:"]}),
  1067. smalltalk.SemanticAnalyzerTest);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "testVariableShadowing",
  1071. fn: function (){
  1072. var self=this;
  1073. var src,ast;
  1074. return smalltalk.withContext(function($ctx1) {
  1075. src="foo | a | a + 1";
  1076. ast=_st(smalltalk)._parse_(src);
  1077. _st(self["@analyzer"])._visit_(ast);
  1078. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1079. messageSends: ["parse:", "visit:"]}),
  1080. smalltalk.SemanticAnalyzerTest);
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "testVariableShadowing2",
  1084. fn: function (){
  1085. var self=this;
  1086. var src,ast;
  1087. function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  1088. return smalltalk.withContext(function($ctx1) {
  1089. src="foo | a | a + 1. [ | a | a := 2 ]";
  1090. ast=_st(smalltalk)._parse_(src);
  1091. self._should_raise_((function(){
  1092. return smalltalk.withContext(function($ctx2) {
  1093. return _st(self["@analyzer"])._visit_(ast);
  1094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$ShadowingVariableError());
  1095. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1096. messageSends: ["parse:", "should:raise:", "visit:"]}),
  1097. smalltalk.SemanticAnalyzerTest);
  1098. smalltalk.addMethod(
  1099. smalltalk.method({
  1100. selector: "testVariableShadowing3",
  1101. fn: function (){
  1102. var self=this;
  1103. var src,ast;
  1104. return smalltalk.withContext(function($ctx1) {
  1105. src="foo | a | a + 1. [ | b | b := 2 ]";
  1106. ast=_st(smalltalk)._parse_(src);
  1107. _st(self["@analyzer"])._visit_(ast);
  1108. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1109. messageSends: ["parse:", "visit:"]}),
  1110. smalltalk.SemanticAnalyzerTest);
  1111. smalltalk.addMethod(
  1112. smalltalk.method({
  1113. selector: "testVariableShadowing4",
  1114. fn: function (){
  1115. var self=this;
  1116. var src,ast;
  1117. return smalltalk.withContext(function($ctx1) {
  1118. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  1119. ast=_st(smalltalk)._parse_(src);
  1120. _st(self["@analyzer"])._visit_(ast);
  1121. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1122. messageSends: ["parse:", "visit:"]}),
  1123. smalltalk.SemanticAnalyzerTest);
  1124. smalltalk.addMethod(
  1125. smalltalk.method({
  1126. selector: "testVariableShadowing5",
  1127. fn: function (){
  1128. var self=this;
  1129. var src,ast;
  1130. function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  1131. return smalltalk.withContext(function($ctx1) {
  1132. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  1133. ast=_st(smalltalk)._parse_(src);
  1134. self._should_raise_((function(){
  1135. return smalltalk.withContext(function($ctx2) {
  1136. return _st(self["@analyzer"])._visit_(ast);
  1137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$ShadowingVariableError());
  1138. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1139. messageSends: ["parse:", "should:raise:", "visit:"]}),
  1140. smalltalk.SemanticAnalyzerTest);
  1141. smalltalk.addMethod(
  1142. smalltalk.method({
  1143. selector: "testVariablesLookup",
  1144. fn: function (){
  1145. var self=this;
  1146. var src,ast;
  1147. return smalltalk.withContext(function($ctx1) {
  1148. src="foo | a | a + 1. [ | b | b := a ]";
  1149. ast=_st(smalltalk)._parse_(src);
  1150. _st(self["@analyzer"])._visit_(ast);
  1151. self._assert_(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._first())._receiver())._binding())._isTempVar());
  1152. self._assert_(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._first())._receiver())._binding())._scope()).__eq_eq(_st(ast)._scope()));
  1153. 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());
  1154. 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()));
  1155. return self}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
  1156. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]}),
  1157. smalltalk.SemanticAnalyzerTest);