[Pkg] The Trunk: Compiler-nice.187.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Feb 13 18:21:06 UTC 2011

Nicolas Cellier uploaded a new version of Compiler to project The Trunk:

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

Name: Compiler-nice.187
Author: nice
Time: 4 February 2011, 10:17:14.337 pm
UUID: 71dd94ed-3fc7-49e0-b180-fb04be82bc29
Ancestors: Compiler-nice.184

In case nil is the doItReceiver of an interactive evaluation, avoid proposing a menu that would add an inst var to UndefinedObject.

=============== Diff against Compiler-nice.184 ===============

Item was added:
+ ----- Method: Parser>>canDeclareInstanceVariable (in category 'error correction') -----
+ canDeclareInstanceVariable
+ 	^encoder classEncoding ~~ UndefinedObject!

Item was changed:
  ----- Method: UndeclaredVariable>>openMenuIn: (in category 'as yet unclassified') -----
  openMenuIn: aBlock 
  	| alternatives labels actions lines caption choice |
  	alternatives := parser possibleVariablesFor: name.
  	labels := OrderedCollection new.
  	actions := OrderedCollection new.
  	lines := OrderedCollection new.
  	name first isLowercase 
  			[labels add: 'declare method temp'.
  			actions add: [parser declareTemp: name at: #method].
  			labels add: 'declare block-local temp'.
  			actions add: [parser declareTemp: name at: #block].
+ 			parser canDeclareClassVariable 
+ 				ifTrue: 
+ 					[labels add: 'declare instance'.
+ 					actions add: [parser declareInstVar: name]]]
- 			labels add: 'declare instance'.
- 			actions add: [parser declareInstVar: name]]
  			[labels add: 'define new class'.
  			actions add: [parser defineClass: name].
  			labels add: 'declare global'.
  			actions add: [parser declareGlobal: name].
  			parser canDeclareClassVariable 
  					[labels add: 'declare class variable'.
  					actions add: [parser declareClassVar: name]]].
  	lines add: labels size.
  	alternatives do: 
  		[:each | 
  		labels add: each.
  		actions add: [parser substituteVariable: each atInterval: interval]].
  	lines add: labels size.
  	labels add: 'cancel'.
  	caption := 'Unknown variable: ' , name , ' please correct, or cancel:'.
  	choice := aBlock value: labels value: lines value: caption.
  	self resume: (actions at: choice ifAbsent: [nil])!

More information about the Packages mailing list