ReturnNode.st
author Claus Gittinger <cg@exept.de>
Thu, 19 Jun 1997 16:58:23 +0200
changeset 539 69a1cd05c7d6
parent 393 5dc3fdd2177b
child 817 8de90dbed4bb
permissions -rw-r--r--
added node-walk facility (ST80 compatibility)
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
62
a8e1828867a8 *** empty log message ***
claus
parents: 29
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
StatementNode subclass:#ReturnNode
393
5dc3fdd2177b moved lineNr instVar up
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    14
	instanceVariableNames:'myHome blockHome'
261
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    15
	classVariableNames:''
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    16
	poolDictionaries:''
0372e948ca2d commentary
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: 13
diff changeset
    20
!ReturnNode class methodsFor:'documentation'!
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    21
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    22
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    23
"
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
62
a8e1828867a8 *** empty log message ***
claus
parents: 29
diff changeset
    25
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    26
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    27
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    28
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    30
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    31
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    32
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    33
"
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    34
!
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    35
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    36
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    37
"
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    38
    node for parse-trees, representing return expressions
261
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
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
20
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    43
"
f8dd8ba75205 *** empty log message ***
claus
parents: 13
diff changeset
    44
! !
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    45
380
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    46
!ReturnNode class methodsFor:'code generation helper'!
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    47
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    48
codeSimpleReturnFor:expression inBlock:b on:aStream inLine:lineNrOrNil for:aCompiler
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    49
    |type value index code code2|
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    50
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    51
    expression isPrimary ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    52
        type := expression type.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    53
        (type == #Nil) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    54
            code := #retNil
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    55
        ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    56
            (type == #True) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    57
                code := #retTrue
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    58
            ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    59
                (type == #False) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    60
                    code := #retFalse
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    61
                ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    62
                    (type == #Self) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    63
                        code := #retSelf
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    64
                    ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    65
                        (type == #Integer) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    66
                            value := expression evaluate.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    67
                            (value between: -128 and:127) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    68
                                (value == 0) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    69
                                    code := #ret0
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    70
                                ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    71
                                    code := #retNum.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    72
                                    code2 := value. 
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    73
                                ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    74
                            ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    75
                        ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    76
                            (type == #InstanceVariable) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    77
                                index := expression index.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    78
                                (index <= 8) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    79
                                    code := #( retInstVar1
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    80
                                               retInstVar2
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    81
                                               retInstVar3
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    82
                                               retInstVar4
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    83
                                               retInstVar5
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    84
                                               retInstVar6
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    85
                                               retInstVar7
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    86
                                               retInstVar8) at:index
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    87
                                ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    88
                            ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    89
                                (type == #MethodVariable) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    90
                                    index := expression index.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    91
                                    (index <= 6) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    92
                                        code := #( retMethodVar1
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    93
                                                   retMethodVar2
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    94
                                                   retMethodVar3
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    95
                                                   retMethodVar4
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    96
                                                   retMethodVar5
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    97
                                                   retMethodVar6) at:index
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    98
                                    ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
    99
                                ] ifFalse:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   100
                                    (type == #MethodArg) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   101
                                        index := expression index.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   102
                                        (index <= 2) ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   103
                                            code := #(retMethodArg1
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   104
                                                      retMethodArg2) at:index
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   105
                                        ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   106
                                    ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   107
                                ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   108
                            ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   109
                        ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   110
                    ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   111
                ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   112
            ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   113
        ]
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   114
    ].
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   115
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   116
    code isNil ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   117
        expression codeOn:aStream inBlock:b for:aCompiler.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   118
        code := #retTop
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   119
    ].
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   120
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   121
    lineNrOrNil notNil ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   122
        ParseNode codeLineNumber:lineNrOrNil on:aStream for:aCompiler
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   123
    ].
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   124
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   125
    aStream nextPut:code.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   126
    code2 notNil ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   127
        aStream nextPut:code2
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   128
    ].
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   129
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   130
    "Created: 21.10.1996 / 14:37:35 / cg"
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   131
    "Modified: 21.10.1996 / 14:43:11 / cg"
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   132
! !
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   133
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   134
!ReturnNode methodsFor:'accessing'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   135
7ad01559b262 Initial revision
claus
parents:
diff changeset
   136
home:someOne blockHome:aBlockNode
7ad01559b262 Initial revision
claus
parents:
diff changeset
   137
    myHome := someOne.
7ad01559b262 Initial revision
claus
parents:
diff changeset
   138
    blockHome := aBlockNode
7ad01559b262 Initial revision
claus
parents:
diff changeset
   139
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   140
7ad01559b262 Initial revision
claus
parents:
diff changeset
   141
!ReturnNode methodsFor:'code generation'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   142
104
claus
parents: 103
diff changeset
   143
codeForSideEffectOn:aStream inBlock:b for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   144
    "redefined - drop not needed since notreached"
7ad01559b262 Initial revision
claus
parents:
diff changeset
   145
104
claus
parents: 103
diff changeset
   146
    ^ self codeOn:aStream inBlock:b for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   147
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   148
104
claus
parents: 103
diff changeset
   149
codeOn:aStream inBlock:b for:aCompiler
380
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   150
    b isNil ifTrue:[
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   151
        ^ self class
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   152
            codeSimpleReturnFor:expression 
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   153
            inBlock:nil 
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   154
            on:aStream 
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   155
            inLine:lineNr 
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   156
            for:aCompiler
29
5884a68a6226 new return bytecode semantics
claus
parents: 20
diff changeset
   157
    ].
5884a68a6226 new return bytecode semantics
claus
parents: 20
diff changeset
   158
380
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   159
    expression codeOn:aStream inBlock:b for:aCompiler.
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   160
374
84e2a53ae12b optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   161
    lineNr notNil ifTrue:[
380
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   162
        ParseNode codeLineNumber:lineNr on:aStream for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   163
    ].
374
84e2a53ae12b optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   164
380
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   165
    aStream nextPut:#homeRetTop.
374
84e2a53ae12b optionally code the lineNr.
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   166
380
6bfa4056f202 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
   167
    "Modified: 21.10.1996 / 14:54:36 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   168
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   169
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   170
!ReturnNode methodsFor:'enumeration'!
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   171
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   172
nodeDo:anEnumerator
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   173
    "helper for parse tree walking"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   174
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   175
    ^ anEnumerator doReturn:self value:expression
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   176
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   177
    "Modified: 19.6.1997 / 16:42:40 / cg"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   178
! !
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   179
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   180
!ReturnNode methodsFor:'evaluating'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   181
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   182
evaluateExpression
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   183
    |val|
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   184
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   185
    val := expression evaluate.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   186
    myHome exitWith:val.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   187
    "when we arrive here, the parser context is already gone
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   188
     - try block-return"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   189
    blockHome notNil ifTrue:[blockHome exitWith:val].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   190
    "well - what else can be done"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   191
    ^ val
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   192
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   193
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   194
!ReturnNode methodsFor:'printing'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   195
7ad01559b262 Initial revision
claus
parents:
diff changeset
   196
printOn:aStream indent:i
7ad01559b262 Initial revision
claus
parents:
diff changeset
   197
    aStream nextPutAll:'^ '.
7ad01559b262 Initial revision
claus
parents:
diff changeset
   198
    expression printOn:aStream
7ad01559b262 Initial revision
claus
parents:
diff changeset
   199
! !
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   200
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   201
!ReturnNode methodsFor:'queries'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   202
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   203
isConstant
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   204
    ^ false
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   205
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   206
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   207
isReturnNode
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   208
    ^ true
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   209
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   210
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   211
!ReturnNode class methodsFor:'documentation'!
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   212
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   213
version
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   214
    ^ '$Header: /cvs/stx/stx/libcomp/ReturnNode.st,v 1.20 1997-06-19 14:57:29 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   215
! !