The Inbox: OMeta2-Preload-yo.16.mcz

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

The Inbox: OMeta2-Preload-yo.16.mcz

commits-2
A new version of OMeta2-Preload was added to project The Inbox:
http://source.squeak.org/inbox/OMeta2-Preload-yo.16.mcz

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

Name: OMeta2-Preload-yo.16
Author: yo
Time: 18 August 2014, 11:36:30.173 am
UUID: e30e720f-ef1b-4b61-8809-8f6ba222dc22
Ancestors: OMeta2-Preload-yo.15

Remove methodNode, and also handle the error correctly in the requestor.

=============== Diff against OMeta2-Preload-yo.15 ===============

Item was removed:
- ----- Method: CompiledMethod>>methodNode (in category '*OMeta2-Preload') -----
- methodNode
- "Return the parse tree that represents self. If parsing fails, decompile the method."
- | aClass source |
- aClass := self methodClass.
- source := self
- getSourceFor: (self selector ifNil: [self defaultSelector])
- in: aClass.
- ^[(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].!

Item was changed:
  ----- Method: OMeta2Compiler>>compile:in:notifying:ifFail: (in category 'as yet unclassified') -----
  compile: origCode in: cls notifying: notify ifFail: failBlock
 
+ | origCodeStream parseTree structuredCode translatedCode c |
- | origCodeStream parseTree structuredCode translatedCode |
  origCodeStream := origCode asString readStream.
  [
  parseTree := OMeta2RuleParser matchStream: origCodeStream with: #rule withArgs: #() withPlaybackDebugging: false.
  parseTree := OMeta2Optimizer match: parseTree with: #optimizeRule.
  structuredCode := OMeta2RuleTranslator match: parseTree with: #translate withArgs: {cls}.
  translatedCode := OMeta2Flattener match: structuredCode with: #flatten
  ] on: OM2Fail do: [
+ c := CompilationCue
+ source: translatedCode
+ class: cls
+ requestor:  notify.
+ parser setCue: c.
+ parser notify: '<-- parse error around here -->' at: origCodeStream position.
- self notify: '<-- parse error around here -->' at: origCodeStream position.
  ^ failBlock value
  ].
  ^ super compile: translatedCode in: cls notifying: notify ifFail: failBlock.
  !