-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathSpCodeScriptingInteractionModel.class.st
74 lines (54 loc) · 1.57 KB
/
SpCodeScriptingInteractionModel.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
Class {
#name : 'SpCodeScriptingInteractionModel',
#superclass : 'SpCodeInteractionModel',
#instVars : [
'bindings'
],
#category : 'Spec2-Code-Base',
#package : 'Spec2-Code',
#tag : 'Base'
}
{ #category : 'accessing' }
SpCodeScriptingInteractionModel >> addBinding: aBinding [
self bindings add: aBinding
]
{ #category : 'binding' }
SpCodeScriptingInteractionModel >> bindingOf: aString [
"if there is no binding, I will include a key"
(self bindings includesKey: aString)
ifFalse: [ self addBinding: (WorkspaceVariable key: aString asSymbol) ].
^ self bindings associationAt: aString
]
{ #category : 'accessing' }
SpCodeScriptingInteractionModel >> bindings [
^ bindings ifNil: [ bindings := Dictionary new ]
]
{ #category : 'testing' }
SpCodeScriptingInteractionModel >> canAddBindingOf: name [
"Check is a special variable named `name` can be declared but without declaring it."
^ name first isUppercase not.
]
{ #category : 'testing' }
SpCodeScriptingInteractionModel >> hasBindingOf: aString [
^ self bindings includesKey: aString asSymbol
]
{ #category : 'testing' }
SpCodeScriptingInteractionModel >> isScripting [
^ true
]
{ #category : 'testing' }
SpCodeScriptingInteractionModel >> needRequestorScope [
^true
]
{ #category : 'accessing' }
SpCodeScriptingInteractionModel >> removeAllBindings [
self bindings removeAll
]
{ #category : 'accessing' }
SpCodeScriptingInteractionModel >> removeBinding: aBinding [
self bindings removeKey: aBinding key
]
{ #category : 'accessing' }
SpCodeScriptingInteractionModel >> variableBindings [
^ self bindings
]