-
Notifications
You must be signed in to change notification settings - Fork 58
/
PreBoot.st
96 lines (86 loc) · 2.82 KB
/
PreBoot.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Kernel.Compiler addClassVariable: 'CompilerImplementation' value: nil!
!Kernel.CompilerLibrary class methodsFor!
compileForEvaluation: aString in: aBehaviorOrNil environment: aNamespaceOrNil evaluationPools: anArray flags: anInteger
| results expression source |
source := aString asUtf8String.
results := self default
compileForEvaluation: self
source: source
length: source size
in: aBehaviorOrNil
environment: aNamespaceOrNil
evaluationPools: anArray
flags: anInteger
notifying: self.
expression := results first.
results := CompilationResult
method: expression
rawTextMap: results second
rawTempsMap: results third
flags: anInteger.
expression notNil
ifTrue:
[aBehaviorOrNil ifNotNil: [expression methodClass: aBehaviorOrNil].
expression
storeSourceString: source evaluationPools: anArray;
beImmutableObject].
^results!
compileForMethod: aString in: aClass environment: aNamespaceOrNil flags: anInteger
| results source |
source := aString asUtf8String.
results := self default
compile: self
source: source
length: source size
in: aClass
environment: aNamespaceOrNil
flags: anInteger
notifying: self.
^CompilationResult
method: results first
rawTextMap: results second
rawTempsMap: results third
flags: anInteger! !
!Kernel.Compiler class methodsFor!
compilerImplementation
^CompilerImplementation ?? CompilerLibrary!
compileForEvaluation: aString in: aBehaviorOrNil environment: aNamespaceOrNil evaluationPools: anArray flags: anInteger
^self compilerImplementation
compileForEvaluation: aString
in: aBehaviorOrNil
environment: aNamespaceOrNil
evaluationPools: anArray
flags: anInteger!
compileForMethod: aString in: aClass environment: aNamespaceOrNil flags: anInteger
^self compilerImplementation
compileForMethod: aString
in: aClass
environment: aNamespaceOrNil
flags: anInteger! !
!Kernel.CompilerLibrary class methodsFor!
compilerNotification: aCompilerNotification
self error: aCompilerNotification displayString!
notificationCallback: anArray
| errorCode offset sourceText lineNumber errorStart errorStop selector methodClass extras notified |
errorCode := anArray first.
lineNumber := anArray at: 2.
errorStart := anArray at: 3.
errorStop := anArray at: 4.
"The offset must be added to the error range to get the actual interval in the source text"
offset := anArray at: 5.
sourceText := anArray at: 6.
selector := anArray at: 7.
methodClass := anArray at: 8.
notified := anArray at: 9.
extras := anArray at: 10 ifAbsent: #().
^notified compilerNotification: ((CompilerNotification
code: errorCode
in: sourceText
for: methodClass
selector: selector
position: errorStart + 1
line: lineNumber
range: (errorStart to: errorStop) + 1
extras: extras)
offset: offset;
yourself)! !