[Pkg] SystemEditor: SystemEditor-mtf.108.mcz

squeaksource-noreply at iam.unibe.ch squeaksource-noreply at iam.unibe.ch
Wed Jul 23 12:19:21 UTC 2008


Matthew Fulmer uploaded a new version of SystemEditor to project SystemEditor:
http://www.squeaksource.com/SystemEditor/SystemEditor-mtf.108.mcz

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

Name: SystemEditor-mtf.108
Author: mtf
Time: 21 July 2008, 9:21:51 pm
UUID: fc9bf5a6-1650-47fd-a845-c0855f032438
Ancestors: SystemEditor-mtf.107

Make Syntax Error dialogs work correctly. Since SyntaxError loads stuff directly into the system, MethodDictionaries had to be installed into classes earlier than before

=============== Diff against SystemEditor-mtf.107 ===============

Item was added:
+ ----- Method: SystemEditorTest>>test10ValidatesBeforeCommitting (in category 'tests') -----
+ test10ValidatesBeforeCommitting
+ 	| classEditor |
+ 	classEditor := editor at: #EditorSubject.
+ 	classEditor typeOfClass: #bytes.
+ 	classEditor addInstVarName: 'test'.
+ 	self 
+ 		should: [editor commit]
+ 		raise: InvalidClassFormat!

Item was changed:
  ----- Method: MethodEditor>>compileFor: (in category 'building') -----
  compileFor: aClassEditor
+ [
  	| node method |
  	node := aClassEditor compilerClass new
  				compile: source
  				in: aClassEditor product
  				notifying: requestor
  				ifFail: nil.
  	node encoder requestor: self.
  	method := node generate: #(0 0 0 0).
  	method selector: node selector.
+ 	^ method
+ ] on: SyntaxErrorNotification do: [:ex |
+ 	"Let the user install the fixed code into the system"
+ 	ex defaultAction.
+ 	"Now fetch and use that code instead"
+ 	source := aClassEditor product sourceCodeAt: self selector ifAbsent: [^ nil].
+ 	^ aClassEditor product compiledMethodAt: self selector
+ ]!
- 	^ method!

Item was changed:
  ----- Method: ClassEditor>>edBuild (in category 'building') -----
  edBuild
  	| meta |
  	meta := self class edBuild.
  	product := subject ifNil: [meta new]
  				ifNotNil: [meta adoptInstance: subject from: subject class].
  	product
  		superclass: self edSuperclass;
  		setFormat: self format;
  		setName: self name;
  		setInstVarNames: self instVarNames;
  		classPoolFrom: self;
  		instVarNamed: #sharedPools put: self sharedPools;
  		organization: self organization build.
+ 	product methodDictionary: MethodDictionary new.
+ 	product class methodDictionary: MethodDictionary new.
  	self decoratorsDo: [:ea | ea buildFor: self].
+ 
+ 	"Class methods should be compiled before instance methods,
+ 	since #compilerClass may be among the class methods"
+ 	self class methods buildFor: self class.
+ 	self methods buildFor: self.
- 	product methodDictionary: self methodDictionary.
- 	product class methodDictionary: self class methodDictionary.
  	^product!

Item was changed:
  ----- Method: MethodDictionaryEditor>>buildFor: (in category 'editing') -----
  buildFor: aClassEditor
  	| result old |
+ 	result := aClassEditor product methodDictionary.
- 	result := MethodDictionary new.
  	self subject keysAndValuesDo:
  		[:selector :cm |
  		(self selectorIsModified: selector)
  			ifFalse: [result at: selector put: (self recompile: selector from: cm for: aClassEditor)]].
  	additions keysAndValuesDo: 
  		[:selector :mm | 
  		old := self subject at: selector ifAbsent: [nil]. 
  		result at: selector put: (mm compileFrom: old for: aClassEditor)].
  	^ result
  !

Item was changed:
  ----- Method: ClassEditor>>edSuperclass (in category 'building') -----
  edSuperclass
+ 	superEditor ifNotNil: [^ superEditor product].
+ 	subject ifNotNil: [^ subject superclass].
+ 	^ system edClassAt: #Object ifAbsent: [Object].
+ 		!
- 	^ superEditor
- 		ifNil: [subject superclass]
- 		ifNotNil: [superEditor product]
- 	!

Item was removed:
- ----- Method: SystemEditorTest>>test10ValidatesBeforeCommitting (in category 'tests') -----
- test10ValidatesBeforeCommitting
- 	| classEditor |
- 	classEditor := editor at: #EditorSubject.
- 	classEditor typeOfClass: #bytes.
- 	classEditor addInstVarName: 'test'.
- 	self 
- 		should: [editor commit]
- 		raise: InvalidClassFormat!



More information about the Packages mailing list