[squeak-dev] The Trunk: Compiler-jcg.147.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 23 19:08:43 UTC 2010


Joshua Gargus uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-jcg.147.mcz

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

Name: Compiler-jcg.147
Author: jcg
Time: 23 June 2010, 12:04:54.856 pm
UUID: 714d775f-78af-45dc-affc-b33d59d68da5
Ancestors: Compiler-nice.146

Change Parser>>correctVariable:interval: to allow it to look up the proposed variable in the requestor even if it starts with an uppercase letter.

=============== Diff against Compiler-nice.146 ===============

Item was changed:
  ----- Method: Parser>>correctVariable:interval: (in category 'error correction') -----
  correctVariable: proposedVariable interval: spot 
  	"Correct the proposedVariable to a known variable, or declare it as a new
  	variable if such action is requested.  We support declaring lowercase
  	variables as temps or inst-vars, and uppercase variables as Globals or 
  	ClassVars, depending on whether the context is nil (class=UndefinedObject).
  	Spot is the interval within the test stream of the variable.
  	rr 3/4/2004 10:26 : adds the option to define a new class. "
  
  	"Check if this is an i-var, that has been corrected already (ugly)"
  
  	"Display the pop-up menu"
  
+ 	| binding userSelection action |
- 	| tempIvar binding userSelection action |
  	(encoder classEncoding instVarNames includes: proposedVariable) ifTrue: 
  		[^InstanceVariableNode new 
  			name: proposedVariable
  			index: (encoder classEncoding allInstVarNames indexOf: proposedVariable)].
  
  	"If we can't ask the user for correction, make it undeclared"
  	self interactive ifFalse: [^encoder undeclared: proposedVariable].
  
  	"First check to see if the requestor knows anything about the variable"
+ 	(binding := requestor bindingOf: proposedVariable)
+ 		ifNotNil: [^encoder global: binding name: proposedVariable].
- 	tempIvar := proposedVariable first isLowercase.
- 	(tempIvar and: [(binding := requestor bindingOf: proposedVariable) notNil]) 
- 		ifTrue: [^encoder global: binding name: proposedVariable].
  	userSelection := requestor selectionInterval.
  	requestor selectFrom: spot first to: spot last.
  	requestor select.
  
  	"Build the menu with alternatives"
  	action := UndeclaredVariable 
  				signalFor: self
  				name: proposedVariable
  				inRange: spot.
  	action ifNil: [^self fail].
  
  	"Execute the selected action"
  	requestor deselect.
  	requestor selectInvisiblyFrom: userSelection first to: userSelection last.
  	^action value!




More information about the Squeak-dev mailing list