[etoys-dev] Etoys: Etoys-Richo.104.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Feb 7 16:17:43 EST 2012


Ricardo Moran uploaded a new version of Etoys to project Etoys:
http://source.squeak.org/etoys/Etoys-Richo.104.mcz

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

Name: Etoys-Richo.104
Author: Richo
Time: 7 February 2012, 6:16:45 pm
UUID: 5b7e1ee7-c39c-3745-85c2-89d0f66caaf3
Ancestors: Etoys-Richo.103

* Fixed bug when adding a new variable and not selecting a type.

=============== Diff against Etoys-Richo.103 ===============

Item was changed:
  ----- Method: Player>>addInstanceVariable (in category 'slots-user') -----
  addInstanceVariable
  	"Offer the user the opportunity to add an instance variable, and if he goes through with it, actually add it."
  
  	| itsName initialValue typeChosen usedNames initialAnswer setterSelector originalString |
  	usedNames := self class instVarNames.
  
  	initialAnswer := Utilities keyLike: ('var' translated, (usedNames size + 1) asString)  satisfying: [:aKey | (usedNames includes: aKey) not].
  
  	originalString := FillInTheBlank request: 'name for new variable: ' translated initialAnswer: initialAnswer.
  Cursor wait showWhile: [
  	originalString isEmptyOrNil ifTrue: [^ self].
  	itsName := ScriptingSystem acceptableSlotNameFrom: originalString forSlotCurrentlyNamed: nil asSlotNameIn: self world: self costume world.
  
   	itsName size == 0 ifTrue: [^ self].	
  	self assureUniClass.
+ 	typeChosen := (self askUserForNewTypeFor: itsName) ifNil: [#Number].
- 	typeChosen := self askUserForNewTypeFor: itsName.
  	self slotInfo at: itsName put: (SlotInformation new initialize type: typeChosen).
  	initialValue := self initialValueForSlotOfType: typeChosen.
  	self addInstanceVarNamed: itsName withValue: initialValue.
  	self compileInstVarAccessorsFor: itsName.
  	setterSelector := Utilities setterSelectorFor: itsName.
  	((self class allSubInstances copyWithout: self) reject: [:e | e isSequentialStub]) do:
  		[:anInstance | anInstance perform: setterSelector with: initialValue].
  	self regenerateScripts.
  	self updateAllViewersAndForceToShow: ScriptingSystem nameForInstanceVariablesCategory.
  ]!



More information about the etoys-dev mailing list