-
-
Notifications
You must be signed in to change notification settings - Fork 346
/
TemporaryVariable.class.st
44 lines (36 loc) · 1.03 KB
/
TemporaryVariable.class.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
"
I model temp variables. With Closures, there are two kinds: Copying and those that are stored in a so called temp vector, a heap allocated array that itself is stored in a copying temp variable.
"
Class {
#name : #TemporaryVariable,
#superclass : #LocalVariable,
#category : #'OpalCompiler-Core-Semantics'
}
{ #category : #accessing }
TemporaryVariable class >> semanticNodeClass [
^RBTemporaryNode
]
{ #category : #accessing }
TemporaryVariable >> copiedVarClass [
^OCCopyingTempVariable
]
{ #category : #queries }
TemporaryVariable >> definingNode [
^ scope node temporaries
detect: [ :each | each name = name ]
ifNone: [
" ugly workaround to support temps defined by primitives"
| pragma |
pragma := scope node methodNode pragmas detect: [ :each | each isPrimitiveError ].
pragma ifNil: [ ^nil ].
^ RBVariableNode named: (pragma argumentAt: #error:) value asString
]
]
{ #category : #testing }
TemporaryVariable >> isTemp [
^ true
]
{ #category : #testing }
TemporaryVariable >> isTemporaryVariable [
^ true
]