forked from pharo-project/pharo
/
OCEnvironmentScope.class.st
48 lines (38 loc) · 1.06 KB
/
OCEnvironmentScope.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
"
I am the glonal environment. The default is Smalltalk globals
"
Class {
#name : #OCEnvironmentScope,
#superclass : #OCAbstractScope,
#instVars : [
'environment'
],
#category : #'OpalCompiler-Core-Semantics'
}
{ #category : #'instance creation' }
OCEnvironmentScope class >> for: anEnvironment [
^self new environment: anEnvironment
]
{ #category : #accessing }
OCEnvironmentScope >> environment [
^environment
]
{ #category : #accessing }
OCEnvironmentScope >> environment: aCollection [
environment := aCollection
]
{ #category : #lookup }
OCEnvironmentScope >> hasBindingThatBeginsWith: aString [
"check weather there are any bindings defined in the environment that start with aString"
^environment hasBindingThatBeginsWith: aString
]
{ #category : #lookup }
OCEnvironmentScope >> lookupVar: name [
"Return a var with this name. Return nil if none found"
name isString ifFalse: [ ^nil ].
^environment bindingOf: name
]
{ #category : #creation }
OCEnvironmentScope >> newClassScope: aClass [
^ (OCClassScope for: aClass) outerScope: self; yourself
]