VariableNode.st
author Claus Gittinger <cg@exept.de>
Mon, 09 Oct 2000 12:42:06 +0200
changeset 1092 77de350f525c
parent 1088 029b67b39d1b
child 1101 84db57980ac5
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     1
"
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
53
c5dd7abf8431 *** empty log message ***
claus
parents: 31
diff changeset
     3
	      All Rights Reserved
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     4
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    11
"
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    12
1076
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
    13
"{ Package: 'stx:libcomp' }"
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
    14
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    15
PrimaryNode subclass:#VariableNode
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    16
	instanceVariableNames:'name token index block'
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
    17
	classVariableNames:''
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
    18
	poolDictionaries:''
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
    19
	category:'System-Compiler-Support'
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    20
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    21
360
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    22
!VariableNode class methodsFor:'documentation'!
20
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    23
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    24
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    25
"
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    26
 COPYRIGHT (c) 1994 by Claus Gittinger
53
c5dd7abf8431 *** empty log message ***
claus
parents: 31
diff changeset
    27
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    28
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    29
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    30
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    32
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    33
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    34
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    35
"
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    36
!
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    37
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    38
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    39
"
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    40
    node for parse-trees, representing variables
261
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    41
    This is a helper class for the compiler.
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    42
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    43
    [author:]
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    44
        Claus Gittinger
20
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    45
"
f8dd8ba75205 *** empty log message ***
claus
parents: 14
diff changeset
    46
! !
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    47
360
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    48
!VariableNode class methodsFor:'instance creation'!
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    49
98
claus
parents: 53
diff changeset
    50
type:t class:class name:n
claus
parents: 53
diff changeset
    51
    ^ (self basicNew) type:t class:class name:n
claus
parents: 53
diff changeset
    52
!
claus
parents: 53
diff changeset
    53
642
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
    54
type:t context:aContext
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
    55
    ^ (self basicNew) type:t context:aContext
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    56
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    57
    "Created: / 17.1.1998 / 04:00:35 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    58
!
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    59
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
    60
type:t holder:holder name:n
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
    61
    ^ (self basicNew) type:t holder:holder name:n
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
    62
!
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
    63
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    64
type:t name:n
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    65
    ^ (self basicNew) type:t name:n
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    66
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    67
642
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
    68
type:t name:n context:aContext index:i
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
    69
    ^ (self basicNew) type:t name:n context:aContext index:i
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    70
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    71
    "Created: / 17.1.1998 / 02:40:32 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    72
!
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    73
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    74
type:t name:n index:i selfClass:s
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    75
    ^ (self basicNew) type:t name:n index:i selfClass:s
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    76
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    77
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    78
type:t name:n index:i selfValue:s
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    79
    ^ (self basicNew) type:t name:n index:i selfValue:s
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    80
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    81
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    82
type:t name:n token:tok index:i
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    83
    ^ (self basicNew) type:t name:n token:tok index:i
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    84
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    85
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    86
type:t name:n token:tok index:i block:b from:codeBlock
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    87
    ^ (self basicNew) type:t name:n token:tok index:i block:b from:codeBlock
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    88
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    89
    "Modified: 2.7.1997 / 10:55:48 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    90
! !
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    91
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    92
!VariableNode methodsFor:'accessing'!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
    93
577
efda2402cd70 oops - more fixes
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    94
block
efda2402cd70 oops - more fixes
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    95
    ^ block
efda2402cd70 oops - more fixes
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    96
efda2402cd70 oops - more fixes
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    97
    "Created: 2.7.1997 / 18:53:38 / cg"
efda2402cd70 oops - more fixes
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    98
!
efda2402cd70 oops - more fixes
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    99
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   100
index
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   101
    ^ index
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   102
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   103
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   104
name
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   105
    ^ name
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   106
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   107
875
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   108
token
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   109
    ^ token
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   110
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   111
    "Created: 2.7.1997 / 18:53:38 / cg"
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   112
!
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   113
869
c483b1e6a0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   114
type
c483b1e6a0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   115
    ^ type
c483b1e6a0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   116
!
c483b1e6a0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   117
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   118
type:t class:class name:n
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   119
    type := t.
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   120
    name := n.
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   121
    value := class
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   122
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   123
    "Modified: / 17.1.1998 / 04:03:55 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   124
!
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   125
642
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
   126
type:t context:aContext
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   127
    type := t.
642
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
   128
    value := aContext.
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   129
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   130
    "Modified: / 17.1.1998 / 04:01:55 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   131
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   132
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   133
type:t holder:holder name:n
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   134
    type := t.
875
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   135
    token := holder.
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   136
    name := n
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   137
!
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   138
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   139
type:t name:n
98
claus
parents: 53
diff changeset
   140
    type := t.
claus
parents: 53
diff changeset
   141
    value := nil.
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   142
    name := n
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   143
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   144
642
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
   145
type:t name:n context:aContext index:i
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   146
    type := t.
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   147
    index := i.
642
de97c93c4f49 renamed con to aContext - stc has problems with it.
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
   148
    value := aContext.
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   149
    name := n
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   150
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   151
    "Created: / 17.1.1998 / 02:40:55 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   152
    "Modified: / 17.1.1998 / 04:01:21 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   153
!
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   154
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   155
type:t name:n index:i selfClass:s
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   156
    type := t.
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   157
    index := i.
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   158
    value := s.
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   159
    name := n
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   160
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   161
    "Modified: / 17.1.1998 / 04:04:04 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   162
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   163
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   164
type:t name:n index:i selfValue:s
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   165
    type := t.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   166
    index := i.
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   167
    value := s.
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   168
    name := n
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   169
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   170
    "Modified: / 17.1.1998 / 04:02:58 / cg"
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   171
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   172
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   173
type:t name:n token:tok index:i
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   174
    type := t.
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   175
    index := i.
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   176
    token := tok.
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   177
    name := n
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   178
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   179
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   180
type:t name:n token:tok index:i block:variableBlock from:codeBlock
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   181
    type := t.
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   182
    index := i.
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   183
    block := variableBlock.
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   184
    token := tok.
535
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   185
    name := n.
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   186
    (type == #BlockArg) ifTrue:[
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   187
        variableBlock blockArgAccessed:true.
535
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   188
    ].
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   189
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   190
    codeBlock ~~ variableBlock ifTrue:[
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   191
        codeBlock rememberOuterBlockVarAccess:self
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   192
    ]
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   193
574
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   194
    "Created: 2.7.1997 / 10:54:50 / cg"
993d1182782b fixed inlining of blocks where subBlocks
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   195
    "Modified: 2.7.1997 / 11:12:58 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   196
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   197
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   198
type:t token:tok index:i block:b
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   199
    type := t.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   200
    index := i.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   201
    block := b.
535
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   202
    token := tok.
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   203
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   204
    (type == #BlockArg) ifTrue:[
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   205
        b blockArgAccessed:true.
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   206
    ].
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   207
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   208
    "Modified: 18.6.1997 / 11:41:05 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   209
! !
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   210
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   211
!VariableNode methodsFor:'code generation'!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   212
104
claus
parents: 103
diff changeset
   213
codeForSideEffectOn:aStream inBlock:b for:aCompiler
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   214
    "no code at all"
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   215
    ^ self
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   216
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   217
843
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   218
codeForSimpleReturnOn:aStream inBlock:b lineNumber:lineNrOrNil for:aCompiler
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   219
    |code|
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   220
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   221
    lineNrOrNil notNil ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   222
        self codeLineNumber:lineNrOrNil on:aStream for:aCompiler
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   223
    ].
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   224
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   225
    (type == #InstanceVariable) ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   226
        (index <= 8) ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   227
            code := #( retInstVar1
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   228
                       retInstVar2
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   229
                       retInstVar3
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   230
                       retInstVar4
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   231
                       retInstVar5
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   232
                       retInstVar6
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   233
                       retInstVar7
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   234
                       retInstVar8) at:index.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   235
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   236
            aStream nextPut:code.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   237
            ^ self
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   238
        ].
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   239
    ].
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   240
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   241
    (type == #MethodVariable) ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   242
        (index <= 6) ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   243
            code := #( retMethodVar1
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   244
                       retMethodVar2
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   245
                       retMethodVar3
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   246
                       retMethodVar4
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   247
                       retMethodVar5
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   248
                       retMethodVar6) at:index.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   249
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   250
            aStream nextPut:code.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   251
            ^ self
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   252
        ].
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   253
    ].
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   254
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   255
    (type == #MethodArg) ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   256
        (index <= 2) ifTrue:[
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   257
            code := #(retMethodArg1
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   258
                      retMethodArg2) at:index.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   259
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   260
            aStream nextPut:code.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   261
            ^ self
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   262
        ]
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   263
    ].
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   264
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   265
    "/ anything else must be pushed, then top rturned
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   266
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   267
    self codeOn:aStream inBlock:b for:aCompiler.
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   268
    aStream nextPut:#retTop
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   269
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   270
!
522c116f86d9 boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   271
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   272
codeLoadOn:aStream type:type index:index inBlock:codeBlock for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   273
    |theCode b deltaLevel litIndex specialGlobalIndex
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   274
     bvIdx bvTyp blocksCode selLitIdx |
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   275
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   276
    (type == #MethodArg) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   277
        (index <= 4) ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   278
            aStream nextPut:(#(pushMethodArg1
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   279
                               pushMethodArg2
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   280
                               pushMethodArg3 
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   281
                               pushMethodArg4) at:index).
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   282
            ^ self
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   283
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   284
        aStream nextPut:#pushMethodArg; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   285
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   286
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   287
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   288
    (type == #MethodVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   289
        (index <= 6) ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   290
            aStream nextPut:(#(pushMethodVar1
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   291
                               pushMethodVar2
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   292
                               pushMethodVar3
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   293
                               pushMethodVar4
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   294
                               pushMethodVar5
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   295
                               pushMethodVar6) at:index).
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   296
            ^ self
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   297
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   298
        aStream nextPut:#pushMethodVar; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   299
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   300
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   301
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   302
    (type == #InstanceVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   303
        (index <= 10) ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   304
            theCode := #(pushInstVar1 pushInstVar2 pushInstVar3
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   305
                         pushInstVar4 pushInstVar5 pushInstVar6
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   306
                         pushInstVar7 pushInstVar8 pushInstVar9
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   307
                         pushInstVar10) at:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   308
            aStream nextPut:theCode.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   309
            ^ self
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   310
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   311
        aStream nextPut:#pushInstVar; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   312
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   313
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   314
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   315
    ((type == #BlockArg) 
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   316
    or:[type == #BlockVariable]) ifTrue:[
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   317
        "/ compiling for codeBlock; accessing variable in block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   318
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   319
        bvIdx := index.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   320
        bvTyp := type.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   321
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   322
        "/ find the context where that variable is contained physically
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   323
        blocksCode := block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   324
        [blocksCode notNil and:[blocksCode isInlineBlock]] whileTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   325
            blocksCode := blocksCode home
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   326
        ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   327
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   328
        "/ find deltaLevel from code-context to the containing block
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   329
        b := codeBlock.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   330
        deltaLevel := 0.
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   331
        [b notNil and:[b ~~ blocksCode]] whileTrue:[
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   332
            b isInlineBlock ifFalse:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   333
                deltaLevel := deltaLevel + 1
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   334
            ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   335
            b := b home
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   336
        ].
535
713142116e40 remember access to blockArgs
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   337
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   338
        b isNil ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   339
            codeBlock isNil ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   340
                "/ a var of a block which is inlined in the method. 
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   341
                "/ Generate a pushMVAR
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   342
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   343
                bvIdx := block indexOfFirstTemp + index - 1.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   344
                type == #BlockVariable ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   345
                    bvIdx := bvIdx + block numArgs
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   346
                ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   347
                ^ self 
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   348
                    codeLoadOn:aStream
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   349
                    type:#MethodVariable
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   350
                    index:bvIdx
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   351
                    inBlock:codeBlock
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   352
                    for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   353
            ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   354
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   355
            "/ a var of a block which is inlined in the outer block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   356
            "/ Generate a pushBVAR
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   357
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   358
            bvIdx := block indexOfFirstTemp + index - 1.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   359
            type == #BlockVariable ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   360
                bvIdx := bvIdx + block numArgs
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   361
            ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   362
            bvTyp := #BlockVariable.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   363
        ] ifFalse:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   364
            block isInlineBlock ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   365
                "/ a var of a block which is inlined in another block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   366
                "/ Generate a pushBVAR / pushOuterBVAR
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   367
                bvIdx := block indexOfFirstTemp + index - 1.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   368
                type == #BlockVariable ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   369
                    bvIdx := bvIdx + block numArgs
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   370
                ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   371
                bvTyp := #BlockVariable.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   372
            ]
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   373
        ].
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   374
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   375
        (bvTyp == #BlockVariable) ifTrue:[
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   376
            (deltaLevel == 0) ifTrue:[
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   377
                bvIdx <= 3 ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   378
                    aStream nextPut:(#(pushBlockVar1 pushBlockVar2 pushBlockVar3) at:bvIdx).
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   379
                    ^ self
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   380
                ].
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   381
                aStream nextPut:#pushBlockVar.
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   382
            ] ifFalse:[
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   383
                aStream nextPut:#pushOuterBlockVar; nextPut:deltaLevel.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   384
            ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   385
        ] ifFalse:[
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   386
            (deltaLevel == 0) ifTrue:[
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   387
                (bvIdx <= 4) ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   388
                    aStream nextPut:(#(pushBlockArg1 pushBlockArg2 pushBlockArg3
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   389
                                       pushBlockArg4) at:bvIdx).
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   390
                    ^ self
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   391
                ].
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   392
                aStream nextPut:#pushBlockArg.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   393
            ] ifFalse:[
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   394
                (deltaLevel == 1) ifTrue:[
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   395
                    aStream nextPut:#pushOuter1BlockArg
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   396
                ] ifFalse:[
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   397
                    (deltaLevel == 2) ifTrue:[
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   398
                        aStream nextPut:#pushOuter2BlockArg
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   399
                    ] ifFalse:[
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   400
                        aStream nextPut:#pushOuterBlockArg; nextPut:deltaLevel
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   401
                    ]
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   402
                ].
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   403
            ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   404
        ].
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   405
        aStream nextPut:bvIdx.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   406
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   407
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   408
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   409
    (type == #GlobalVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   410
        litIndex := aCompiler addLiteral:name asSymbol.
531
1d037c37e5a2 code cleanup
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   411
        specialGlobalIndex := aCompiler specialGlobalCodeFor:name.
1d037c37e5a2 code cleanup
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   412
        specialGlobalIndex notNil ifTrue:[
1d037c37e5a2 code cleanup
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   413
            aStream nextPut:#pushSpecialGlobal; nextPut:specialGlobalIndex.
243
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   414
            ^ self
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   415
        ].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   416
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   417
        litIndex < 256 ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   418
            aStream nextPut:#pushGlobalS; nextPut:litIndex
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   419
        ] ifFalse:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   420
            aStream nextPut:#pushGlobalL; nextPut:litIndex; nextPut:0
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   421
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   422
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   423
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   424
360
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   425
    (type == #ClassVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   426
        litIndex := aCompiler addLiteral:(value name , ':' , name) asSymbol.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   427
        litIndex < 256 ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   428
            aStream nextPut:#pushClassVarS; nextPut:litIndex
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   429
        ] ifFalse:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   430
            aStream nextPut:#pushClassVarL; nextPut:litIndex; nextPut:0
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   431
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   432
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   433
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   434
360
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   435
    (type == #PrivateClass) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   436
        litIndex := aCompiler addLiteral:(value name , '::' , name) asSymbol.
360
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   437
        litIndex < 256 ifTrue:[
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   438
            aStream nextPut:#pushGlobalS; nextPut:litIndex
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   439
        ] ifFalse:[
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   440
            aStream nextPut:#pushGlobalL; nextPut:litIndex; nextPut:0
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   441
        ].
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   442
        ^ self
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   443
    ].
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   444
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   445
    (type == #ClassInstanceVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   446
        aStream nextPut:#pushClassInstVar; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   447
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   448
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   449
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   450
    (type == #ThisContext) ifTrue:[
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   451
        aStream nextPut:#pushThisContext. 
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   452
        ^ self
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   453
    ].
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   454
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   455
    (type == #WorkspaceVariable) ifTrue:[
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   456
        "/ this is done by keeping the valueHolder in the literalArray,
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   457
        "/ and coding a #value message here.
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   458
875
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   459
        litIndex := aCompiler addLiteral:token.
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   460
        aStream nextPut:#pushLitS; nextPut:litIndex.
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   461
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   462
        selLitIdx := aCompiler addLiteral:#value.
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   463
        selLitIdx <= 255 ifTrue:[
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   464
            aStream nextPut:#send0; nextPut:("lineNr ?" 1); nextPut:selLitIdx.
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   465
        ] ifFalse:[
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   466
            aStream nextPut:#sendL; nextPut:("lineNr ?" 1); nextPut:selLitIdx; nextPut:0; nextPut:1 "nargs".
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   467
        ].
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   468
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   469
    ].
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   470
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   471
    "not reached"
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   472
    self halt:'bad type'.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   473
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   474
    "Created: / 25.6.1997 / 16:14:17 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   475
    "Modified: / 17.1.1998 / 04:04:17 / cg"
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   476
!
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   477
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   478
codeOn:aStream inBlock:codeBlock for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   479
    self
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   480
        codeLoadOn:aStream type:type index:index inBlock:codeBlock for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   481
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   482
    "Modified: 26.6.1997 / 10:06:10 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   483
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   484
104
claus
parents: 103
diff changeset
   485
codeStoreOn:aStream inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   486
    self
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   487
        codeStoreOn:aStream type:type index:index
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   488
        inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   489
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   490
    "Modified: 25.6.1997 / 16:15:28 / cg"
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   491
!
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   492
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   493
codeStoreOn:aStream type:type index:index inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   494
    |theCode b deltaLevel litIndex bvIdx blocksCode|
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   495
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   496
    valueNeeded ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   497
        aStream nextPut:#dup
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   498
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   499
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   500
    (type == #MethodVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   501
        (index <= 6) ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   502
            theCode := #(storeMethodVar1 storeMethodVar2
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   503
                         storeMethodVar3 storeMethodVar4
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   504
                         storeMethodVar5 storeMethodVar6) at:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   505
            aStream nextPut:theCode.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   506
            ^ self
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   507
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   508
        aStream nextPut:#storeMethodVar; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   509
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   510
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   511
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   512
    (type == #InstanceVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   513
        (index <= 10) ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   514
            theCode := #(storeInstVar1 storeInstVar2
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   515
                         storeInstVar3 storeInstVar4
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   516
                         storeInstVar5 storeInstVar6
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   517
                         storeInstVar7 storeInstVar8
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   518
                         storeInstVar9 storeInstVar10) at:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   519
            aStream nextPut:theCode.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   520
            ^ self
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   521
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   522
        aStream nextPut:#storeInstVar; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   523
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   524
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   525
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   526
    (type == #BlockVariable) ifTrue:[
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   527
        bvIdx := index.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   528
        
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   529
        "/ find the context where that variable is contained physically
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   530
        blocksCode := block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   531
        [blocksCode notNil and:[blocksCode isInlineBlock]] whileTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   532
            blocksCode := blocksCode home
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   533
        ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   534
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   535
        "find deltaLevel to block, where variable was defined"
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   536
        b := codeBlock.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   537
        deltaLevel := 0.
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   538
        [b notNil and:[b ~~ blocksCode]] whileTrue:[
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   539
            b isInlineBlock ifFalse:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   540
                deltaLevel := deltaLevel + 1
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   541
            ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   542
            b := b home
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   543
        ].
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   544
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   545
        b isNil ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   546
            codeBlock isNil ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   547
                "/ a block which is inlined in the method. 
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   548
                "/ Generate a pushMVAR
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   549
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   550
                bvIdx := block indexOfFirstTemp + index - 1.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   551
                bvIdx := bvIdx + block numArgs.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   552
                ^ self
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   553
                    codeStoreOn:aStream 
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   554
                    type:#MethodVariable index:bvIdx 
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   555
                    inBlock:codeBlock 
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   556
                    valueNeeded:false       "/ already dupped if value is needed
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   557
                    for:aCompiler
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   558
            ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   559
            "/ a var of a block which is inlined in the outer block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   560
            "/ Generate a pushBVAR
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   561
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   562
            bvIdx := block indexOfFirstTemp + index - 1.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   563
            bvIdx := bvIdx + block numArgs.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   564
        ] ifFalse:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   565
            block isInlineBlock ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   566
                "/ a var of a block which is inlined in another block.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   567
                "/ Generate a pushBVAR / pushOuterBVAR
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   568
                bvIdx := block indexOfFirstTemp + index - 1.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   569
                bvIdx := bvIdx + block numArgs.
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   570
            ]
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   571
        ].
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   572
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   573
        (deltaLevel == 0) ifTrue:[
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   574
            bvIdx <= 3 ifTrue:[
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   575
                aStream nextPut:(#(storeBlockVar1 storeBlockVar2 storeBlockVar3) at:bvIdx).
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   576
                ^ self
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   577
            ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   578
            aStream nextPut:#storeBlockVar
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   579
        ] ifFalse:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   580
            aStream nextPut:#storeOuterBlockVar; nextPut:deltaLevel
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   581
        ].
559
42cf4afd99b3 inline blocks withs args
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   582
        aStream nextPut:bvIdx.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   583
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   584
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   585
117
claus
parents: 106
diff changeset
   586
    (type == #GlobalVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   587
        litIndex := aCompiler addLiteral:name asSymbol.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   588
        litIndex < 256 ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   589
            aStream nextPut:#storeGlobalS; nextPut:litIndex
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   590
        ] ifFalse:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   591
            aStream nextPut:#storeGlobalL; nextPut:litIndex; nextPut:0
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   592
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   593
        ^ self
117
claus
parents: 106
diff changeset
   594
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   595
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   596
    (type == #ClassVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   597
        litIndex := aCompiler addLiteral:(value name , ':' , name) asSymbol.
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   598
        litIndex < 256 ifTrue:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   599
            aStream nextPut:#storeClassVarS; nextPut:litIndex
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   600
        ] ifFalse:[
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   601
            aStream nextPut:#storeClassVarL; nextPut:litIndex; nextPut:0
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   602
        ].
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   603
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   604
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   605
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   606
    (type == #ClassInstanceVariable) ifTrue:[
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   607
        aStream nextPut:#storeClassInstVar; nextPut:index.
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   608
        ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   609
    ].
554
d5e548c4d49d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   610
106
claus
parents: 104
diff changeset
   611
    "not reached"
941
0ae34d664798 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
   612
    self error:'bad assignment'
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   613
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   614
    "Created: / 25.6.1997 / 16:14:40 / cg"
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   615
    "Modified: / 17.1.1998 / 04:04:23 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   616
! !
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   617
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
   618
!VariableNode methodsFor:'enumerating'!
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   619
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   620
nodeDo:anEnumerator
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   621
    "helper for parse tree walking"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   622
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   623
    ^ anEnumerator doVariable:self name:name
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   624
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   625
    "Created: 19.6.1997 / 16:41:35 / cg"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   626
! !
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   627
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
   628
!VariableNode methodsFor:'evaluation'!
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   629
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   630
evaluate
980
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   631
    |nameSym|
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   632
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   633
    (type == #ContextVariable) ifTrue:[
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   634
        ^ value at:index
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   635
    ].
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   636
    (type == #MethodVariable
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   637
    or:[type == #BlockArg
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   638
    or:[type == #BlockVariable]]) ifTrue:[
420
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   639
        ^ token variableValue
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   640
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   641
    (type == #InstanceVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   642
        ^ value instVarAt:index
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   643
    ].
1088
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   644
    (type == #JavaVariable) ifTrue:[
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   645
        nameSym := name asSymbolIfInterned.
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   646
        nameSym notNil ifTrue:[
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   647
            ^ JAVA at:name
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   648
        ].
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   649
        ^ UndefinedVariable name:name.
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   650
"/        ^ nil
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   651
    ].
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   652
    (type == #GlobalVariable) ifTrue:[
980
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   653
        nameSym := name asSymbolIfInterned.
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   654
        nameSym notNil ifTrue:[
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   655
            (Smalltalk includesKey:nameSym) ifTrue:[
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   656
                ^ Smalltalk at:name
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   657
            ]
420
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   658
        ].
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   659
"
420
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   660
        self error:('global ' , name , ' is undefined').
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   661
"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   662
420
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   663
        ^ UndefinedVariable name:name.
1088
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   664
"/        ^ nil
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   665
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   666
    (type == #ClassVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   667
        ^ Smalltalk at:(value name , ':' , name) asSymbol
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   668
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   669
    (type == #ClassInstanceVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   670
        ^ value instVarAt:index
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   671
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   672
    (type == #ThisContext) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   673
        value notNil ifTrue:[
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   674
            ^ value
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   675
        ].
420
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   676
        ^ thisContext
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   677
    ].
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   678
    (type == #PrivateClass) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   679
        ^ value privateClassesAt:name asSymbol
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   680
    ].
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   681
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   682
    "/ synthetic; for evaluation only
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   683
    (type == #EvaluationContextLocal) ifTrue:[
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   684
        ^ token variableValue
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   685
    ].
1092
77de350f525c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   686
    "/ synthetic; for evaluation only
77de350f525c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   687
    (type == #WorkspaceVariable) ifTrue:[
77de350f525c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   688
        ^ token value
77de350f525c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   689
    ].
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   690
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   691
    "not reached"
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   692
    self halt:'internal error - bad variable type:' , type.
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   693
    ^ value
420
ad567fb4e732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   694
980
1818e8c13e2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   695
    "Modified: / 26.9.1999 / 13:04:42 / cg"
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   696
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   697
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   698
store:aValue
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   699
    (type == #ContextVariable) ifTrue:[
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   700
        value at:index put:aValue. ^ aValue
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   701
    ].
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   702
    (type == #MethodVariable
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   703
    or:[type == #BlockVariable]) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   704
        token value:aValue. ^ aValue
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   705
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   706
    (type == #InstanceVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   707
        ^ value instVarAt:index put:aValue
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   708
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   709
    (type == #GlobalVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   710
        ^ Smalltalk at:name put:aValue
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   711
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   712
    (type == #ClassVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   713
        ^ Smalltalk at:(value name , ':' , name) asSymbol put:aValue
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   714
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   715
    (type == #ClassInstanceVariable) ifTrue:[
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   716
        ^ value instVarAt:index put:aValue
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   717
    ].
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   718
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   719
    "/ synthetic; for evaluation only
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   720
    (type == #EvaluationContextLocal) ifTrue:[
875
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   721
        token value:aValue. ^ aValue
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   722
    ].
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   723
    (type == #WorkspaceVariable) ifTrue:[
2561654973eb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   724
        token value:aValue. ^ aValue
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   725
    ].
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   726
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   727
    "not reached"
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   728
    self halt:'internal error - bad variable type:' , type.
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   729
    ^ aValue
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   730
719
9ccbae6ba13e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
   731
    "Modified: / 16.5.1998 / 18:35:03 / cg"
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   732
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   733
1080
bd3f19f6009a category change
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
   734
!VariableNode methodsFor:'printing & storing'!
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   735
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   736
displayString
612
2748896a66c8 comments
Claus Gittinger <cg@exept.de>
parents: 577
diff changeset
   737
    "return a string for display in inspectors etc."
2748896a66c8 comments
Claus Gittinger <cg@exept.de>
parents: 577
diff changeset
   738
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   739
    ^ 'InterpreterVariable(' , self printString , ')'
612
2748896a66c8 comments
Claus Gittinger <cg@exept.de>
parents: 577
diff changeset
   740
2748896a66c8 comments
Claus Gittinger <cg@exept.de>
parents: 577
diff changeset
   741
    "Modified: 20.9.1997 / 11:42:07 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   742
!
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   743
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   744
printOn:aStream indent:i
98
claus
parents: 53
diff changeset
   745
641
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   746
    "/ actually only a debug-check
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   747
    (
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   748
    type == #ContextVariable              
e18daf10662c added support for context-vars (for evaluation in the debuggers code-frame)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   749
    or:[type == #MethodArg            
98
claus
parents: 53
diff changeset
   750
    or:[type == #MethodVariable
claus
parents: 53
diff changeset
   751
    or:[type == #InstanceVariable
claus
parents: 53
diff changeset
   752
    or:[type == #BlockArg
claus
parents: 53
diff changeset
   753
    or:[type == #GlobalVariable
1088
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   754
    or:[type == #JavaVariable
98
claus
parents: 53
diff changeset
   755
    or:[type == #ClassVariable
claus
parents: 53
diff changeset
   756
    or:[type == #BlockVariable
465
67e5205a81cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   757
    or:[type == #PrivateClass
872
7cf38a8125e6 support for workspace variables.
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   758
    or:[type == #WorkspaceVariable
720
6b3d43ba7273 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   759
    or:[type == #EvaluationContextLocal
1088
029b67b39d1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   760
    or:[type == #ClassInstanceVariable]]]]]]]]]]]]) ifTrue:[
465
67e5205a81cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   761
        aStream nextPutAll:name. ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   762
    ].
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   763
    (type == #ThisContext) ifTrue:[
465
67e5205a81cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   764
        aStream nextPutAll:'thisContext'. ^ self
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   765
    ].
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   766
    "not reached"
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   767
    self halt:'bad type'.
465
67e5205a81cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   768
720
6b3d43ba7273 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   769
    "Modified: / 17.5.1998 / 00:17:12 / cg"
14
f08ffd9958a5 Initial revision
claus
parents:
diff changeset
   770
! !
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   771
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   772
!VariableNode methodsFor:'queries'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   773
243
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   774
canReuseAsArg:anotherNode
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   775
    anotherNode isVariable ifTrue:[
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   776
        anotherNode type ~~ type ifTrue:[^ false].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   777
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   778
        (type == #ThisContext) ifTrue:[^ true].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   779
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   780
        index notNil ifTrue:[
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   781
            anotherNode index ~~ index ifTrue:[^ false].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   782
        ].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   783
        (type == #MethodArg) ifTrue:[^ true].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   784
        (type == #MethodVariable) ifTrue:[^ true].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   785
        (type == #InstanceVariable) ifTrue:[^ true].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   786
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   787
        name notNil ifTrue:[
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   788
            anotherNode name ~~ name ifTrue:[^ false].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   789
        ].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   790
        (type == #GlobalVariable) ifTrue:[^ true].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   791
        (type == #ClassVariable) ifTrue:[^ true].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   792
    ].
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   793
    ^ false
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   794
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   795
    "Created: 14.4.1996 / 00:46:18 / cg"
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   796
    "Modified: 14.4.1996 / 00:55:25 / cg"
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   797
!
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   798
566
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   799
isArgument
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   800
    "return true, if this is a node for an argument (block or method)"
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   801
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   802
    ^ (type == #MethodArg) or:[type == #BlockArg]
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   803
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   804
    "Created: 27.6.1997 / 13:07:05 / cg"
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   805
    "Modified: 27.6.1997 / 13:07:19 / cg"
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   806
!
90969df02c85 added #isArgument query
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   807
1076
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   808
isClassVariable
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   809
    ^ type == #ClassVariable
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   810
!
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   811
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   812
isGlobal
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   813
    "return true, if this is a node for a global variable"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   814
789
d9bbb0970239 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   815
d9bbb0970239 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   816
    ^ (type == #GlobalVariable) 
d9bbb0970239 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   817
      and:[name isSymbol
d9bbb0970239 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   818
      and:[Smalltalk includesKey:name]]
d9bbb0970239 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   819
d9bbb0970239 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   820
    "Modified: / 19.10.1998 / 19:43:04 / cg"
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   821
!
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   822
1076
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   823
isInstanceVariable
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   824
    ^ type == #InstanceVariable
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   825
!
b393dc61463e added #isClassVariable and #isInstanceVariable
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   826
218
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   827
isLocal
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   828
    "return true, if this is a node for a local (block or method) variable"
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   829
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   830
    ^ (type == #MethodVariable) or:[type == #BlockVariable]
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   831
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   832
    "Created: 1.3.1996 / 00:03:53 / cg"
748b4c509a51 use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   833
    "Modified: 1.3.1996 / 00:04:46 / cg"
243
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   834
!
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   835
965
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   836
isUndeclared
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   837
    type == #PrivateClass ifTrue:[
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   838
        ^ (Smalltalk includesKey:(value name , '::' , name) asSymbol) not
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   839
    ].
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   840
    type == #GlobalVariable ifTrue:[
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   841
        ^ (Smalltalk includesKey:name) not
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   842
    ].
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   843
    ^ false
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   844
!
5f893e013e73 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
   845
243
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   846
isVariable
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   847
    "return true, if this is a node for a variable"
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   848
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   849
    ^ true
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   850
cdc1424ddaac use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   851
    "Created: 14.4.1996 / 00:46:32 / cg"
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   852
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   853
360
9b26a5a4da70 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   854
!VariableNode class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   855
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   856
version
1092
77de350f525c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   857
    ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.50 2000-10-09 10:42:06 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   858
! !