The Trunk: Kernel-ar.446.mcz

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

The Trunk: Kernel-ar.446.mcz

commits-2
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.446.mcz

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

Name: Kernel-ar.446
Author: ar
Time: 21 April 2010, 8:53:39.616 pm
UUID: 8677fe4e-dc64-b449-b45d-46674a51961a
Ancestors: Kernel-nice.445, Kernel-hmm.441

Merging Kernel-hmm.441:

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-nice.445 ===============

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!