forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OCLiteralVariable.class.st
107 lines (83 loc) · 1.92 KB
/
OCLiteralVariable.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
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
97
98
99
100
101
102
103
104
105
106
107
"
I am a global, pool, or class variable.
"
Class {
#name : #OCLiteralVariable,
#superclass : #OCAbstractVariable,
#instVars : [
'assoc'
],
#category : #'OpalCompiler-Core-Semantics'
}
{ #category : #accessing }
OCLiteralVariable class >> semanticNodeClass [
^RBGlobalNode
]
{ #category : #accessing }
OCLiteralVariable >> assoc [
^ assoc
]
{ #category : #initializing }
OCLiteralVariable >> assoc: anAssociation [
assoc := anAssociation
]
{ #category : #emitting }
OCLiteralVariable >> emitStore: methodBuilder [
assoc emitStore: methodBuilder
]
{ #category : #emitting }
OCLiteralVariable >> emitValue: methodBuilder [
assoc emitValue: methodBuilder
]
{ #category : #testing }
OCLiteralVariable >> isClassVariable [
^ assoc isClassVariable
]
{ #category : #testing }
OCLiteralVariable >> isFromSharedPool [
| sharedPools |
sharedPools := scope getClass instanceSide sharedPools.
^ sharedPools
detect: [ :pool | pool classVarNames includes: assoc key ]
ifFound: [ true ]
ifNone: [ false ]
]
{ #category : #testing }
OCLiteralVariable >> isGlobal [
^ true
]
{ #category : #testing }
OCLiteralVariable >> isGlobalClassNameBinding [
^ (self value isClass or: [ self value isTrait ])
and: [ self variable key == self value name ]
]
{ #category : #testing }
OCLiteralVariable >> isGlobalVariable [
^ assoc isGlobalVariable
]
{ #category : #testing }
OCLiteralVariable >> isLiteralVariable [
^true
]
{ #category : #testing }
OCLiteralVariable >> isWritable [
"Literal variables are writable, if they aren't global bindings for class names, like
#Object -> Object "
^ (self isGlobalVariable and: [ self isGlobalClassNameBinding ]) not
]
{ #category : #accessing }
OCLiteralVariable >> name [
^ assoc name
]
{ #category : #reading }
OCLiteralVariable >> read [
^ assoc read
]
{ #category : #accessing }
OCLiteralVariable >> value [
^assoc value
]
{ #category : #accessing }
OCLiteralVariable >> variable [
^assoc
]