The Trunk: Compiler-mt.318.mcz

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

The Trunk: Compiler-mt.318.mcz

commits-2
Marcel Taeumel uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-mt.318.mcz

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

Name: Compiler-mt.318
Author: mt
Time: 17 February 2016, 6:03:57.27483 pm
UUID: 057a9bc7-ed1d-4461-9500-4da920216cfe
Ancestors: Compiler-eem.317

Allow models to get notified about parser or compiler errors while not supporting the interactive error correction protocol.

=============== Diff against Compiler-eem.317 ===============

Item was changed:
  ----- Method: Compiler>>interactive (in category 'private') -----
  interactive
+ "The compilation is interactive if there is a requestor and that requestor does either not care or explicitly allow interactive error correction."
+
+ ^ cue requestor notNil
+ and: [(cue requestor respondsTo: #wantsInteractiveErrorCorrection) not
+ or: [cue requestor perform: #wantsInteractiveErrorCorrection]]!
- "Answer true if compilation is interactive"
-
- ^ cue requestor notNil!

Item was changed:
  ----- Method: Parser>>interactive (in category 'error handling') -----
  interactive
+ "The compilation is interactive if there is a requestor and that requestor does either not care or explicitly allow interactive error correction."
- "Answer true if compilation is interactive"
 
+ ^ cue requestor notNil
+ and: [(cue requestor respondsTo: #wantsInteractiveErrorCorrection) not
+ or: [cue requestor perform: #wantsInteractiveErrorCorrection]]!
- ^ cue requestor notNil!

Item was changed:
  ----- Method: Parser>>parseCue:noPattern:ifFail: (in category 'public access') -----
  parseCue: aCue noPattern: noPattern ifFail: aBlock
  "Answer a MethodNode for the argument, sourceStream, that is the root of
  a parse tree. Parsing is done with respect to the CompilationCue to
  resolve variables. Errors in parsing are reported to the cue's requestor;
  otherwise aBlock is evaluated. The argument noPattern is a Boolean that is
  true if the the sourceStream does not contain a method header (i.e., for DoIts)."
 
  | methNode repeatNeeded myStream s p subSelection |
  myStream := aCue sourceStream.
  [repeatNeeded := false.
  p := myStream position.
  s := myStream upToEnd.
  myStream position: p.
+
- subSelection := aCue requestor notNil and: [aCue requestor selectionInterval = (p + 1 to: p + s size)].
  self encoder init: aCue notifying: self.
  self init: myStream cue: aCue failBlock: [^ aBlock value].
+
+ subSelection := self interactive and: [cue requestor selectionInterval = (p + 1 to: p + s size)].
+
  doitFlag := noPattern.
  failBlock:= aBlock.
  [methNode := self method: noPattern context: cue context]
  on: ReparseAfterSourceEditing
  do: [ :ex |
  repeatNeeded := true.
  properties := nil. "Avoid accumulating pragmas and primitives Number"
  myStream := ex newSource
  ifNil: [subSelection
  ifTrue:
  [ReadStream
  on: cue requestor text string
  from: cue requestor selectionInterval first
  to: cue requestor selectionInterval last]
  ifFalse:
  [ReadStream on: cue requestor text string]]
  ifNotNil: [:src | myStream := src readStream]].
  repeatNeeded] whileTrue:
  [encoder := self encoder class new].
  methNode sourceText: s.
  ^methNode
  !