author | Claus Gittinger <cg@exept.de> |
Tue, 16 Apr 1996 11:27:45 +0200 | |
changeset 1181 | 6637fee79d7b |
parent 920 | 006dded1f4e6 |
child 1254 | 48c2748b5197 |
permissions | -rw-r--r-- |
156 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
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 |
||
13 |
Block subclass:#CheapBlock |
|
1181
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
14 |
instanceVariableNames:'selfValue method' |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
15 |
classVariableNames:'' |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
16 |
poolDictionaries:'' |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
17 |
category:'Kernel-Methods' |
156 | 18 |
! |
19 |
||
20 |
!CheapBlock class methodsFor:'documentation'! |
|
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
222 | 38 |
CheapBlocks are blocks which do not need their home-context |
39 |
(i.e. blocks that do not access any method arguments or method locals). |
|
156 | 40 |
Since they have no reference to the home, they must store their |
41 |
creating method explicitely - otherwise, the system had no chance of |
|
42 |
finding the source-position of the block. |
|
43 |
||
44 |
Instance variables: |
|
45 |
||
222 | 46 |
selfValue <Object> value to use for self if its a copying block |
47 |
||
48 |
method <Method> method where block was created |
|
156 | 49 |
|
50 |
NOTICE: layout known by runtime system and compiler - do not change |
|
51 |
" |
|
1181
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
52 |
! ! |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
53 |
|
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
54 |
!CheapBlock class methodsFor:'queries'! |
623 | 55 |
|
1181
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
56 |
isBuiltInClass |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
57 |
"this class is known by the run-time-system" |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
58 |
|
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
59 |
^ self == CheapBlock |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
60 |
|
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
61 |
"Created: 16.4.1996 / 11:25:23 / cg" |
156 | 62 |
! ! |
63 |
||
64 |
!CheapBlock methodsFor:'accessing'! |
|
65 |
||
161 | 66 |
method |
213 | 67 |
"return the receivers home method. |
161 | 68 |
Thats the method where the block was created." |
69 |
||
70 |
^ method |
|
623 | 71 |
! |
72 |
||
73 |
selfValue |
|
74 |
"return the copied self" |
|
75 |
||
76 |
^ selfValue |
|
156 | 77 |
! ! |
78 |
||
79 |
!CheapBlock methodsFor:'printing & storing'! |
|
80 |
||
81 |
printOn:aStream |
|
82 |
"append a a printed representation of the block to aStream" |
|
83 |
||
84 |
|class selector pair| |
|
85 |
||
86 |
" |
|
87 |
cheap blocks have no home context, but a method instead |
|
88 |
" |
|
89 |
||
90 |
aStream nextPutAll:'[] in '. |
|
91 |
" |
|
92 |
find out, for which class this method was for ... |
|
93 |
" |
|
94 |
method notNil ifTrue:[ |
|
95 |
pair := method who. |
|
96 |
pair notNil ifTrue:[ |
|
97 |
class := pair at:1. |
|
98 |
selector := pair at:2. |
|
99 |
aStream nextPutAll:(class name , '-' , selector). |
|
100 |
aStream nextPutAll:' (optimized)'. |
|
101 |
^ self |
|
102 |
]. |
|
103 |
]. |
|
104 |
" |
|
105 |
currently, some cheap blocks don't know where they have been created |
|
106 |
" |
|
107 |
aStream nextPutAll:' ??? (optimized)'. |
|
108 |
^ self |
|
109 |
! ! |
|
1181
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
110 |
|
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
111 |
!CheapBlock class methodsFor:'documentation'! |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
112 |
|
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
113 |
version |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
114 |
^ '$Header: /cvs/stx/stx/libbasic/CheapBlock.st,v 1.11 1996-04-16 09:27:45 cg Exp $' |
6637fee79d7b
only Block & CheapBlock are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
115 |
! ! |