1264
|
1 |
"{ Package: 'stx:libcomp' }"
|
|
2 |
|
|
3 |
Object variableSubclass:#Reference
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Kernel-Methods'
|
|
8 |
!
|
|
9 |
|
|
10 |
Reference variableSubclass:#ContextVariableReference
|
|
11 |
instanceVariableNames:'context index'
|
|
12 |
classVariableNames:''
|
|
13 |
poolDictionaries:''
|
|
14 |
privateIn:Reference
|
|
15 |
!
|
|
16 |
|
|
17 |
Reference::ContextVariableReference variableSubclass:#ArgumentReference
|
|
18 |
instanceVariableNames:''
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
privateIn:Reference
|
|
22 |
!
|
|
23 |
|
|
24 |
Reference::ContextVariableReference variableSubclass:#LocalVariableReference
|
|
25 |
instanceVariableNames:''
|
|
26 |
classVariableNames:''
|
|
27 |
poolDictionaries:''
|
|
28 |
privateIn:Reference
|
|
29 |
!
|
|
30 |
|
|
31 |
!Reference class methodsFor:'documentation'!
|
|
32 |
|
|
33 |
example1
|
|
34 |
|foo ref|
|
|
35 |
|
|
36 |
ref := Reference forLocal:1 in:thisContext.
|
|
37 |
ref inspect
|
|
38 |
|
|
39 |
"
|
|
40 |
self example1
|
|
41 |
"
|
|
42 |
!
|
|
43 |
|
|
44 |
example2
|
|
45 |
"/ |foo ref|
|
|
46 |
"/
|
|
47 |
"/ foo := 123.
|
|
48 |
"/ ref := &foo.
|
|
49 |
"/ ref inspect
|
|
50 |
|
|
51 |
"
|
|
52 |
self example2
|
|
53 |
"
|
|
54 |
! !
|
|
55 |
|
|
56 |
!Reference class methodsFor:'instance creation'!
|
|
57 |
|
|
58 |
forArgument:argIndex in:aContext
|
|
59 |
^ ArgumentReference new
|
|
60 |
context:aContext index:argIndex
|
|
61 |
!
|
|
62 |
|
|
63 |
forLocal:varIndex in:aContext
|
|
64 |
^ LocalVariableReference new
|
|
65 |
context:aContext index:varIndex
|
|
66 |
! !
|
|
67 |
|
|
68 |
!Reference::ContextVariableReference methodsFor:'accessing'!
|
|
69 |
|
|
70 |
context:contextArg index:indexArg
|
|
71 |
context := contextArg.
|
|
72 |
index := indexArg.
|
|
73 |
! !
|
|
74 |
|
|
75 |
!Reference::ArgumentReference methodsFor:'accessing'!
|
|
76 |
|
|
77 |
value
|
|
78 |
^ context argAt:index
|
|
79 |
!
|
|
80 |
|
|
81 |
value:newValue
|
|
82 |
self error:'write into argument ref'.
|
|
83 |
^ newValue
|
|
84 |
! !
|
|
85 |
|
|
86 |
!Reference::LocalVariableReference methodsFor:'accessing'!
|
|
87 |
|
|
88 |
value
|
|
89 |
^ context varAt:index
|
|
90 |
!
|
|
91 |
|
|
92 |
value:newValue
|
|
93 |
^ context varAt:index put:newValue
|
|
94 |
! !
|
|
95 |
|