Compiler-Tests.js 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860
  1. define("amber_core/Compiler-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Compiler-Tests');
  3. smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('ASTParsingTest', globals.TestCase, [], 'Compiler-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "analyze:forClass:",
  8. protocol: 'convenience',
  9. fn: function (aNode,aClass){
  10. var self=this;
  11. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  12. return smalltalk.withContext(function($ctx1) {
  13. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  14. return aNode;
  15. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTParsingTest)})},
  16. args: ["aNode", "aClass"],
  17. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  18. messageSends: ["visit:", "on:"],
  19. referencedClasses: ["SemanticAnalyzer"]
  20. }),
  21. globals.ASTParsingTest);
  22. smalltalk.addMethod(
  23. smalltalk.method({
  24. selector: "parse:",
  25. protocol: 'parsing',
  26. fn: function (aString){
  27. var self=this;
  28. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29. return smalltalk.withContext(function($ctx1) {
  30. var $1;
  31. $1=_st($Smalltalk())._parse_(aString);
  32. return $1;
  33. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTParsingTest)})},
  34. args: ["aString"],
  35. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36. messageSends: ["parse:"],
  37. referencedClasses: ["Smalltalk"]
  38. }),
  39. globals.ASTParsingTest);
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "parse:forClass:",
  43. protocol: 'parsing',
  44. fn: function (aString,aClass){
  45. var self=this;
  46. return smalltalk.withContext(function($ctx1) {
  47. var $1;
  48. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  49. return $1;
  50. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTParsingTest)})},
  51. args: ["aString", "aClass"],
  52. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  53. messageSends: ["analyze:forClass:", "parse:"],
  54. referencedClasses: []
  55. }),
  56. globals.ASTParsingTest);
  57. smalltalk.addClass('ASTPCNodeVisitorTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  58. smalltalk.addMethod(
  59. smalltalk.method({
  60. selector: "astPCNodeVisitor",
  61. protocol: 'factory',
  62. fn: function (){
  63. var self=this;
  64. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  65. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  66. return smalltalk.withContext(function($ctx1) {
  67. var $2,$3,$4,$5,$1;
  68. $2=_st($ASTPCNodeVisitor())._new();
  69. $ctx1.sendIdx["new"]=1;
  70. $3=$2;
  71. $4=_st(_st($AIContext())._new())._yourself();
  72. $ctx1.sendIdx["yourself"]=1;
  73. _st($3)._context_($4);
  74. $5=_st($2)._yourself();
  75. $1=$5;
  76. return $1;
  77. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},globals.ASTPCNodeVisitorTest)})},
  78. args: [],
  79. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  80. messageSends: ["context:", "new", "yourself"],
  81. referencedClasses: ["ASTPCNodeVisitor", "AIContext"]
  82. }),
  83. globals.ASTPCNodeVisitorTest);
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "astPCNodeVisitorForSelector:",
  87. protocol: 'factory',
  88. fn: function (aString){
  89. var self=this;
  90. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  91. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  92. return smalltalk.withContext(function($ctx1) {
  93. var $2,$3,$4,$5,$1;
  94. $2=_st($ASTPCNodeVisitor())._new();
  95. $ctx1.sendIdx["new"]=1;
  96. _st($2)._selector_(aString);
  97. $3=$2;
  98. $4=_st(_st($AIContext())._new())._yourself();
  99. $ctx1.sendIdx["yourself"]=1;
  100. _st($3)._context_($4);
  101. $5=_st($2)._yourself();
  102. $1=$5;
  103. return $1;
  104. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},globals.ASTPCNodeVisitorTest)})},
  105. args: ["aString"],
  106. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  107. messageSends: ["selector:", "new", "context:", "yourself"],
  108. referencedClasses: ["ASTPCNodeVisitor", "AIContext"]
  109. }),
  110. globals.ASTPCNodeVisitorTest);
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testJSStatementNode",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. var ast,visitor;
  118. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  119. return smalltalk.withContext(function($ctx1) {
  120. var $1,$2;
  121. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  122. $1=self._astPCNodeVisitor();
  123. _st($1)._visit_(ast);
  124. $2=_st($1)._currentNode();
  125. self._assert_(_st($2)._isJSStatementNode());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)})},
  127. args: [],
  128. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  129. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"],
  130. referencedClasses: ["Object"]
  131. }),
  132. globals.ASTPCNodeVisitorTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testMessageSend",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. var ast;
  140. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  141. return smalltalk.withContext(function($ctx1) {
  142. var $1,$2;
  143. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  144. $1=self._astPCNodeVisitorForSelector_("yourself");
  145. _st($1)._visit_(ast);
  146. $2=_st($1)._currentNode();
  147. self._assert_equals_(_st($2)._selector(),"yourself");
  148. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  149. args: [],
  150. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  151. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
  152. referencedClasses: ["Object"]
  153. }),
  154. globals.ASTPCNodeVisitorTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testMessageSendWithBlocks",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. var ast;
  162. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  163. return smalltalk.withContext(function($ctx1) {
  164. var $1,$2;
  165. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  166. $1=self._astPCNodeVisitorForSelector_("yourself");
  167. _st($1)._visit_(ast);
  168. $2=_st($1)._currentNode();
  169. self._assert_equals_(_st($2)._selector(),"yourself");
  170. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  171. args: [],
  172. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  173. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
  174. referencedClasses: ["Object"]
  175. }),
  176. globals.ASTPCNodeVisitorTest);
  177. smalltalk.addMethod(
  178. smalltalk.method({
  179. selector: "testMessageSendWithInlining",
  180. protocol: 'tests',
  181. fn: function (){
  182. var self=this;
  183. var ast;
  184. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  185. return smalltalk.withContext(function($ctx1) {
  186. var $3,$4,$2,$1,$5,$6;
  187. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  188. $ctx1.sendIdx["parse:forClass:"]=1;
  189. $3=self._astPCNodeVisitorForSelector_("yourself");
  190. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  191. _st($3)._visit_(ast);
  192. $ctx1.sendIdx["visit:"]=1;
  193. $4=_st($3)._currentNode();
  194. $ctx1.sendIdx["currentNode"]=1;
  195. $2=$4;
  196. $1=_st($2)._selector();
  197. $ctx1.sendIdx["selector"]=1;
  198. self._assert_equals_($1,"yourself");
  199. $ctx1.sendIdx["assert:equals:"]=1;
  200. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  201. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  202. _st($5)._visit_(ast);
  203. $6=_st($5)._currentNode();
  204. self._assert_equals_(_st($6)._selector(),"asBoolean");
  205. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  206. args: [],
  207. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  208. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
  209. referencedClasses: ["Object"]
  210. }),
  211. globals.ASTPCNodeVisitorTest);
  212. smalltalk.addMethod(
  213. smalltalk.method({
  214. selector: "testNoMessageSend",
  215. protocol: 'tests',
  216. fn: function (){
  217. var self=this;
  218. var ast;
  219. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  220. return smalltalk.withContext(function($ctx1) {
  221. var $1,$2;
  222. ast=self._parse_forClass_("foo ^ self",$Object());
  223. $1=self._astPCNodeVisitor();
  224. _st($1)._visit_(ast);
  225. $2=_st($1)._currentNode();
  226. self._assert_(_st($2)._isNil());
  227. return self}, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  228. args: [],
  229. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  230. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"],
  231. referencedClasses: ["Object"]
  232. }),
  233. globals.ASTPCNodeVisitorTest);
  234. smalltalk.addMethod(
  235. smalltalk.method({
  236. selector: "testPC",
  237. protocol: 'tests',
  238. fn: function (){
  239. var self=this;
  240. var ast,visitor;
  241. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  242. return smalltalk.withContext(function($ctx1) {
  243. var $1,$2;
  244. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  245. $1=self._astPCNodeVisitor();
  246. _st($1)._visit_(ast);
  247. $2=_st($1)._currentNode();
  248. self._assert_(_st($2)._isJSStatementNode());
  249. return self}, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)})},
  250. args: [],
  251. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  252. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"],
  253. referencedClasses: ["Object"]
  254. }),
  255. globals.ASTPCNodeVisitorTest);
  256. smalltalk.addClass('ASTPositionTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  257. smalltalk.addMethod(
  258. smalltalk.method({
  259. selector: "testNodeAtPosition",
  260. protocol: 'tests',
  261. fn: function (){
  262. var self=this;
  263. var node;
  264. return smalltalk.withContext(function($ctx1) {
  265. var $3,$4,$2,$1,$7,$8,$6,$5;
  266. node=self._parse_("yourself\x0a\x09^ self");
  267. $ctx1.sendIdx["parse:"]=1;
  268. $3=node;
  269. $4=(2).__at((4));
  270. $ctx1.sendIdx["@"]=1;
  271. $2=_st($3)._navigationNodeAt_ifAbsent_($4,(function(){
  272. return nil;
  273. }));
  274. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  275. $1=_st($2)._source();
  276. self._assert_equals_($1,"self");
  277. $ctx1.sendIdx["assert:equals:"]=1;
  278. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  279. $ctx1.sendIdx["parse:"]=2;
  280. $7=node;
  281. $8=(2).__at((7));
  282. $ctx1.sendIdx["@"]=2;
  283. $6=_st($7)._navigationNodeAt_ifAbsent_($8,(function(){
  284. return nil;
  285. }));
  286. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  287. $5=_st($6)._selector();
  288. $ctx1.sendIdx["selector"]=1;
  289. self._assert_equals_($5,"ifTrue:");
  290. $ctx1.sendIdx["assert:equals:"]=2;
  291. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  292. self._assert_equals_(_st(_st(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  293. return nil;
  294. })))._selector(),"foo");
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},globals.ASTPositionTest)})},
  296. args: [],
  297. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  298. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"],
  299. referencedClasses: []
  300. }),
  301. globals.ASTPositionTest);
  302. smalltalk.addClass('CodeGeneratorTest', globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  303. smalltalk.addMethod(
  304. smalltalk.method({
  305. selector: "codeGeneratorClass",
  306. protocol: 'accessing',
  307. fn: function (){
  308. var self=this;
  309. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  310. return $CodeGenerator();
  311. },
  312. args: [],
  313. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  314. messageSends: [],
  315. referencedClasses: ["CodeGenerator"]
  316. }),
  317. globals.CodeGeneratorTest);
  318. smalltalk.addMethod(
  319. smalltalk.method({
  320. selector: "compiler",
  321. protocol: 'factory',
  322. fn: function (){
  323. var self=this;
  324. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  325. return smalltalk.withContext(function($ctx1) {
  326. var $2,$3,$1;
  327. $2=_st($Compiler())._new();
  328. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  329. $3=_st($2)._yourself();
  330. $1=$3;
  331. return $1;
  332. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.CodeGeneratorTest)})},
  333. args: [],
  334. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  335. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  336. referencedClasses: ["Compiler"]
  337. }),
  338. globals.CodeGeneratorTest);
  339. smalltalk.addMethod(
  340. smalltalk.method({
  341. selector: "setUp",
  342. protocol: 'initialization',
  343. fn: function (){
  344. var self=this;
  345. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  346. return smalltalk.withContext(function($ctx1) {
  347. self["@receiver"]=_st($DoIt())._new();
  348. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.CodeGeneratorTest)})},
  349. args: [],
  350. source: "setUp\x0a\x09receiver := DoIt new",
  351. messageSends: ["new"],
  352. referencedClasses: ["DoIt"]
  353. }),
  354. globals.CodeGeneratorTest);
  355. smalltalk.addMethod(
  356. smalltalk.method({
  357. selector: "should:receiver:return:",
  358. protocol: 'testing',
  359. fn: function (aString,anObject,aResult){
  360. var self=this;
  361. var method,result;
  362. return smalltalk.withContext(function($ctx1) {
  363. var $1,$2;
  364. self["@receiver"]=anObject;
  365. $1=self._compiler();
  366. $2=_st(anObject)._class();
  367. $ctx1.sendIdx["class"]=1;
  368. method=_st($1)._install_forClass_protocol_(aString,$2,"tests");
  369. result=_st(self["@receiver"])._perform_(_st(method)._selector());
  370. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  371. self._assert_equals_(aResult,result);
  372. return self}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},globals.CodeGeneratorTest)})},
  373. args: ["aString", "anObject", "aResult"],
  374. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  375. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"],
  376. referencedClasses: []
  377. }),
  378. globals.CodeGeneratorTest);
  379. smalltalk.addMethod(
  380. smalltalk.method({
  381. selector: "should:return:",
  382. protocol: 'testing',
  383. fn: function (aString,anObject){
  384. var self=this;
  385. return smalltalk.withContext(function($ctx1) {
  386. var $1;
  387. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  388. return $1;
  389. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.CodeGeneratorTest)})},
  390. args: ["aString", "anObject"],
  391. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  392. messageSends: ["should:receiver:return:"],
  393. referencedClasses: []
  394. }),
  395. globals.CodeGeneratorTest);
  396. smalltalk.addMethod(
  397. smalltalk.method({
  398. selector: "tearDown",
  399. protocol: 'initialization',
  400. fn: function (){
  401. var self=this;
  402. return self},
  403. args: [],
  404. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  405. messageSends: [],
  406. referencedClasses: []
  407. }),
  408. globals.CodeGeneratorTest);
  409. smalltalk.addMethod(
  410. smalltalk.method({
  411. selector: "testAssignment",
  412. protocol: 'tests',
  413. fn: function (){
  414. var self=this;
  415. return smalltalk.withContext(function($ctx1) {
  416. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  417. $ctx1.sendIdx["should:return:"]=1;
  418. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  419. $ctx1.sendIdx["should:return:"]=2;
  420. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  421. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},globals.CodeGeneratorTest)})},
  422. args: [],
  423. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  424. messageSends: ["should:return:"],
  425. referencedClasses: []
  426. }),
  427. globals.CodeGeneratorTest);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testBackslashSelectors",
  431. protocol: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. self._should_return_("\x5c arg ^ 4",(4));
  436. $ctx1.sendIdx["should:return:"]=1;
  437. self._should_return_("\x5c\x5c arg ^ 42",(42));
  438. return self}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},globals.CodeGeneratorTest)})},
  439. args: [],
  440. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  441. messageSends: ["should:return:"],
  442. referencedClasses: []
  443. }),
  444. globals.CodeGeneratorTest);
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "testBlockReturn",
  448. protocol: 'tests',
  449. fn: function (){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) {
  452. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  453. $ctx1.sendIdx["should:return:"]=1;
  454. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  455. $ctx1.sendIdx["should:return:"]=2;
  456. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  457. return self}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},globals.CodeGeneratorTest)})},
  458. args: [],
  459. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  460. messageSends: ["should:return:"],
  461. referencedClasses: []
  462. }),
  463. globals.CodeGeneratorTest);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "testCascades",
  467. protocol: 'tests',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) {
  471. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  472. return self}, function($ctx1) {$ctx1.fill(self,"testCascades",{},globals.CodeGeneratorTest)})},
  473. args: [],
  474. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  475. messageSends: ["should:return:"],
  476. referencedClasses: []
  477. }),
  478. globals.CodeGeneratorTest);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "testCascadesWithInlining",
  482. protocol: 'tests',
  483. fn: function (){
  484. var self=this;
  485. return smalltalk.withContext(function($ctx1) {
  486. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  487. $ctx1.sendIdx["should:return:"]=1;
  488. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  489. return self}, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},globals.CodeGeneratorTest)})},
  490. args: [],
  491. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  492. messageSends: ["should:return:"],
  493. referencedClasses: []
  494. }),
  495. globals.CodeGeneratorTest);
  496. smalltalk.addMethod(
  497. smalltalk.method({
  498. selector: "testDynamicArrayElementsOrdered",
  499. protocol: 'tests',
  500. fn: function (){
  501. var self=this;
  502. return smalltalk.withContext(function($ctx1) {
  503. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  504. $ctx1.sendIdx["should:return:"]=1;
  505. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  506. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},globals.CodeGeneratorTest)})},
  507. args: [],
  508. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  509. messageSends: ["should:return:"],
  510. referencedClasses: []
  511. }),
  512. globals.CodeGeneratorTest);
  513. smalltalk.addMethod(
  514. smalltalk.method({
  515. selector: "testDynamicDictionaryElementsOrdered",
  516. protocol: 'tests',
  517. fn: function (){
  518. var self=this;
  519. return smalltalk.withContext(function($ctx1) {
  520. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  521. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},globals.CodeGeneratorTest)})},
  522. args: [],
  523. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  524. messageSends: ["should:return:"],
  525. referencedClasses: []
  526. }),
  527. globals.CodeGeneratorTest);
  528. smalltalk.addMethod(
  529. smalltalk.method({
  530. selector: "testDynamicDictionaryWithMoreArrows",
  531. protocol: 'tests',
  532. fn: function (){
  533. var self=this;
  534. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  535. return smalltalk.withContext(function($ctx1) {
  536. var $2,$1;
  537. $2=_st((1).__minus_gt((2))).__minus_gt((3));
  538. $ctx1.sendIdx["->"]=1;
  539. $1=_st($HashedCollection())._with_($2);
  540. self._should_return_("foo ^ #{1->2->3}",$1);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},globals.CodeGeneratorTest)})},
  542. args: [],
  543. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  544. messageSends: ["should:return:", "with:", "->"],
  545. referencedClasses: ["HashedCollection"]
  546. }),
  547. globals.CodeGeneratorTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testGlobalVar",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. function $BlockClosure(){return globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  555. return smalltalk.withContext(function($ctx1) {
  556. self._should_return_("foo ^ eval class",$BlockClosure());
  557. $ctx1.sendIdx["should:return:"]=1;
  558. self._should_return_("foo ^ Math cos: 0",(1));
  559. $ctx1.sendIdx["should:return:"]=2;
  560. self._should_return_("foo ^ NonExistingVar",nil);
  561. return self}, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},globals.CodeGeneratorTest)})},
  562. args: [],
  563. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  564. messageSends: ["should:return:"],
  565. referencedClasses: ["BlockClosure"]
  566. }),
  567. globals.CodeGeneratorTest);
  568. smalltalk.addMethod(
  569. smalltalk.method({
  570. selector: "testInnerTemporalDependentElementsOrdered",
  571. protocol: 'tests',
  572. fn: function (){
  573. var self=this;
  574. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  575. return smalltalk.withContext(function($ctx1) {
  576. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  577. $2="foo".__minus_gt($Array());
  578. $ctx1.sendIdx["->"]=1;
  579. $3="bar".__minus_gt((2));
  580. $ctx1.sendIdx["->"]=2;
  581. $1=[$2,$3];
  582. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  583. $ctx1.sendIdx["should:return:"]=1;
  584. $5="foo".__minus_gt($Array());
  585. $ctx1.sendIdx["->"]=3;
  586. $6="bar".__minus_gt((2));
  587. $ctx1.sendIdx["->"]=4;
  588. $4=[$5,$6];
  589. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  590. $ctx1.sendIdx["should:return:"]=2;
  591. $8="foo".__minus_gt((1));
  592. $ctx1.sendIdx["->"]=5;
  593. $9="bar".__minus_gt((2));
  594. $ctx1.sendIdx["->"]=6;
  595. $7=[$8,$9];
  596. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  597. $ctx1.sendIdx["should:return:"]=3;
  598. $11="foo".__minus_gt((1));
  599. $ctx1.sendIdx["->"]=7;
  600. $10=[$11,"bar".__minus_gt((2))];
  601. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  602. $ctx1.sendIdx["should:return:"]=4;
  603. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  604. return self}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},globals.CodeGeneratorTest)})},
  605. args: [],
  606. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  607. messageSends: ["should:return:", "->"],
  608. referencedClasses: ["Array"]
  609. }),
  610. globals.CodeGeneratorTest);
  611. smalltalk.addMethod(
  612. smalltalk.method({
  613. selector: "testJSStatement",
  614. protocol: 'tests',
  615. fn: function (){
  616. var self=this;
  617. return smalltalk.withContext(function($ctx1) {
  618. self._should_return_("foo <return 2+3>",(5));
  619. return self}, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},globals.CodeGeneratorTest)})},
  620. args: [],
  621. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  622. messageSends: ["should:return:"],
  623. referencedClasses: []
  624. }),
  625. globals.CodeGeneratorTest);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "testLiterals",
  629. protocol: 'tests',
  630. fn: function (){
  631. var self=this;
  632. return smalltalk.withContext(function($ctx1) {
  633. self._should_return_("foo ^ 1",(1));
  634. $ctx1.sendIdx["should:return:"]=1;
  635. self._should_return_("foo ^ 'hello'","hello");
  636. $ctx1.sendIdx["should:return:"]=2;
  637. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  638. $ctx1.sendIdx["should:return:"]=3;
  639. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  640. $ctx1.sendIdx["should:return:"]=4;
  641. self._should_return_("foo ^ true",true);
  642. $ctx1.sendIdx["should:return:"]=5;
  643. self._should_return_("foo ^ false",false);
  644. $ctx1.sendIdx["should:return:"]=6;
  645. self._should_return_("foo ^ #{1->2. 3->4}",globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  646. $ctx1.sendIdx["should:return:"]=7;
  647. self._should_return_("foo ^ #hello","hello");
  648. $ctx1.sendIdx["should:return:"]=8;
  649. self._should_return_("foo ^ -123.456",(-123.456));
  650. $ctx1.sendIdx["should:return:"]=9;
  651. self._should_return_("foo ^ -2.5e4",(-25000));
  652. return self}, function($ctx1) {$ctx1.fill(self,"testLiterals",{},globals.CodeGeneratorTest)})},
  653. args: [],
  654. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  655. messageSends: ["should:return:"],
  656. referencedClasses: []
  657. }),
  658. globals.CodeGeneratorTest);
  659. smalltalk.addMethod(
  660. smalltalk.method({
  661. selector: "testLocalReturn",
  662. protocol: 'tests',
  663. fn: function (){
  664. var self=this;
  665. return smalltalk.withContext(function($ctx1) {
  666. self._should_return_("foo ^ 1",(1));
  667. $ctx1.sendIdx["should:return:"]=1;
  668. self._should_return_("foo ^ 1 + 1",(2));
  669. $ctx1.sendIdx["should:return:"]=2;
  670. self._should_return_("foo ",self["@receiver"]);
  671. $ctx1.sendIdx["should:return:"]=3;
  672. self._should_return_("foo self asString",self["@receiver"]);
  673. $ctx1.sendIdx["should:return:"]=4;
  674. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  675. return self}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},globals.CodeGeneratorTest)})},
  676. args: [],
  677. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  678. messageSends: ["should:return:"],
  679. referencedClasses: []
  680. }),
  681. globals.CodeGeneratorTest);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "testMessageSends",
  685. protocol: 'tests',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. self._should_return_("foo ^ 1 asString","1");
  690. $ctx1.sendIdx["should:return:"]=1;
  691. self._should_return_("foo ^ 1 + 1",(2));
  692. $ctx1.sendIdx["should:return:"]=2;
  693. self._should_return_("foo ^ 1 + 2 * 3",(9));
  694. $ctx1.sendIdx["should:return:"]=3;
  695. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  696. $ctx1.sendIdx["should:return:"]=4;
  697. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  698. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},globals.CodeGeneratorTest)})},
  699. args: [],
  700. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  701. messageSends: ["should:return:"],
  702. referencedClasses: []
  703. }),
  704. globals.CodeGeneratorTest);
  705. smalltalk.addMethod(
  706. smalltalk.method({
  707. selector: "testMultipleSequences",
  708. protocol: 'tests',
  709. fn: function (){
  710. var self=this;
  711. return smalltalk.withContext(function($ctx1) {
  712. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  713. return self}, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},globals.CodeGeneratorTest)})},
  714. args: [],
  715. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  716. messageSends: ["should:return:"],
  717. referencedClasses: []
  718. }),
  719. globals.CodeGeneratorTest);
  720. smalltalk.addMethod(
  721. smalltalk.method({
  722. selector: "testMutableLiterals",
  723. protocol: 'tests',
  724. fn: function (){
  725. var self=this;
  726. return smalltalk.withContext(function($ctx1) {
  727. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  728. return self}, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},globals.CodeGeneratorTest)})},
  729. args: [],
  730. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  731. messageSends: ["should:return:"],
  732. referencedClasses: []
  733. }),
  734. globals.CodeGeneratorTest);
  735. smalltalk.addMethod(
  736. smalltalk.method({
  737. selector: "testNestedIfTrue",
  738. protocol: 'tests',
  739. fn: function (){
  740. var self=this;
  741. return smalltalk.withContext(function($ctx1) {
  742. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  743. $ctx1.sendIdx["should:return:"]=1;
  744. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  745. $ctx1.sendIdx["should:return:"]=2;
  746. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  747. $ctx1.sendIdx["should:return:"]=3;
  748. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  749. return self}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},globals.CodeGeneratorTest)})},
  750. args: [],
  751. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  752. messageSends: ["should:return:"],
  753. referencedClasses: []
  754. }),
  755. globals.CodeGeneratorTest);
  756. smalltalk.addMethod(
  757. smalltalk.method({
  758. selector: "testNestedSends",
  759. protocol: 'tests',
  760. fn: function (){
  761. var self=this;
  762. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  763. return smalltalk.withContext(function($ctx1) {
  764. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",_st(_st($Point())._x_y_((2).__at((3)),(4)))._asString());
  765. return self}, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},globals.CodeGeneratorTest)})},
  766. args: [],
  767. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  768. messageSends: ["should:return:", "asString", "x:y:", "@"],
  769. referencedClasses: ["Point"]
  770. }),
  771. globals.CodeGeneratorTest);
  772. smalltalk.addMethod(
  773. smalltalk.method({
  774. selector: "testNonLocalReturn",
  775. protocol: 'tests',
  776. fn: function (){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. self._should_return_("foo [ ^ 1 ] value",(1));
  780. $ctx1.sendIdx["should:return:"]=1;
  781. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  782. $ctx1.sendIdx["should:return:"]=2;
  783. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  784. $ctx1.sendIdx["should:return:"]=3;
  785. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  786. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},globals.CodeGeneratorTest)})},
  787. args: [],
  788. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  789. messageSends: ["should:return:"],
  790. referencedClasses: []
  791. }),
  792. globals.CodeGeneratorTest);
  793. smalltalk.addMethod(
  794. smalltalk.method({
  795. selector: "testPascalCaseGlobal",
  796. protocol: 'tests',
  797. fn: function (){
  798. var self=this;
  799. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  800. return smalltalk.withContext(function($ctx1) {
  801. self._should_return_("foo ^Object",_st(_st($Smalltalk())._globals())._at_("Object"));
  802. $ctx1.sendIdx["should:return:"]=1;
  803. self._should_return_("foo ^NonExistent",nil);
  804. return self}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},globals.CodeGeneratorTest)})},
  805. args: [],
  806. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  807. messageSends: ["should:return:", "at:", "globals"],
  808. referencedClasses: ["Smalltalk"]
  809. }),
  810. globals.CodeGeneratorTest);
  811. smalltalk.addMethod(
  812. smalltalk.method({
  813. selector: "testSendReceiverAndArgumentsOrdered",
  814. protocol: 'tests',
  815. fn: function (){
  816. var self=this;
  817. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  818. return smalltalk.withContext(function($ctx1) {
  819. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  820. $ctx1.sendIdx["should:return:"]=1;
  821. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  822. return self}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},globals.CodeGeneratorTest)})},
  823. args: [],
  824. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  825. messageSends: ["should:return:"],
  826. referencedClasses: ["Array"]
  827. }),
  828. globals.CodeGeneratorTest);
  829. smalltalk.addMethod(
  830. smalltalk.method({
  831. selector: "testSuperSend",
  832. protocol: 'tests',
  833. fn: function (){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) {
  836. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  837. return self}, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},globals.CodeGeneratorTest)})},
  838. args: [],
  839. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  840. messageSends: ["should:receiver:return:"],
  841. referencedClasses: []
  842. }),
  843. globals.CodeGeneratorTest);
  844. smalltalk.addMethod(
  845. smalltalk.method({
  846. selector: "testTempVariables",
  847. protocol: 'tests',
  848. fn: function (){
  849. var self=this;
  850. return smalltalk.withContext(function($ctx1) {
  851. self._should_return_("foo | a | ^ a",nil);
  852. $ctx1.sendIdx["should:return:"]=1;
  853. self._should_return_("foo | AVariable | ^ AVariable",nil);
  854. $ctx1.sendIdx["should:return:"]=2;
  855. self._should_return_("foo | a b c | ^ c",nil);
  856. $ctx1.sendIdx["should:return:"]=3;
  857. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  858. $ctx1.sendIdx["should:return:"]=4;
  859. self._should_return_("foo | a | a:= 1. ^ a",(1));
  860. $ctx1.sendIdx["should:return:"]=5;
  861. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  862. return self}, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},globals.CodeGeneratorTest)})},
  863. args: [],
  864. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  865. messageSends: ["should:return:"],
  866. referencedClasses: []
  867. }),
  868. globals.CodeGeneratorTest);
  869. smalltalk.addMethod(
  870. smalltalk.method({
  871. selector: "testThisContext",
  872. protocol: 'tests',
  873. fn: function (){
  874. var self=this;
  875. return smalltalk.withContext(function($ctx1) {
  876. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  877. return self}, function($ctx1) {$ctx1.fill(self,"testThisContext",{},globals.CodeGeneratorTest)})},
  878. args: [],
  879. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  880. messageSends: ["should:return:"],
  881. referencedClasses: []
  882. }),
  883. globals.CodeGeneratorTest);
  884. smalltalk.addMethod(
  885. smalltalk.method({
  886. selector: "testifFalse",
  887. protocol: 'tests',
  888. fn: function (){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) {
  891. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  892. $ctx1.sendIdx["should:return:"]=1;
  893. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  894. $ctx1.sendIdx["should:return:"]=2;
  895. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  896. $ctx1.sendIdx["should:return:"]=3;
  897. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  898. return self}, function($ctx1) {$ctx1.fill(self,"testifFalse",{},globals.CodeGeneratorTest)})},
  899. args: [],
  900. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  901. messageSends: ["should:return:"],
  902. referencedClasses: []
  903. }),
  904. globals.CodeGeneratorTest);
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "testifFalseIfTrue",
  908. protocol: 'tests',
  909. fn: function (){
  910. var self=this;
  911. return smalltalk.withContext(function($ctx1) {
  912. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  913. $ctx1.sendIdx["should:return:"]=1;
  914. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  915. $ctx1.sendIdx["should:return:"]=2;
  916. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  917. $ctx1.sendIdx["should:return:"]=3;
  918. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  919. return self}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},globals.CodeGeneratorTest)})},
  920. args: [],
  921. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  922. messageSends: ["should:return:"],
  923. referencedClasses: []
  924. }),
  925. globals.CodeGeneratorTest);
  926. smalltalk.addMethod(
  927. smalltalk.method({
  928. selector: "testifNil",
  929. protocol: 'tests',
  930. fn: function (){
  931. var self=this;
  932. return smalltalk.withContext(function($ctx1) {
  933. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  934. $ctx1.sendIdx["should:return:"]=1;
  935. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  936. $ctx1.sendIdx["should:return:"]=2;
  937. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  938. $ctx1.sendIdx["should:return:"]=3;
  939. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  940. return self}, function($ctx1) {$ctx1.fill(self,"testifNil",{},globals.CodeGeneratorTest)})},
  941. args: [],
  942. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  943. messageSends: ["should:return:"],
  944. referencedClasses: []
  945. }),
  946. globals.CodeGeneratorTest);
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "testifNilIfNotNil",
  950. protocol: 'tests',
  951. fn: function (){
  952. var self=this;
  953. return smalltalk.withContext(function($ctx1) {
  954. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  955. $ctx1.sendIdx["should:return:"]=1;
  956. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  957. $ctx1.sendIdx["should:return:"]=2;
  958. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  959. $ctx1.sendIdx["should:return:"]=3;
  960. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  961. return self}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},globals.CodeGeneratorTest)})},
  962. args: [],
  963. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  964. messageSends: ["should:return:"],
  965. referencedClasses: []
  966. }),
  967. globals.CodeGeneratorTest);
  968. smalltalk.addMethod(
  969. smalltalk.method({
  970. selector: "testifNotNil",
  971. protocol: 'tests',
  972. fn: function (){
  973. var self=this;
  974. return smalltalk.withContext(function($ctx1) {
  975. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  976. $ctx1.sendIdx["should:return:"]=1;
  977. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  978. $ctx1.sendIdx["should:return:"]=2;
  979. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  980. $ctx1.sendIdx["should:return:"]=3;
  981. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  982. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},globals.CodeGeneratorTest)})},
  983. args: [],
  984. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  985. messageSends: ["should:return:"],
  986. referencedClasses: []
  987. }),
  988. globals.CodeGeneratorTest);
  989. smalltalk.addMethod(
  990. smalltalk.method({
  991. selector: "testifNotNilWithArgument",
  992. protocol: 'tests',
  993. fn: function (){
  994. var self=this;
  995. return smalltalk.withContext(function($ctx1) {
  996. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  997. $ctx1.sendIdx["should:return:"]=1;
  998. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  999. $ctx1.sendIdx["should:return:"]=2;
  1000. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  1001. $ctx1.sendIdx["should:return:"]=3;
  1002. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  1003. $ctx1.sendIdx["should:return:"]=4;
  1004. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  1005. $ctx1.sendIdx["should:return:"]=5;
  1006. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  1007. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},globals.CodeGeneratorTest)})},
  1008. args: [],
  1009. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  1010. messageSends: ["should:return:"],
  1011. referencedClasses: []
  1012. }),
  1013. globals.CodeGeneratorTest);
  1014. smalltalk.addMethod(
  1015. smalltalk.method({
  1016. selector: "testifTrue",
  1017. protocol: 'tests',
  1018. fn: function (){
  1019. var self=this;
  1020. return smalltalk.withContext(function($ctx1) {
  1021. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  1022. $ctx1.sendIdx["should:return:"]=1;
  1023. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  1024. $ctx1.sendIdx["should:return:"]=2;
  1025. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  1026. $ctx1.sendIdx["should:return:"]=3;
  1027. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  1028. return self}, function($ctx1) {$ctx1.fill(self,"testifTrue",{},globals.CodeGeneratorTest)})},
  1029. args: [],
  1030. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  1031. messageSends: ["should:return:"],
  1032. referencedClasses: []
  1033. }),
  1034. globals.CodeGeneratorTest);
  1035. smalltalk.addMethod(
  1036. smalltalk.method({
  1037. selector: "testifTrueIfFalse",
  1038. protocol: 'tests',
  1039. fn: function (){
  1040. var self=this;
  1041. return smalltalk.withContext(function($ctx1) {
  1042. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  1043. $ctx1.sendIdx["should:return:"]=1;
  1044. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  1045. $ctx1.sendIdx["should:return:"]=2;
  1046. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  1047. $ctx1.sendIdx["should:return:"]=3;
  1048. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  1049. return self}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},globals.CodeGeneratorTest)})},
  1050. args: [],
  1051. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  1052. messageSends: ["should:return:"],
  1053. referencedClasses: []
  1054. }),
  1055. globals.CodeGeneratorTest);
  1056. smalltalk.addClass('InliningCodeGeneratorTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  1057. smalltalk.addMethod(
  1058. smalltalk.method({
  1059. selector: "codeGeneratorClass",
  1060. protocol: 'accessing',
  1061. fn: function (){
  1062. var self=this;
  1063. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  1064. return $InliningCodeGenerator();
  1065. },
  1066. args: [],
  1067. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  1068. messageSends: [],
  1069. referencedClasses: ["InliningCodeGenerator"]
  1070. }),
  1071. globals.InliningCodeGeneratorTest);
  1072. smalltalk.addClass('InterpreterTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  1073. smalltalk.addMethod(
  1074. smalltalk.method({
  1075. selector: "analyze:forClass:",
  1076. protocol: 'parsing',
  1077. fn: function (aNode,aClass){
  1078. var self=this;
  1079. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  1080. return smalltalk.withContext(function($ctx1) {
  1081. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  1082. return aNode;
  1083. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.InterpreterTest)})},
  1084. args: ["aNode", "aClass"],
  1085. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  1086. messageSends: ["visit:", "on:"],
  1087. referencedClasses: ["SemanticAnalyzer"]
  1088. }),
  1089. globals.InterpreterTest);
  1090. smalltalk.addMethod(
  1091. smalltalk.method({
  1092. selector: "interpret:receiver:withArguments:",
  1093. protocol: 'private',
  1094. fn: function (aString,anObject,aDictionary){
  1095. var self=this;
  1096. var ctx,interpreter;
  1097. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  1098. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  1099. return smalltalk.withContext(function($ctx1) {
  1100. var $1,$2,$4,$5,$3;
  1101. interpreter=_st($ASTInterpreter())._new();
  1102. $ctx1.sendIdx["new"]=1;
  1103. $1=_st($AIContext())._new();
  1104. _st($1)._receiver_(anObject);
  1105. _st($1)._interpreter_(interpreter);
  1106. $2=_st($1)._yourself();
  1107. ctx=$2;
  1108. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  1109. return smalltalk.withContext(function($ctx2) {
  1110. return _st(ctx)._localAt_put_(key,value);
  1111. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1112. $4=interpreter;
  1113. _st($4)._context_(ctx);
  1114. _st($4)._interpret_(_st(self._parse_forClass_(aString,_st(anObject)._class()))._nextChild());
  1115. _st($4)._proceed();
  1116. $5=_st($4)._result();
  1117. $3=$5;
  1118. return $3;
  1119. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,interpreter:interpreter},globals.InterpreterTest)})},
  1120. args: ["aString", "anObject", "aDictionary"],
  1121. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: (self parse: aString forClass: anObject class) nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  1122. messageSends: ["new", "receiver:", "interpreter:", "yourself", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "parse:forClass:", "class", "proceed", "result"],
  1123. referencedClasses: ["ASTInterpreter", "AIContext"]
  1124. }),
  1125. globals.InterpreterTest);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "parse:",
  1129. protocol: 'parsing',
  1130. fn: function (aString){
  1131. var self=this;
  1132. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1133. return smalltalk.withContext(function($ctx1) {
  1134. var $1;
  1135. $1=_st($Smalltalk())._parse_(aString);
  1136. return $1;
  1137. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.InterpreterTest)})},
  1138. args: ["aString"],
  1139. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  1140. messageSends: ["parse:"],
  1141. referencedClasses: ["Smalltalk"]
  1142. }),
  1143. globals.InterpreterTest);
  1144. smalltalk.addMethod(
  1145. smalltalk.method({
  1146. selector: "parse:forClass:",
  1147. protocol: 'parsing',
  1148. fn: function (aString,aClass){
  1149. var self=this;
  1150. return smalltalk.withContext(function($ctx1) {
  1151. var $1;
  1152. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  1153. return $1;
  1154. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.InterpreterTest)})},
  1155. args: ["aString", "aClass"],
  1156. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  1157. messageSends: ["analyze:forClass:", "parse:"],
  1158. referencedClasses: []
  1159. }),
  1160. globals.InterpreterTest);
  1161. smalltalk.addMethod(
  1162. smalltalk.method({
  1163. selector: "should:receiver:return:",
  1164. protocol: 'testing',
  1165. fn: function (aString,anObject,aResult){
  1166. var self=this;
  1167. return smalltalk.withContext(function($ctx1) {
  1168. var $1;
  1169. self["@receiver"]=anObject;
  1170. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],globals.HashedCollection._newFromPairs_([])),aResult);
  1171. return $1;
  1172. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},globals.InterpreterTest)})},
  1173. args: ["aString", "anObject", "aResult"],
  1174. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  1175. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"],
  1176. referencedClasses: []
  1177. }),
  1178. globals.InterpreterTest);
  1179. smalltalk.addMethod(
  1180. smalltalk.method({
  1181. selector: "should:return:",
  1182. protocol: 'testing',
  1183. fn: function (aString,anObject){
  1184. var self=this;
  1185. return smalltalk.withContext(function($ctx1) {
  1186. var $1;
  1187. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  1188. return $1;
  1189. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.InterpreterTest)})},
  1190. args: ["aString", "anObject"],
  1191. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  1192. messageSends: ["should:receiver:return:"],
  1193. referencedClasses: []
  1194. }),
  1195. globals.InterpreterTest);
  1196. smalltalk.addClass('ScopeVarTest', globals.TestCase, [], 'Compiler-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "testClassRefVar",
  1200. protocol: 'tests',
  1201. fn: function (){
  1202. var self=this;
  1203. var node;
  1204. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  1205. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  1206. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $1,$2,$3,$4;
  1209. $1=_st($VariableNode())._new();
  1210. $ctx1.sendIdx["new"]=1;
  1211. _st($1)._value_("Object");
  1212. $2=_st($1)._yourself();
  1213. node=$2;
  1214. $3=_st($SemanticAnalyzer())._new();
  1215. $ctx1.sendIdx["new"]=2;
  1216. _st($3)._pushScope_(_st($MethodLexicalScope())._new());
  1217. $4=_st($3)._visit_(node);
  1218. self._assert_(_st(_st(node)._binding())._isClassRefVar());
  1219. return self}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},globals.ScopeVarTest)})},
  1220. args: [],
  1221. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  1222. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"],
  1223. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"]
  1224. }),
  1225. globals.ScopeVarTest);
  1226. smalltalk.addMethod(
  1227. smalltalk.method({
  1228. selector: "testInstanceVar",
  1229. protocol: 'tests',
  1230. fn: function (){
  1231. var self=this;
  1232. var node,scope;
  1233. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  1234. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1235. return smalltalk.withContext(function($ctx1) {
  1236. var $1,$2;
  1237. $1=_st($VariableNode())._new();
  1238. $ctx1.sendIdx["new"]=1;
  1239. _st($1)._value_("bzzz");
  1240. $2=_st($1)._yourself();
  1241. node=$2;
  1242. scope=_st($MethodLexicalScope())._new();
  1243. _st(scope)._addIVar_("bzzz");
  1244. self._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
  1245. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},globals.ScopeVarTest)})},
  1246. args: [],
  1247. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  1248. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"],
  1249. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  1250. }),
  1251. globals.ScopeVarTest);
  1252. smalltalk.addMethod(
  1253. smalltalk.method({
  1254. selector: "testPseudoVar",
  1255. protocol: 'tests',
  1256. fn: function (){
  1257. var self=this;
  1258. var node,pseudoVars;
  1259. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  1260. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $1,$2;
  1263. pseudoVars=["self", "super", "true", "false", "nil"];
  1264. _st(pseudoVars)._do_((function(each){
  1265. return smalltalk.withContext(function($ctx2) {
  1266. $1=_st($VariableNode())._new();
  1267. $ctx2.sendIdx["new"]=1;
  1268. _st($1)._value_(each);
  1269. $2=_st($1)._yourself();
  1270. node=$2;
  1271. node;
  1272. return self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  1273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1274. return self}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},globals.ScopeVarTest)})},
  1275. args: [],
  1276. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]",
  1277. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"],
  1278. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  1279. }),
  1280. globals.ScopeVarTest);
  1281. smalltalk.addMethod(
  1282. smalltalk.method({
  1283. selector: "testTempVar",
  1284. protocol: 'tests',
  1285. fn: function (){
  1286. var self=this;
  1287. var node,scope;
  1288. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  1289. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1290. return smalltalk.withContext(function($ctx1) {
  1291. var $1,$2;
  1292. $1=_st($VariableNode())._new();
  1293. $ctx1.sendIdx["new"]=1;
  1294. _st($1)._value_("bzzz");
  1295. $2=_st($1)._yourself();
  1296. node=$2;
  1297. scope=_st($MethodLexicalScope())._new();
  1298. _st(scope)._addTemp_("bzzz");
  1299. self._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
  1300. return self}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},globals.ScopeVarTest)})},
  1301. args: [],
  1302. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  1303. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"],
  1304. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  1305. }),
  1306. globals.ScopeVarTest);
  1307. smalltalk.addMethod(
  1308. smalltalk.method({
  1309. selector: "testUnknownVar",
  1310. protocol: 'tests',
  1311. fn: function (){
  1312. var self=this;
  1313. var node;
  1314. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  1315. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1316. return smalltalk.withContext(function($ctx1) {
  1317. var $1,$2;
  1318. $1=_st($VariableNode())._new();
  1319. $ctx1.sendIdx["new"]=1;
  1320. _st($1)._value_("bzzz");
  1321. $2=_st($1)._yourself();
  1322. node=$2;
  1323. self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  1324. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},globals.ScopeVarTest)})},
  1325. args: [],
  1326. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  1327. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"],
  1328. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  1329. }),
  1330. globals.ScopeVarTest);
  1331. smalltalk.addClass('SemanticAnalyzerTest', globals.TestCase, ['analyzer'], 'Compiler-Tests');
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "setUp",
  1335. protocol: 'running',
  1336. fn: function (){
  1337. var self=this;
  1338. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  1339. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1340. return smalltalk.withContext(function($ctx1) {
  1341. self["@analyzer"]=_st($SemanticAnalyzer())._on_($Object());
  1342. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.SemanticAnalyzerTest)})},
  1343. args: [],
  1344. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  1345. messageSends: ["on:"],
  1346. referencedClasses: ["SemanticAnalyzer", "Object"]
  1347. }),
  1348. globals.SemanticAnalyzerTest);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "testAssignment",
  1352. protocol: 'tests',
  1353. fn: function (){
  1354. var self=this;
  1355. var src,ast;
  1356. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1357. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  1358. return smalltalk.withContext(function($ctx1) {
  1359. src="foo self := 1";
  1360. ast=_st($Smalltalk())._parse_(src);
  1361. self._should_raise_((function(){
  1362. return smalltalk.withContext(function($ctx2) {
  1363. return _st(self["@analyzer"])._visit_(ast);
  1364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$InvalidAssignmentError());
  1365. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1366. args: [],
  1367. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  1368. messageSends: ["parse:", "should:raise:", "visit:"],
  1369. referencedClasses: ["Smalltalk", "InvalidAssignmentError"]
  1370. }),
  1371. globals.SemanticAnalyzerTest);
  1372. smalltalk.addMethod(
  1373. smalltalk.method({
  1374. selector: "testNonLocalReturn",
  1375. protocol: 'tests',
  1376. fn: function (){
  1377. var self=this;
  1378. var src,ast;
  1379. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1380. return smalltalk.withContext(function($ctx1) {
  1381. src="foo | a | a + 1. ^ a";
  1382. ast=_st($Smalltalk())._parse_(src);
  1383. _st(self["@analyzer"])._visit_(ast);
  1384. self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
  1385. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1386. args: [],
  1387. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  1388. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"],
  1389. referencedClasses: ["Smalltalk"]
  1390. }),
  1391. globals.SemanticAnalyzerTest);
  1392. smalltalk.addMethod(
  1393. smalltalk.method({
  1394. selector: "testNonLocalReturn2",
  1395. protocol: 'tests',
  1396. fn: function (){
  1397. var self=this;
  1398. var src,ast;
  1399. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1400. return smalltalk.withContext(function($ctx1) {
  1401. src="foo | a | a + 1. [ [ ^ a] ]";
  1402. ast=_st($Smalltalk())._parse_(src);
  1403. _st(self["@analyzer"])._visit_(ast);
  1404. self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
  1405. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1406. args: [],
  1407. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  1408. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"],
  1409. referencedClasses: ["Smalltalk"]
  1410. }),
  1411. globals.SemanticAnalyzerTest);
  1412. smalltalk.addMethod(
  1413. smalltalk.method({
  1414. selector: "testScope",
  1415. protocol: 'tests',
  1416. fn: function (){
  1417. var self=this;
  1418. var src,ast;
  1419. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1420. return smalltalk.withContext(function($ctx1) {
  1421. var $4,$3,$2,$1;
  1422. src="foo | a | a + 1. [ | b | b := a ]";
  1423. ast=_st($Smalltalk())._parse_(src);
  1424. _st(self["@analyzer"])._visit_(ast);
  1425. $4=_st(_st(_st(ast)._nodes())._first())._nodes();
  1426. $ctx1.sendIdx["nodes"]=1;
  1427. $3=_st($4)._last();
  1428. $2=_st($3)._scope();
  1429. $ctx1.sendIdx["scope"]=1;
  1430. $1=_st($2).__eq_eq(_st(ast)._scope());
  1431. self._deny_($1);
  1432. return self}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1433. args: [],
  1434. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
  1435. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"],
  1436. referencedClasses: ["Smalltalk"]
  1437. }),
  1438. globals.SemanticAnalyzerTest);
  1439. smalltalk.addMethod(
  1440. smalltalk.method({
  1441. selector: "testScope2",
  1442. protocol: 'tests',
  1443. fn: function (){
  1444. var self=this;
  1445. var src,ast;
  1446. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1447. return smalltalk.withContext(function($ctx1) {
  1448. var $8,$7,$6,$5,$4,$3,$2,$1;
  1449. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  1450. ast=_st($Smalltalk())._parse_(src);
  1451. _st(self["@analyzer"])._visit_(ast);
  1452. $8=_st(_st(_st(ast)._nodes())._first())._nodes();
  1453. $ctx1.sendIdx["nodes"]=3;
  1454. $7=_st($8)._last();
  1455. $6=_st($7)._nodes();
  1456. $ctx1.sendIdx["nodes"]=2;
  1457. $5=_st($6)._first();
  1458. $ctx1.sendIdx["first"]=2;
  1459. $4=_st($5)._nodes();
  1460. $ctx1.sendIdx["nodes"]=1;
  1461. $3=_st($4)._first();
  1462. $ctx1.sendIdx["first"]=1;
  1463. $2=_st($3)._scope();
  1464. $ctx1.sendIdx["scope"]=1;
  1465. $1=_st($2).__eq_eq(_st(ast)._scope());
  1466. self._deny_($1);
  1467. return self}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1468. args: [],
  1469. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
  1470. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"],
  1471. referencedClasses: ["Smalltalk"]
  1472. }),
  1473. globals.SemanticAnalyzerTest);
  1474. smalltalk.addMethod(
  1475. smalltalk.method({
  1476. selector: "testScopeLevel",
  1477. protocol: 'tests',
  1478. fn: function (){
  1479. var self=this;
  1480. var src,ast;
  1481. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1482. return smalltalk.withContext(function($ctx1) {
  1483. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  1484. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  1485. ast=_st($Smalltalk())._parse_(src);
  1486. _st(self["@analyzer"])._visit_(ast);
  1487. $2=_st(ast)._scope();
  1488. $ctx1.sendIdx["scope"]=1;
  1489. $1=_st($2)._scopeLevel();
  1490. $ctx1.sendIdx["scopeLevel"]=1;
  1491. self._assert_equals_($1,(1));
  1492. $ctx1.sendIdx["assert:equals:"]=1;
  1493. $10=_st(_st(_st(ast)._nodes())._first())._nodes();
  1494. $ctx1.sendIdx["nodes"]=3;
  1495. $9=_st($10)._last();
  1496. $8=_st($9)._nodes();
  1497. $ctx1.sendIdx["nodes"]=2;
  1498. $7=_st($8)._first();
  1499. $ctx1.sendIdx["first"]=2;
  1500. $6=_st($7)._nodes();
  1501. $ctx1.sendIdx["nodes"]=1;
  1502. $5=_st($6)._first();
  1503. $ctx1.sendIdx["first"]=1;
  1504. $4=_st($5)._scope();
  1505. $3=_st($4)._scopeLevel();
  1506. self._assert_equals_($3,(3));
  1507. return self}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1508. args: [],
  1509. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  1510. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"],
  1511. referencedClasses: ["Smalltalk"]
  1512. }),
  1513. globals.SemanticAnalyzerTest);
  1514. smalltalk.addMethod(
  1515. smalltalk.method({
  1516. selector: "testUnknownVariables",
  1517. protocol: 'tests',
  1518. fn: function (){
  1519. var self=this;
  1520. var src,ast;
  1521. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1522. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  1523. return smalltalk.withContext(function($ctx1) {
  1524. src="foo | a | b + a";
  1525. ast=_st($Smalltalk())._parse_(src);
  1526. self._should_raise_((function(){
  1527. return smalltalk.withContext(function($ctx2) {
  1528. return _st(self["@analyzer"])._visit_(ast);
  1529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
  1530. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1531. args: [],
  1532. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  1533. messageSends: ["parse:", "should:raise:", "visit:"],
  1534. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  1535. }),
  1536. globals.SemanticAnalyzerTest);
  1537. smalltalk.addMethod(
  1538. smalltalk.method({
  1539. selector: "testUnknownVariablesWithScope",
  1540. protocol: 'tests',
  1541. fn: function (){
  1542. var self=this;
  1543. var src,ast;
  1544. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1545. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  1546. return smalltalk.withContext(function($ctx1) {
  1547. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  1548. ast=_st($Smalltalk())._parse_(src);
  1549. self._should_raise_((function(){
  1550. return smalltalk.withContext(function($ctx2) {
  1551. return _st(self["@analyzer"])._visit_(ast);
  1552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
  1553. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1554. args: [],
  1555. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  1556. messageSends: ["parse:", "should:raise:", "visit:"],
  1557. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  1558. }),
  1559. globals.SemanticAnalyzerTest);
  1560. smalltalk.addMethod(
  1561. smalltalk.method({
  1562. selector: "testVariableShadowing",
  1563. protocol: 'tests',
  1564. fn: function (){
  1565. var self=this;
  1566. var src,ast;
  1567. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1568. return smalltalk.withContext(function($ctx1) {
  1569. src="foo | a | a + 1";
  1570. ast=_st($Smalltalk())._parse_(src);
  1571. _st(self["@analyzer"])._visit_(ast);
  1572. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1573. args: [],
  1574. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  1575. messageSends: ["parse:", "visit:"],
  1576. referencedClasses: ["Smalltalk"]
  1577. }),
  1578. globals.SemanticAnalyzerTest);
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "testVariableShadowing2",
  1582. protocol: 'tests',
  1583. fn: function (){
  1584. var self=this;
  1585. var src,ast;
  1586. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1587. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  1588. return smalltalk.withContext(function($ctx1) {
  1589. src="foo | a | a + 1. [ | a | a := 2 ]";
  1590. ast=_st($Smalltalk())._parse_(src);
  1591. self._should_raise_((function(){
  1592. return smalltalk.withContext(function($ctx2) {
  1593. return _st(self["@analyzer"])._visit_(ast);
  1594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
  1595. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1596. args: [],
  1597. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  1598. messageSends: ["parse:", "should:raise:", "visit:"],
  1599. referencedClasses: ["Smalltalk", "ShadowingVariableError"]
  1600. }),
  1601. globals.SemanticAnalyzerTest);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "testVariableShadowing3",
  1605. protocol: 'tests',
  1606. fn: function (){
  1607. var self=this;
  1608. var src,ast;
  1609. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1610. return smalltalk.withContext(function($ctx1) {
  1611. src="foo | a | a + 1. [ | b | b := 2 ]";
  1612. ast=_st($Smalltalk())._parse_(src);
  1613. _st(self["@analyzer"])._visit_(ast);
  1614. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1615. args: [],
  1616. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  1617. messageSends: ["parse:", "visit:"],
  1618. referencedClasses: ["Smalltalk"]
  1619. }),
  1620. globals.SemanticAnalyzerTest);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "testVariableShadowing4",
  1624. protocol: 'tests',
  1625. fn: function (){
  1626. var self=this;
  1627. var src,ast;
  1628. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1629. return smalltalk.withContext(function($ctx1) {
  1630. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  1631. ast=_st($Smalltalk())._parse_(src);
  1632. _st(self["@analyzer"])._visit_(ast);
  1633. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1634. args: [],
  1635. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  1636. messageSends: ["parse:", "visit:"],
  1637. referencedClasses: ["Smalltalk"]
  1638. }),
  1639. globals.SemanticAnalyzerTest);
  1640. smalltalk.addMethod(
  1641. smalltalk.method({
  1642. selector: "testVariableShadowing5",
  1643. protocol: 'tests',
  1644. fn: function (){
  1645. var self=this;
  1646. var src,ast;
  1647. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1648. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  1649. return smalltalk.withContext(function($ctx1) {
  1650. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  1651. ast=_st($Smalltalk())._parse_(src);
  1652. self._should_raise_((function(){
  1653. return smalltalk.withContext(function($ctx2) {
  1654. return _st(self["@analyzer"])._visit_(ast);
  1655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
  1656. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1657. args: [],
  1658. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  1659. messageSends: ["parse:", "should:raise:", "visit:"],
  1660. referencedClasses: ["Smalltalk", "ShadowingVariableError"]
  1661. }),
  1662. globals.SemanticAnalyzerTest);
  1663. smalltalk.addMethod(
  1664. smalltalk.method({
  1665. selector: "testVariablesLookup",
  1666. protocol: 'tests',
  1667. fn: function (){
  1668. var self=this;
  1669. var src,ast;
  1670. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1671. return smalltalk.withContext(function($ctx1) {
  1672. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  1673. src="foo | a | a + 1. [ | b | b := a ]";
  1674. ast=_st($Smalltalk())._parse_(src);
  1675. _st(self["@analyzer"])._visit_(ast);
  1676. $7=_st(ast)._nodes();
  1677. $ctx1.sendIdx["nodes"]=2;
  1678. $6=_st($7)._first();
  1679. $ctx1.sendIdx["first"]=2;
  1680. $5=_st($6)._nodes();
  1681. $ctx1.sendIdx["nodes"]=1;
  1682. $4=_st($5)._first();
  1683. $ctx1.sendIdx["first"]=1;
  1684. $3=_st($4)._receiver();
  1685. $ctx1.sendIdx["receiver"]=1;
  1686. $2=_st($3)._binding();
  1687. $ctx1.sendIdx["binding"]=1;
  1688. $1=_st($2)._isTempVar();
  1689. $ctx1.sendIdx["isTempVar"]=1;
  1690. self._assert_($1);
  1691. $ctx1.sendIdx["assert:"]=1;
  1692. $15=_st(ast)._nodes();
  1693. $ctx1.sendIdx["nodes"]=4;
  1694. $14=_st($15)._first();
  1695. $ctx1.sendIdx["first"]=4;
  1696. $13=_st($14)._nodes();
  1697. $ctx1.sendIdx["nodes"]=3;
  1698. $12=_st($13)._first();
  1699. $ctx1.sendIdx["first"]=3;
  1700. $11=_st($12)._receiver();
  1701. $10=_st($11)._binding();
  1702. $ctx1.sendIdx["binding"]=2;
  1703. $9=_st($10)._scope();
  1704. $ctx1.sendIdx["scope"]=1;
  1705. $16=_st(ast)._scope();
  1706. $ctx1.sendIdx["scope"]=2;
  1707. $8=_st($9).__eq_eq($16);
  1708. $ctx1.sendIdx["=="]=1;
  1709. self._assert_($8);
  1710. $ctx1.sendIdx["assert:"]=2;
  1711. $27=_st(ast)._nodes();
  1712. $ctx1.sendIdx["nodes"]=8;
  1713. $26=_st($27)._first();
  1714. $ctx1.sendIdx["first"]=7;
  1715. $25=_st($26)._nodes();
  1716. $ctx1.sendIdx["nodes"]=7;
  1717. $24=_st($25)._last();
  1718. $ctx1.sendIdx["last"]=1;
  1719. $23=_st($24)._nodes();
  1720. $ctx1.sendIdx["nodes"]=6;
  1721. $22=_st($23)._first();
  1722. $ctx1.sendIdx["first"]=6;
  1723. $21=_st($22)._nodes();
  1724. $ctx1.sendIdx["nodes"]=5;
  1725. $20=_st($21)._first();
  1726. $ctx1.sendIdx["first"]=5;
  1727. $19=_st($20)._left();
  1728. $ctx1.sendIdx["left"]=1;
  1729. $18=_st($19)._binding();
  1730. $ctx1.sendIdx["binding"]=3;
  1731. $17=_st($18)._isTempVar();
  1732. self._assert_($17);
  1733. $ctx1.sendIdx["assert:"]=3;
  1734. $39=_st(ast)._nodes();
  1735. $ctx1.sendIdx["nodes"]=12;
  1736. $38=_st($39)._first();
  1737. $ctx1.sendIdx["first"]=10;
  1738. $37=_st($38)._nodes();
  1739. $ctx1.sendIdx["nodes"]=11;
  1740. $36=_st($37)._last();
  1741. $ctx1.sendIdx["last"]=2;
  1742. $35=_st($36)._nodes();
  1743. $ctx1.sendIdx["nodes"]=10;
  1744. $34=_st($35)._first();
  1745. $ctx1.sendIdx["first"]=9;
  1746. $33=_st($34)._nodes();
  1747. $ctx1.sendIdx["nodes"]=9;
  1748. $32=_st($33)._first();
  1749. $ctx1.sendIdx["first"]=8;
  1750. $31=_st($32)._left();
  1751. $30=_st($31)._binding();
  1752. $29=_st($30)._scope();
  1753. $ctx1.sendIdx["scope"]=3;
  1754. $42=_st(_st(_st(ast)._nodes())._first())._nodes();
  1755. $ctx1.sendIdx["nodes"]=13;
  1756. $41=_st($42)._last();
  1757. $40=_st($41)._scope();
  1758. $28=_st($29).__eq_eq($40);
  1759. self._assert_($28);
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  1761. args: [],
  1762. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  1763. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"],
  1764. referencedClasses: ["Smalltalk"]
  1765. }),
  1766. globals.SemanticAnalyzerTest);
  1767. });