[squeak-dev] The Trunk: EToys-ct.390.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 18 13:32:32 UTC 2021


Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ct.390.mcz

==================== Summary ====================

Name: EToys-ct.390
Author: ct
Time: 27 March 2020, 9:39:10.801235 pm
UUID: d54c1d9b-6381-784b-8a2d-497804eab2a7
Ancestors: EToys-eem.388

Refines parsing of SyntaxMorphs, respecting asStatement: aBoolean

If a statement is requested, don't return the whole method to avoid nested methods. Also cleans up ScriptEditorMorph >> #parseNodeWith: (strengthening polymorphy).

=============== Diff against EToys-eem.388 ===============

Item was changed:
  ----- Method: ScriptEditorMorph>>parseNodeWith: (in category '*Etoys-Squeakland-other') -----
  parseNodeWith: encoder
  
  	| statements ret |
  	statements := WriteStream on: (Array new: self tileRows size).
+ 	self tileRows do: [:row | 
+ 		row do: [:morph |
+ 			(morph respondsTo: #parseNodeWith:asStatement:) ifTrue: [
+ 				statements nextPut: (morph parseNodeWith: encoder asStatement: true)]]].
- 	self tileRows do: [:r | 
- 		r do: [:m | 
- 			((m isKindOf: TileMorph) 
- 				or: [(m isKindOf: CompoundTileMorph)
- 					or: [m isKindOf: PhraseTileMorph]]) ifTrue: [
- 						statements nextPut: (m parseNodeWith: encoder asStatement: true)]]].
  	statements := statements contents.
  	ret := ReturnNode new expr: (encoder encodeVariable: 'self').
+ 	^ BlockNode new
+ 		arguments: #() 
+ 		statements: (statements copyWith: ret)
+ 		returns: true
+ 		from: encoder.!
- 	^ BlockNode new arguments: #() statements: (statements copyWith: ret) returns: true from: encoder.
- !

Item was changed:
  ----- Method: SyntaxMorph>>parseNodeWith:asStatement: (in category '*Etoys-Squeakland-code generation') -----
  parseNodeWith: encoder asStatement: aBoolean
  
+ 	| methodNode |
+ 	methodNode := self parseNodeWith: encoder.
+ 	^ aBoolean
+ 		ifFalse: [methodNode]
+ 		ifTrue: [methodNode block]!
- 	^ self parseNode!



More information about the Squeak-dev mailing list