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