1450
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
1264
|
13 |
"{ Package: 'stx:libcomp' }"
|
|
14 |
|
|
15 |
Object variableSubclass:#Reference
|
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Kernel-Methods'
|
|
20 |
!
|
|
21 |
|
|
22 |
Reference variableSubclass:#ContextVariableReference
|
|
23 |
instanceVariableNames:'context index'
|
|
24 |
classVariableNames:''
|
|
25 |
poolDictionaries:''
|
|
26 |
privateIn:Reference
|
|
27 |
!
|
|
28 |
|
|
29 |
Reference::ContextVariableReference variableSubclass:#ArgumentReference
|
|
30 |
instanceVariableNames:''
|
|
31 |
classVariableNames:''
|
|
32 |
poolDictionaries:''
|
|
33 |
privateIn:Reference
|
|
34 |
!
|
|
35 |
|
|
36 |
Reference::ContextVariableReference variableSubclass:#LocalVariableReference
|
|
37 |
instanceVariableNames:''
|
|
38 |
classVariableNames:''
|
|
39 |
poolDictionaries:''
|
|
40 |
privateIn:Reference
|
|
41 |
!
|
|
42 |
|
|
43 |
!Reference class methodsFor:'documentation'!
|
|
44 |
|
1450
|
45 |
copyright
|
|
46 |
"
|
|
47 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
48 |
All Rights Reserved
|
|
49 |
|
|
50 |
This software is furnished under a license and may be used
|
|
51 |
only in accordance with the terms of that license and with the
|
|
52 |
inclusion of the above copyright notice. This software may not
|
|
53 |
be provided or otherwise made available to, or used by, any
|
|
54 |
other person. No title to or ownership of the software is
|
|
55 |
hereby transferred.
|
|
56 |
"
|
|
57 |
!
|
|
58 |
|
1264
|
59 |
example1
|
|
60 |
|foo ref|
|
|
61 |
|
|
62 |
ref := Reference forLocal:1 in:thisContext.
|
|
63 |
ref inspect
|
|
64 |
|
|
65 |
"
|
|
66 |
self example1
|
|
67 |
"
|
|
68 |
!
|
|
69 |
|
|
70 |
example2
|
|
71 |
"/ |foo ref|
|
|
72 |
"/
|
|
73 |
"/ foo := 123.
|
|
74 |
"/ ref := &foo.
|
|
75 |
"/ ref inspect
|
|
76 |
|
|
77 |
"
|
|
78 |
self example2
|
|
79 |
"
|
|
80 |
! !
|
|
81 |
|
|
82 |
!Reference class methodsFor:'instance creation'!
|
|
83 |
|
|
84 |
forArgument:argIndex in:aContext
|
|
85 |
^ ArgumentReference new
|
|
86 |
context:aContext index:argIndex
|
|
87 |
!
|
|
88 |
|
|
89 |
forLocal:varIndex in:aContext
|
|
90 |
^ LocalVariableReference new
|
|
91 |
context:aContext index:varIndex
|
|
92 |
! !
|
|
93 |
|
|
94 |
!Reference::ContextVariableReference methodsFor:'accessing'!
|
|
95 |
|
|
96 |
context:contextArg index:indexArg
|
|
97 |
context := contextArg.
|
|
98 |
index := indexArg.
|
|
99 |
! !
|
|
100 |
|
|
101 |
!Reference::ArgumentReference methodsFor:'accessing'!
|
|
102 |
|
|
103 |
value
|
|
104 |
^ context argAt:index
|
|
105 |
!
|
|
106 |
|
|
107 |
value:newValue
|
|
108 |
self error:'write into argument ref'.
|
|
109 |
^ newValue
|
|
110 |
! !
|
|
111 |
|
|
112 |
!Reference::LocalVariableReference methodsFor:'accessing'!
|
|
113 |
|
|
114 |
value
|
|
115 |
^ context varAt:index
|
|
116 |
!
|
|
117 |
|
|
118 |
value:newValue
|
|
119 |
^ context varAt:index put:newValue
|
|
120 |
! !
|
|
121 |
|
1450
|
122 |
!Reference class methodsFor:'documentation'!
|
|
123 |
|
|
124 |
version
|
|
125 |
^ '$Header: /cvs/stx/stx/libcomp/Reference.st,v 1.3 2003-08-29 19:21:52 cg Exp $'
|
|
126 |
! !
|