[Vm-dev] VM Maker: VMMaker.oscog-eem.2793.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Aug 25 02:48:02 UTC 2020

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-eem.2793
Author: eem
Time: 24 August 2020, 7:47:53.984785 pm
UUID: 87cb649c-1079-4e58-9e4c-cbf9d4f6669d
Ancestors: VMMaker.oscog-eem.2792

methodReturnFoo's are too useful an ideom not to support properly.  Ensure that SmartSyntaxPluginCodeGenerator is smart enough not to require the use of an explicit return for a trailing methodReturnFoo.  And yes, this bit me.

=============== Diff against VMMaker.oscog-eem.2792 ===============

Item was added:
+ ----- Method: SmartSyntaxPluginTMethod>>endsWithMethodReturnExpression (in category 'testing') -----
+ endsWithMethodReturnExpression
+ 	| operativeReturn |
+ 	operativeReturn := (parseTree statements last isReturn
+ 						 and: [parseTree statements last expression isLeaf])
+ 							ifTrue: [(parseTree statements last: 2) first]
+ 							ifFalse: [parseTree statements last].
+ 	^operativeReturn isSend
+ 	 and: [#(methodReturnReceiver
+ 			methodReturnFloat:
+ 			methodReturnValue:
+ 			methodReturnInteger:
+ 			methodReturnBool:
+ 			methodReturnString:
+ 			methodReturnStringOrNil:) includes: operativeReturn selector]!

Item was changed:
  ----- Method: SmartSyntaxPluginTMethod>>fixUpReturns (in category 'transforming') -----
  	"Replace each return statement in this method with (a) the given postlog, (b) code to pop the receiver and the given number of arguments, and (c) code to push the integer result and return."
+ 	self endsWithMethodReturnExpression ifTrue:
+ 		[parseTree statements last isSend ifFalse:
+ 			[parseTree setStatements: parseTree statements allButLast]].
+ 	parseTree nodesDo:
+ 		[:node |
+ 		node isStmtList ifTrue:
+ 			[node setStatements: (Array streamContents:
- 	parseTree nodesDo: [:node |
- 		node isStmtList ifTrue: [
- 			node setStatements: (Array streamContents:
  				[:sStream |
  				 node statements do: 
  					[:stmt | self fixUpReturnOneStmt: stmt on: sStream]])]]!

More information about the Vm-dev mailing list