Compiler-Tests.js 66 KB

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