AssignmentNode.st
author Claus Gittinger <cg@exept.de>
Sun, 02 Feb 2003 16:52:47 +0100
changeset 1366 f91f6a0a56d5
parent 1173 0510a380ff38
child 1384 0db9682870d9
permissions -rw-r--r--
when required to compile, use Compiler instead of self class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     1
"
4
f6fd83437415 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
52
d80ec10c3321 *** empty log message ***
claus
parents: 32
diff changeset
     3
	      All Rights Reserved
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     4
7ad01559b262 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
7ad01559b262 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
7ad01559b262 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7ad01559b262 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7ad01559b262 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
7ad01559b262 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
7ad01559b262 Initial revision
claus
parents:
diff changeset
    11
"
7ad01559b262 Initial revision
claus
parents:
diff changeset
    12
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
    13
"{ Package: 'stx:libcomp' }"
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
    14
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    15
ParseNode subclass:#AssignmentNode
375
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    16
	instanceVariableNames:'variable expression lineNr'
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    17
	classVariableNames:''
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    18
	poolDictionaries:''
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    19
	category:'System-Compiler-Support'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    20
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    21
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    22
!AssignmentNode class methodsFor:'documentation'!
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    23
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    24
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    25
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    26
 COPYRIGHT (c) 1989 by Claus Gittinger
52
d80ec10c3321 *** empty log message ***
claus
parents: 32
diff changeset
    27
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    28
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    29
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    30
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    32
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    33
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    34
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    35
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    36
!
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    37
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    38
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    39
"
261
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 224
diff changeset
    40
    node for parse-trees, representing assignments.
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 224
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
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    45
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    46
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    47
! !
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    48
7ad01559b262 Initial revision
claus
parents:
diff changeset
    49
!AssignmentNode class methodsFor:'instance creation'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    50
7ad01559b262 Initial revision
claus
parents:
diff changeset
    51
variable:v expression:e
7ad01559b262 Initial revision
claus
parents:
diff changeset
    52
    ^ (self basicNew) variable:v expression:e
7ad01559b262 Initial revision
claus
parents:
diff changeset
    53
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
    54
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    55
!AssignmentNode methodsFor:'accessing'!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    56
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    57
expression
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    58
    ^ expression
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    59
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    60
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    61
lineNumber
375
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    62
    "return lineNr"
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    63
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    64
    ^ lineNr
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    65
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    66
    "Created: / 14.5.1998 / 19:30:49 / cg"
375
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    67
!
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    68
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    69
lineNumber:something
375
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    70
    "set lineNr"
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    71
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    72
    lineNr := something.
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    73
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    74
    "Created: / 14.5.1998 / 19:30:54 / cg"
375
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    75
!
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    76
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
    77
variable
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
    78
    ^ variable
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
    79
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
    80
    "Created: 19.6.1997 / 17:08:58 / cg"
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
    81
!
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
    82
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    83
variable:v expression:e
7ad01559b262 Initial revision
claus
parents:
diff changeset
    84
    variable := v.
882
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    85
    expression := e.
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    86
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    87
    "/ any block, which gets assigned to something
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    88
    "/ cannot be inlined.
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    89
    e isBlockNode ifTrue:[
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    90
        e possiblyInlined:false
0bc2a6ecdfad oops - cannot inline blocks which are assigned or returned.
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
    91
    ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    92
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
    93
7ad01559b262 Initial revision
claus
parents:
diff changeset
    94
!AssignmentNode methodsFor:'code generation'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    95
117
claus
parents: 104
diff changeset
    96
checkIncDecOn:aStream
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    97
    "check if we can use incMvar / decMvar instruction.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    98
     If so, code it and return true.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    99
     Otherwise, return false."
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   100
117
claus
parents: 104
diff changeset
   101
    |sel erec arg code|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   102
7ad01559b262 Initial revision
claus
parents:
diff changeset
   103
    (variable type == #MethodVariable) ifTrue:[
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   104
        expression isBinaryMessage ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   105
            sel := expression selector.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   106
            erec := expression receiver.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   107
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   108
            ((sel == #+) or:[sel == #-]) ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   109
                (erec type == #MethodVariable) ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   110
                    (erec index == variable index) ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   111
                        arg := expression arg1.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   112
                        arg isConstant ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   113
                            (arg value == 1) ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   114
                                (sel == #+) ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   115
                                    code := #incMethodVar
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   116
                                ] ifFalse:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   117
                                    code := #decMethodVar
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   118
                                ].
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   119
                                aStream nextPut:code; nextPut:(expression lineNumber); nextPut:(variable index).
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   120
                                ^ true
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   121
                            ]
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   122
                        ]
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   123
                    ]
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   124
                ]
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   125
            ]
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   126
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   127
    ].
117
claus
parents: 104
diff changeset
   128
    ^ false
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   129
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   130
    "Modified: 1.3.1996 / 00:08:02 / cg"
117
claus
parents: 104
diff changeset
   131
!
claus
parents: 104
diff changeset
   132
claus
parents: 104
diff changeset
   133
codeForSideEffectOn:aStream inBlock:b for:aCompiler
claus
parents: 104
diff changeset
   134
    (self checkIncDecOn:aStream) ifTrue:[^ self].
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   135
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   136
    self codeNormalOn:aStream valueNeeded:false inBlock:b for:aCompiler
117
claus
parents: 104
diff changeset
   137
claus
parents: 104
diff changeset
   138
    "Modified: 4.9.1995 / 14:38:10 / claus"
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   139
    "Modified: 1.3.1996 / 00:42:10 / cg"
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   140
!
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   141
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   142
codeNormalOn:aStream valueNeeded:forValue inBlock:b for:aCompiler
871
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   143
    |isSend litIdx selLitIdx|
386
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   144
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   145
    isSend := expression isMessage.
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   146
    (lineNr notNil 
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   147
     and:[isSend not]) ifTrue:[
817
8de90dbed4bb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
   148
        self codeLineNumber:lineNr on:aStream for:aCompiler
386
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   149
    ].
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   150
871
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   151
    "/ must do workspace variables here, because these
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   152
    "/ need the receiver (the valueHolder) to be pushed first,
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   153
    "/ then the value which is to be stored.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   154
    "/ finally, a #value: message is generated.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   155
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   156
    (variable type == #WorkspaceVariable) ifTrue:[
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   157
        "/ this is done by keeping the valueHolder in the literalArray,
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   158
        "/ and coding a #value: message here.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   159
876
950dac5c8ad0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 871
diff changeset
   160
        litIdx := aCompiler addLiteral:variable token.
871
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   161
        aStream nextPut:#pushLitS; nextPut:litIdx.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   162
        expression codeOn:aStream inBlock:b for:aCompiler.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   163
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   164
        selLitIdx := aCompiler addLiteral:#value:.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   165
        selLitIdx <= 255 ifTrue:[
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   166
            aStream nextPut:#send1; nextPut:(lineNr ? 1); nextPut:selLitIdx.
871
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   167
        ] ifFalse:[
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   168
            aStream nextPut:#sendL; nextPut:(lineNr ? 1); nextPut:selLitIdx; nextPut:0; nextPut:1 "nargs".
871
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   169
        ].
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   170
        aStream nextPut:#drop.
871
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   171
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   172
        forValue ifTrue:[
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   173
            (expression isConstant or:[expression isVariable]) ifTrue:[
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   174
                expression codeOn:aStream inBlock:b for:aCompiler.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   175
            ] ifFalse:[
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   176
                "/ fetch value from the holder - sigh
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   177
                aStream nextPut:#pushLitS; nextPut:litIdx.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   178
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   179
                selLitIdx := aCompiler addLiteral:#value.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   180
                selLitIdx <= 255 ifTrue:[
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   181
                    aStream nextPut:#send0; nextPut:(lineNr ? 1); nextPut:selLitIdx.
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   182
                ] ifFalse:[
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   183
                    aStream nextPut:#sendL; nextPut:(lineNr ? 1); nextPut:selLitIdx; nextPut:0; nextPut:1 "nargs".
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   184
                ].
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   185
            ]
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   186
        ].
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   187
        ^ self
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   188
    ].
ada5288239e4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   189
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   190
    expression codeOn:aStream inBlock:b for:aCompiler.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   191
    expression isBlock ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   192
        variable isLocal ifTrue:[
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   193
            aStream nextPut:#blockRef
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   194
        ]
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   195
    ].
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   196
386
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   197
    (lineNr notNil
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   198
     and:[isSend]) ifTrue:[
817
8de90dbed4bb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
   199
        self codeLineNumber:lineNr on:aStream for:aCompiler
375
00e24958b103 optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   200
    ].
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   201
    variable codeStoreOn:aStream inBlock:b valueNeeded:forValue for:aCompiler
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   202
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   203
    "Modified: 4.9.1995 / 14:38:10 / claus"
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   204
    "Created: 1.3.1996 / 00:41:43 / cg"
386
2f66de89a89b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   205
    "Modified: 21.10.1996 / 16:26:33 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   206
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   207
104
claus
parents: 103
diff changeset
   208
codeOn:aStream inBlock:b for:aCompiler
117
claus
parents: 104
diff changeset
   209
    (self checkIncDecOn:aStream) ifTrue:[
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   210
        expression receiver codeOn:aStream inBlock:b for:aCompiler.
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   211
        ^ self
117
claus
parents: 104
diff changeset
   212
    ].
219
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   213
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   214
    self codeNormalOn:aStream valueNeeded:true inBlock:b for:aCompiler
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   215
6b977f472cda care for block-stores into outer contexts
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   216
    "Modified: 1.3.1996 / 00:42:21 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   217
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   218
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   219
!AssignmentNode methodsFor:'enumerating'!
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   220
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   221
nodeDo:anEnumerator
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   222
    "helper for parse tree walking"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   223
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   224
    ^ anEnumerator doAssignment:self variable:variable value:expression
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   225
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   226
    "Modified: 19.6.1997 / 16:37:50 / cg"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   227
! !
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   228
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   229
!AssignmentNode methodsFor:'evaluation'!
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   230
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   231
evaluate
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   232
    |value|
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   233
    value := expression evaluate.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   234
    variable store:value.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   235
    ^ value
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   236
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   237
1079
2a996e0def30 category change
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
   238
!AssignmentNode methodsFor:'printing & storing'!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   239
7ad01559b262 Initial revision
claus
parents:
diff changeset
   240
printOn:aStream indent:i
7ad01559b262 Initial revision
claus
parents:
diff changeset
   241
    variable printOn:aStream.
1173
0510a380ff38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   242
    self printOperatorOn:aStream.
0510a380ff38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   243
    expression printOn:aStream
0510a380ff38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   244
!
0510a380ff38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   245
0510a380ff38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   246
printOperatorOn:aStream
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   247
    aStream nextPutAll:' := '.
7ad01559b262 Initial revision
claus
parents:
diff changeset
   248
! !
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   249
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   250
!AssignmentNode methodsFor:'queries'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   251
479
d78183973ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   252
collectBlocksInto:aCollection
d78183973ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   253
    expression collectBlocksInto:aCollection.
d78183973ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   254
d78183973ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   255
    "Created: 11.1.1997 / 20:54:30 / cg"
d78183973ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   256
!
d78183973ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   257
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   258
isAssignment
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   259
    "return true, if this is a node for an assignment"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   260
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   261
    ^ true
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   262
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   263
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   264
!AssignmentNode class methodsFor:'documentation'!
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   265
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   266
version
1173
0510a380ff38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   267
    ^ '$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.34 2001-08-13 13:58:02 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   268
! !