Compiler-Tests.js 50 KB

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