Skip to content

Commit

Permalink
#parse should not wrap in a doit, as clients might want to use the Co…
Browse files Browse the repository at this point in the history
…mpiler to just parse an expression
  • Loading branch information
MarcusDenker committed Nov 8, 2019
1 parent a893da6 commit b579d0f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/OpalCompiler-Core/OpalCompiler.class.st
Expand Up @@ -282,6 +282,7 @@ OpalCompiler >> compilationContextClass: aClass [
OpalCompiler >> compile [
| cm |
[ [ self parse.
self transformDoit.
self doSemanticAnalysis.
self callPlugins.
] on: ReparseAfterSourceEditing
Expand Down Expand Up @@ -672,16 +673,10 @@ OpalCompiler >> parse: textOrStream in: aClass notifying: req [

{ #category : #private }
OpalCompiler >> parseExpression [
| expression |

expression := self compilationContext optionParseErrors
^ast := self compilationContext optionParseErrors
ifTrue: [self parserClass parseFaultyExpression: source contents]
ifFalse: [self parserClass parseExpression: source contents].
ast := context
ifNil: [expression asDoit]
ifNotNil: [expression asDoitForContext: context].
ast compilationContext: self compilationContext.
^ast.
ifFalse: [self parserClass parseExpression: source contents]
]

{ #category : #'public access' }
Expand Down Expand Up @@ -739,6 +734,17 @@ OpalCompiler >> source: aString [
source := aString readStream.
]

{ #category : #'public access' }
OpalCompiler >> transformDoit [
"if we compile an expression, we wrap it in a method here"
self compilationContext noPattern ifFalse: [ ^self ].
ast := context
ifNil: [ast asDoit]
ifNotNil: [ast asDoitForContext: context].
ast compilationContext: self compilationContext.
^ast
]

{ #category : #'old - deprecated' }
OpalCompiler >> translate [
self
Expand Down

0 comments on commit b579d0f

Please sign in to comment.