1
0

Compiler-Tests.st 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. Smalltalk current createPackage: 'Compiler-Tests'!
  2. TestCase subclass: #ASTParsingTest
  3. instanceVariableNames: ''
  4. package: 'Compiler-Tests'!
  5. !ASTParsingTest methodsFor: 'convenience'!
  6. analyze: aNode forClass: aClass
  7. (SemanticAnalyzer on: aClass) visit: aNode.
  8. ^ aNode
  9. ! !
  10. !ASTParsingTest methodsFor: 'parsing'!
  11. parse: aString
  12. ^ Smalltalk current parse: aString
  13. !
  14. parse: aString forClass: aClass
  15. ^ self analyze: (self parse: aString) forClass: aClass
  16. ! !
  17. ASTParsingTest subclass: #ASTPCNodeVisitorTest
  18. instanceVariableNames: ''
  19. package: 'Compiler-Tests'!
  20. !ASTPCNodeVisitorTest methodsFor: 'factory'!
  21. astPCNodeVisitor
  22. ^ ASTPCNodeVisitor new
  23. context: (AIContext new
  24. yourself);
  25. yourself
  26. !
  27. astPCNodeVisitorForSelector: aString
  28. ^ ASTPCNodeVisitor new
  29. selector: aString;
  30. context: (AIContext new
  31. yourself);
  32. yourself
  33. ! !
  34. !ASTPCNodeVisitorTest methodsFor: 'tests'!
  35. testJSStatementNode
  36. | ast visitor |
  37. ast := self parse: 'foo <consolee.log(1)>' forClass: Object.
  38. self assert: (self astPCNodeVisitor
  39. visit: ast;
  40. currentNode) isJSStatementNode
  41. !
  42. testMessageSend
  43. | ast |
  44. ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.
  45. self assert: ((self astPCNodeVisitorForSelector: 'yourself')
  46. visit: ast;
  47. currentNode) selector equals: 'yourself'
  48. !
  49. testMessageSendWithBlocks
  50. | ast |
  51. ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.
  52. self assert: ((self astPCNodeVisitorForSelector: 'yourself')
  53. visit: ast;
  54. currentNode) selector equals: 'yourself'
  55. !
  56. testMessageSendWithInlining
  57. | ast |
  58. ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.
  59. self assert: ((self astPCNodeVisitorForSelector: 'yourself')
  60. visit: ast;
  61. currentNode) selector equals: 'yourself'.
  62. ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.
  63. self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')
  64. visit: ast;
  65. currentNode) selector equals: 'asBoolean'
  66. !
  67. testNoMessageSend
  68. | ast |
  69. ast := self parse: 'foo ^ self' forClass: Object.
  70. self assert: (self astPCNodeVisitor
  71. visit: ast;
  72. currentNode) isNil
  73. !
  74. testPC
  75. | ast visitor |
  76. ast := self parse: 'foo <console.log(1)>' forClass: Object.
  77. self assert: (self astPCNodeVisitor
  78. visit: ast;
  79. currentNode) isJSStatementNode
  80. ! !
  81. ASTParsingTest subclass: #CodeGeneratorTest
  82. instanceVariableNames: 'receiver'
  83. package: 'Compiler-Tests'!
  84. !CodeGeneratorTest methodsFor: 'accessing'!
  85. codeGeneratorClass
  86. ^ CodeGenerator
  87. ! !
  88. !CodeGeneratorTest methodsFor: 'factory'!
  89. compiler
  90. ^ Compiler new
  91. codeGeneratorClass: self codeGeneratorClass;
  92. yourself
  93. ! !
  94. !CodeGeneratorTest methodsFor: 'initialization'!
  95. setUp
  96. receiver := DoIt new
  97. !
  98. tearDown
  99. "receiver := nil"
  100. ! !
  101. !CodeGeneratorTest methodsFor: 'testing'!
  102. should: aString receiver: anObject return: aResult
  103. | method result |
  104. receiver := anObject.
  105. method := self compiler install: aString forClass: anObject class category: 'tests'.
  106. result := receiver perform: method selector.
  107. anObject class removeCompiledMethod: method.
  108. self assert: aResult equals: result
  109. !
  110. should: aString return: anObject
  111. ^ self
  112. should: aString
  113. receiver: receiver
  114. return: anObject
  115. ! !
  116. !CodeGeneratorTest methodsFor: 'tests'!
  117. testAssignment
  118. self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.
  119. self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.
  120. self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1
  121. !
  122. testBackslashSelectors
  123. self should: '\ arg ^ 4' return: 4.
  124. self should: '\\ arg ^ 42' return: 42
  125. !
  126. testBlockReturn
  127. self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).
  128. self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).
  129. self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).
  130. !
  131. testCascades
  132. self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)
  133. !
  134. testDynamicArrayElementsOrdered
  135. self should: 'foo
  136. | x |
  137. x := 1.
  138. ^ { x. true ifTrue: [ x := 2 ] }
  139. ' return: #(1 2).
  140. !
  141. testDynamicDictionaryElementsOrdered
  142. self should: 'foo
  143. | x |
  144. x := ''foo''->1.
  145. ^ #{ x. (true ifTrue: [ x := ''bar''->2 ]) }
  146. ' return: #{'foo'->1. 'bar'->2}.
  147. !
  148. testGlobalVar
  149. self should: 'foo ^ eval class' return: BlockClosure.
  150. self should: 'foo ^ Math cos: 0' return: 1.
  151. self should: 'foo ^ NonExistingVar' return: nil
  152. !
  153. testInnerTemporalDependentElementsOrdered
  154. self should: 'foo
  155. | x |
  156. x := Array.
  157. ^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
  158. ' return: {'foo'->Array. 'bar'->2}.
  159. self should: 'foo
  160. | x |
  161. x := 1.
  162. ^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
  163. ' return: {'foo'->1. 'bar'->2}.
  164. self should: 'foo
  165. | x |
  166. x := 1.
  167. ^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
  168. ' return: {'foo'->1. 'bar'->2}.
  169. self should: 'foo
  170. | x |
  171. x := 1.
  172. ^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
  173. ' return: #{'foo'->1. 'bar'->2}.
  174. !
  175. testJSStatement
  176. self should: 'foo <return 2+3>' return: 5
  177. !
  178. testLiterals
  179. self should: 'foo ^ 1' return: 1.
  180. self should: 'foo ^ ''hello''' return: 'hello'.
  181. self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).
  182. self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).
  183. self should: 'foo ^ true' return: true.
  184. self should: 'foo ^ false' return: false.
  185. self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.
  186. self should: 'foo ^ #hello' return: #hello.
  187. self should: 'foo ^ -123.456' return: -123.456.
  188. self should: 'foo ^ -2.5e4' return: -25000.
  189. !
  190. testLocalReturn
  191. self should: 'foo ^ 1' return: 1.
  192. self should: 'foo ^ 1 + 1' return: 2.
  193. self should: 'foo ' return: receiver.
  194. self should: 'foo self asString' return: receiver.
  195. self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3
  196. !
  197. testMessageSends
  198. self should: 'foo ^ 1 asString' return: '1'.
  199. self should: 'foo ^ 1 + 1' return: 2.
  200. self should: 'foo ^ 1 + 2 * 3' return: 9.
  201. self should: 'foo ^ 1 to: 3' return: #(1 2 3).
  202. self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)
  203. !
  204. testMultipleSequences
  205. self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30
  206. !
  207. testMutableLiterals
  208. "Mutable literals must be aliased in cascades.
  209. See https://github.com/amber-smalltalk/amber/issues/428"
  210. self
  211. should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself'
  212. return: #(3 2)
  213. !
  214. testNestedIfTrue
  215. self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.
  216. self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.
  217. self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.
  218. self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.
  219. !
  220. testNestedSends
  221. self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString
  222. !
  223. testNonLocalReturn
  224. self should: 'foo [ ^ 1 ] value' return: 1.
  225. self should: 'foo [ ^ 1 + 1 ] value' return: 2.
  226. self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.
  227. self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8
  228. !
  229. testPascalCaseGlobal
  230. self should: 'foo ^Object' return: (smalltalk at: 'Object').
  231. self should: 'foo ^NonExistent' return: nil
  232. !
  233. testSendReceiverAndArgumentsOrdered
  234. self should: 'foo
  235. | x |
  236. x := 1.
  237. ^ Array with: x with: (true ifTrue: [ x := 2 ])
  238. ' return: #(1 2).
  239. self should: 'foo
  240. | x |
  241. x := Array.
  242. ^ x with: x with: (true ifTrue: [ x := 2 ])
  243. ' return: {Array. 2}.
  244. !
  245. testSuperSend
  246. self
  247. should: 'foo ^ super isBoolean'
  248. receiver: true
  249. return: false
  250. !
  251. testTempVariables
  252. self should: 'foo | a | ^ a' return: nil.
  253. self should: 'foo | AVariable | ^ AVariable' return: nil.
  254. self should: 'foo | a b c | ^ c' return: nil.
  255. self should: 'foo | a | [ | d | ^ d ] value' return: nil.
  256. self should: 'foo | a | a:= 1. ^ a' return: 1.
  257. self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.
  258. !
  259. testThisContext
  260. self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true
  261. !
  262. testifFalse
  263. self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.
  264. self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.
  265. self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.
  266. self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.
  267. !
  268. testifFalseIfTrue
  269. self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.
  270. self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.
  271. self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.
  272. self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.
  273. !
  274. testifNil
  275. self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.
  276. self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.
  277. self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.
  278. self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.
  279. !
  280. testifNilIfNotNil
  281. self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.
  282. self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.
  283. self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.
  284. self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.
  285. !
  286. testifNotNil
  287. self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.
  288. self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.
  289. self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.
  290. self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.
  291. !
  292. testifNotNilWithArgument
  293. self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.
  294. self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.
  295. self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.
  296. self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.
  297. self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.
  298. self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5
  299. !
  300. testifTrue
  301. self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.
  302. self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.
  303. self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.
  304. self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.
  305. !
  306. testifTrueIfFalse
  307. self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.
  308. self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.
  309. self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.
  310. self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.
  311. ! !
  312. CodeGeneratorTest subclass: #InliningCodeGeneratorTest
  313. instanceVariableNames: ''
  314. package: 'Compiler-Tests'!
  315. !InliningCodeGeneratorTest methodsFor: 'accessing'!
  316. codeGeneratorClass
  317. ^ InliningCodeGenerator
  318. ! !
  319. CodeGeneratorTest subclass: #InterpreterTest
  320. instanceVariableNames: ''
  321. package: 'Compiler-Tests'!
  322. !InterpreterTest methodsFor: 'parsing'!
  323. analyze: aNode forClass: aClass
  324. (SemanticAnalyzer on: aClass) visit: aNode.
  325. ^ aNode
  326. !
  327. parse: aString
  328. ^ Smalltalk current parse: aString
  329. !
  330. parse: aString forClass: aClass
  331. ^ self analyze: (self parse: aString) forClass: aClass
  332. ! !
  333. !InterpreterTest methodsFor: 'private'!
  334. interpret: aString receiver: anObject withArguments: aDictionary
  335. "The food is a methodNode. Interpret the sequenceNode only"
  336. | ctx interpreter |
  337. interpreter := ASTInterpreter new.
  338. ctx := AIContext new
  339. receiver: anObject;
  340. interpreter: interpreter;
  341. yourself.
  342. aDictionary keysAndValuesDo: [ :key :value |
  343. ctx localAt: key put: value ].
  344. ^ interpreter
  345. context: ctx;
  346. interpret: (self parse: aString forClass: anObject class) nextChild;
  347. proceed;
  348. result
  349. ! !
  350. !InterpreterTest methodsFor: 'testing'!
  351. should: aString receiver: anObject return: aResult
  352. receiver := anObject.
  353. ^ self
  354. assert: (self interpret: aString receiver: receiver withArguments: #{})
  355. equals: aResult
  356. !
  357. should: aString return: anObject
  358. ^ self
  359. should: aString
  360. receiver: receiver
  361. return: anObject
  362. ! !
  363. TestCase subclass: #ScopeVarTest
  364. instanceVariableNames: ''
  365. package: 'Compiler-Tests'!
  366. !ScopeVarTest methodsFor: 'tests'!
  367. testClassRefVar
  368. | node |
  369. node := VariableNode new
  370. value: 'Object';
  371. yourself.
  372. SemanticAnalyzer new
  373. pushScope: MethodLexicalScope new;
  374. visit: node.
  375. self assert: node binding isClassRefVar
  376. !
  377. testInstanceVar
  378. | node scope |
  379. node := VariableNode new
  380. value: 'bzzz';
  381. yourself.
  382. scope := MethodLexicalScope new.
  383. scope addIVar: 'bzzz'.
  384. self assert: (scope bindingFor: node) isInstanceVar
  385. !
  386. testPseudoVar
  387. | node pseudoVars |
  388. pseudoVars := #('self' 'super' 'true' 'false' 'nil').
  389. pseudoVars do: [:each |
  390. node := VariableNode new
  391. value: each;
  392. yourself.
  393. self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]
  394. !
  395. testTempVar
  396. | node scope |
  397. node := VariableNode new
  398. value: 'bzzz';
  399. yourself.
  400. scope := MethodLexicalScope new.
  401. scope addTemp: 'bzzz'.
  402. self assert: (scope bindingFor: node) isTempVar
  403. !
  404. testUnknownVar
  405. | node |
  406. node := VariableNode new
  407. value: 'bzzz';
  408. yourself.
  409. self assert: (MethodLexicalScope new bindingFor: node) isNil
  410. ! !
  411. TestCase subclass: #SemanticAnalyzerTest
  412. instanceVariableNames: 'analyzer'
  413. package: 'Compiler-Tests'!
  414. !SemanticAnalyzerTest methodsFor: 'running'!
  415. setUp
  416. analyzer := SemanticAnalyzer on: Object
  417. ! !
  418. !SemanticAnalyzerTest methodsFor: 'tests'!
  419. testAssignment
  420. | src ast |
  421. src := 'foo self := 1'.
  422. ast := smalltalk parse: src.
  423. self should: [analyzer visit: ast] raise: InvalidAssignmentError
  424. !
  425. testNonLocalReturn
  426. | src ast |
  427. src := 'foo | a | a + 1. ^ a'.
  428. ast := smalltalk parse: src.
  429. analyzer visit: ast.
  430. self deny: ast scope hasNonLocalReturn
  431. !
  432. testNonLocalReturn2
  433. | src ast |
  434. src := 'foo | a | a + 1. [ [ ^ a] ]'.
  435. ast := smalltalk parse: src.
  436. analyzer visit: ast.
  437. self assert: ast scope hasNonLocalReturn
  438. !
  439. testScope
  440. | src ast |
  441. src := 'foo | a | a + 1. [ | b | b := a ]'.
  442. ast := smalltalk parse: src.
  443. analyzer visit: ast.
  444. self deny: ast nodes first nodes last scope == ast scope.
  445. !
  446. testScope2
  447. | src ast |
  448. src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.
  449. ast := smalltalk parse: src.
  450. analyzer visit: ast.
  451. self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.
  452. !
  453. testScopeLevel
  454. | src ast |
  455. src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.
  456. ast := smalltalk parse: src.
  457. analyzer visit: ast.
  458. self assert: ast scope scopeLevel equals: 1.
  459. self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3
  460. !
  461. testUnknownVariables
  462. | src ast |
  463. src := 'foo | a | b + a'.
  464. ast := smalltalk parse: src.
  465. self should: [ analyzer visit: ast ] raise: UnknownVariableError
  466. !
  467. testUnknownVariablesWithScope
  468. | src ast |
  469. src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.
  470. ast := smalltalk parse: src.
  471. self should: [ analyzer visit: ast ] raise: UnknownVariableError
  472. !
  473. testVariableShadowing
  474. | src ast |
  475. src := 'foo | a | a + 1'.
  476. ast := smalltalk parse: src.
  477. analyzer visit: ast
  478. !
  479. testVariableShadowing2
  480. | src ast |
  481. src := 'foo | a | a + 1. [ | a | a := 2 ]'.
  482. ast := smalltalk parse: src.
  483. self should: [analyzer visit: ast] raise: ShadowingVariableError
  484. !
  485. testVariableShadowing3
  486. | src ast |
  487. src := 'foo | a | a + 1. [ | b | b := 2 ]'.
  488. ast := smalltalk parse: src.
  489. analyzer visit: ast
  490. !
  491. testVariableShadowing4
  492. | src ast |
  493. src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.
  494. ast := smalltalk parse: src.
  495. analyzer visit: ast
  496. !
  497. testVariableShadowing5
  498. | src ast |
  499. src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.
  500. ast := smalltalk parse: src.
  501. self should: [analyzer visit: ast] raise: ShadowingVariableError
  502. !
  503. testVariablesLookup
  504. | src ast |
  505. src := 'foo | a | a + 1. [ | b | b := a ]'.
  506. ast := smalltalk parse: src.
  507. analyzer visit: ast.
  508. "Binding for `a` in the message send"
  509. self assert: ast nodes first nodes first receiver binding isTempVar.
  510. self assert: ast nodes first nodes first receiver binding scope == ast scope.
  511. "Binding for `b`"
  512. self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.
  513. self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.
  514. ! !