The Inbox: Kernel-hmm.441.mcz

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

The Inbox: Kernel-hmm.441.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-hmm.441.mcz

==================== 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') -----
  methodNode
+ "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!