[squeak-dev] The Inbox: Kernel-hmm.441.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Apr 16 20:20:08 UTC 2010

A new version of Kernel was added to project The Inbox:

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

Name: Kernel-hmm.441
Author: hmm
Time: 16 April 2010, 10:19:20.499 pm
UUID: a3347ac6-2e2b-4deb-a8db-dd9c24d3e0f2
Ancestors: Kernel-cmm.440

Proposal: wrap the parsing action in CompiledMethod>>methodNode in a SyntaxErrorNotification error handling block to decompile methods which can't be parsed correctly.
OMeta2 and probably other domain specific languages benefit from this.

=============== Diff against Kernel-cmm.440 ===============

Item was changed:
  ----- Method: CompiledMethod>>methodNode (in category 'decompiling') -----
+ 	"Return the parse tree that represents self. If parsing fails, decompile the method."
- 	"Return the parse tree that represents self"
  	| aClass source |
  	aClass := self methodClass.
  	source := self
  				getSourceFor: (self selector ifNil: [self defaultSelector])
  				in: aClass.
+ 	^[(aClass parserClass new
- 	^(aClass parserClass new
  		encoderClass: (self isBlueBookCompiled
  						ifTrue: [EncoderForV3]
  						ifFalse: [EncoderForV3PlusClosures]);
  		parse: source class: aClass)
  			sourceText: source;
+ 			yourself]
+ 		on: SyntaxErrorNotification
+ 		do: [:ex | ex return: self decompile].!
- 			yourself!

More information about the Squeak-dev mailing list