Compiler-Tests.js 49 KB

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