Skip to content

Commit

Permalink
add a #compiler method to UndefinedObject. We use nil when compiling …
Browse files Browse the repository at this point in the history
…and parsing expressions, if we have this method, we can easily use the compiler that the class defines for syntax highlight and code completion (without needing to add an if to check for nil)
  • Loading branch information
MarcusDenker committed Nov 16, 2019
1 parent 3a0b722 commit 31a7b52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/NECompletion/CompletionContext.class.st
Expand Up @@ -136,12 +136,12 @@ CompletionContext >> node [

{ #category : #parsing }
CompletionContext >> parseSource [
ast := Smalltalk compiler
ast := class compiler
source: source;
noPattern: isWorkspace;
options: #(+ optionParseErrors + optionSkipSemanticWarnings);
options: #(+ optionParseErrors + optionSkipSemanticWarnings);
parse.
ast doSemanticAnalysisIn: class.
ast doSemanticAnalysis.
TypingVisitor new visitNode: ast
]

Expand Down
6 changes: 6 additions & 0 deletions src/OpalCompiler-Core/UndefinedObject.extension.st
Expand Up @@ -4,3 +4,9 @@ Extension { #name : #UndefinedObject }
UndefinedObject >> allTempNames [
^#()
]

{ #category : #'*OpalCompiler-Core' }
UndefinedObject >> compiler [
"nil is used as a class for when compiling expressions (for exampke DoIts)"
^Smalltalk compiler
]
4 changes: 2 additions & 2 deletions src/Shout/SHRBTextStyler.class.st
Expand Up @@ -971,13 +971,13 @@ SHRBTextStyler >> pixelHeight [
{ #category : #private }
SHRBTextStyler >> privateStyle: aText [
| ast |
ast := Smalltalk compiler
ast := classOrMetaClass compiler
source: aText;
noPattern: self isForWorkspace ;
options: #(+ optionParseErrors + optionSkipSemanticWarnings);
requestor: workspace;
parse.
ast doSemanticAnalysisIn: classOrMetaClass.
ast doSemanticAnalysis.
^ self style: aText ast: ast
]
Expand Down

0 comments on commit 31a7b52

Please sign in to comment.