Compiler-Tests.js 79 KB

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