[squeak-dev] The Trunk: Compiler-nice.192.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Feb 20 16:12:16 UTC 2011


Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.192.mcz

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

Name: Compiler-nice.192
Author: nice
Time: 20 February 2011, 5:12:00.371 pm
UUID: 3be37582-d3a2-4825-8210-073dd0af3f61
Ancestors: Compiler-ul.191

Let #caseOf: accept any ParseNode argument, not just BraceNode and VariableNode.
Remove usage of canBeSpecialArgument which is now unsent.

=============== Diff against Compiler-ul.191 ===============

Item was changed:
  ----- Method: MessageNode>>checkBlock:as:from:maxArgs: (in category 'private') -----
  checkBlock: node as: nodeName from: encoder maxArgs: maxArgs
+ 	"Answer true if node is a BlockNode with at most maxArgs arguments.
+ 	This check is required in order to inline some special messages.
+ 	Notify some undue usage of these special messages."
- 	"vb: #canBeSpecialArgument for blocks hardcodes 0 arguments as the requirement for special blocks. We work around that here by further checking the number of arguments for blocks.."
  
+ 	node isBlockNode
- 	node canBeSpecialArgument ifTrue: 
- 		[^node isBlockNode].
- 	^node isBlockNode
  		ifTrue:
  			[node numberOfArguments <= maxArgs
+ 				ifTrue: [^true]
- 				ifTrue: [true]
  				ifFalse: [encoder notify: '<- ', nodeName , ' of ' ,
+ 					(MacroSelectors at: special) , ' has too many arguments']].
+ 	^false!
- 					(MacroSelectors at: special) , ' has too many arguments']]
- 		ifFalse:
- 			[false]!

Item was changed:
  ----- Method: MessageNode>>transformCase: (in category 'macro transformations') -----
  transformCase: encoder
  
  	| caseNode |
  	caseNode := arguments first.
  	(caseNode isMemberOf: BraceNode) ifTrue:
  		[((caseNode blockAssociationCheck: encoder)
  		  and: [arguments size = 1
  			    or: [self checkBlock: arguments last as: 'otherwise arg' from: encoder]]) ifFalse:
  			[^false].
  		 caseNode elements do:
  			[:messageNode|
  			messageNode receiver noteOptimizedIn: self.
  			messageNode arguments first noteOptimizedIn: self].
  		 arguments size = 2 ifTrue:
  			[arguments last noteOptimizedIn: self].
  		 ^true].
+ 	^false!
- 	(caseNode canBeSpecialArgument and: [(caseNode isMemberOf: BlockNode) not]) ifTrue:
- 		[^false]. "caseOf: variable"
- 	^encoder notify: 'caseOf: argument must be a brace construct or a variable'!




More information about the Squeak-dev mailing list