The Trunk: Compiler-mt.319.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compiler-mt.319.mcz

commits-2
Marcel Taeumel uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-mt.319.mcz

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

Name: Compiler-mt.319
Author: mt
Time: 18 February 2016, 10:58:07.931715 am
UUID: 346cab39-3c65-40cb-9344-293aa4090074
Ancestors: Compiler-mt.318

Even if the requestor does not support interactive error correction, allow for the use of new bindings.

=============== Diff against Compiler-mt.318 ===============

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 |
  (encoder classEncoding instVarNames includes: proposedVariable) ifTrue:
  [^InstanceVariableNode new
  name: proposedVariable
  index: (encoder classEncoding allInstVarNames indexOf: proposedVariable)].
 
+ "First check to see if the requestor knows anything about the variable"
+ (binding := cue requestor ifNotNil: [:object | object bindingOf: proposedVariable])
+ ifNotNil: [^encoder global: binding name: 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 := cue requestor bindingOf: proposedVariable)
- ifNotNil: [^encoder global: binding name: proposedVariable].
  userSelection := cue requestor selectionInterval.
  cue requestor selectFrom: spot first to: spot last.
  cue requestor select.
 
  "Build the menu with alternatives"
  action := UndeclaredVariable
  signalFor: self
  name: proposedVariable
  inRange: spot.
  action ifNil: [^self fail].
 
  "Execute the selected action"
  cue requestor deselect.
  cue requestor selectInvisiblyFrom: userSelection first to: userSelection last.
  ^action value!