StatNode.st
author Stefan Vogel <sv@exept.de>
Fri, 06 Mar 1998 16:38:37 +0100
changeset 657 0ecf1ff6f6bf
parent 542 728300bd8861
child 711 25b9a501b97d
permissions -rw-r--r--
Fix #makeMethod:
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: 33
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:#StatementNode
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    14
	instanceVariableNames:'expression nextStatement lineNr'
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
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    20
!StatementNode class methodsFor:'documentation'!
20
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    21
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    22
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    23
"
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
    25
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    26
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    27
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    28
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    30
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    31
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    32
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    33
"
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    34
!
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    35
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    36
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    37
"
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    38
    node for parse-trees, representing statements
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: 4
diff changeset
    43
"
f8dd8ba75205 *** empty log message ***
claus
parents: 4
diff changeset
    44
! !
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    45
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    46
!StatementNode class methodsFor:'instance creation'!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    47
7ad01559b262 Initial revision
claus
parents:
diff changeset
    48
expression:e
7ad01559b262 Initial revision
claus
parents:
diff changeset
    49
    ^ (self basicNew) expression:e
7ad01559b262 Initial revision
claus
parents:
diff changeset
    50
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
    51
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    52
!StatementNode methodsFor:'accessing'!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    53
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    54
expression
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    55
    ^ expression
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    56
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    57
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    58
expression:e
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    59
    expression := e
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    60
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    61
7ad01559b262 Initial revision
claus
parents:
diff changeset
    62
last
7ad01559b262 Initial revision
claus
parents:
diff changeset
    63
    "return the last statement in a list"
7ad01559b262 Initial revision
claus
parents:
diff changeset
    64
7ad01559b262 Initial revision
claus
parents:
diff changeset
    65
    |last this|
7ad01559b262 Initial revision
claus
parents:
diff changeset
    66
7ad01559b262 Initial revision
claus
parents:
diff changeset
    67
    "this could be done more elegant - but with lots of recursion"
7ad01559b262 Initial revision
claus
parents:
diff changeset
    68
    last := self.
7ad01559b262 Initial revision
claus
parents:
diff changeset
    69
    this := self.
7ad01559b262 Initial revision
claus
parents:
diff changeset
    70
    [this notNil] whileTrue:[
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
    71
	last := this.
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
    72
	this := this nextStatement
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    73
    ].
7ad01559b262 Initial revision
claus
parents:
diff changeset
    74
    ^ last
7ad01559b262 Initial revision
claus
parents:
diff changeset
    75
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    76
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    77
lineNr
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    78
    "return lineNr"
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    79
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    80
    ^ lineNr
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    81
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    82
    "Created: 23.10.1996 / 14:51:54 / cg"
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    83
!
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    84
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    85
lineNr:something
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    86
    "set lineNr"
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    87
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    88
    lineNr := something.
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    89
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    90
    "Created: 23.10.1996 / 14:51:58 / cg"
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    91
!
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
    92
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    93
nextStatement
7ad01559b262 Initial revision
claus
parents:
diff changeset
    94
    ^ nextStatement
7ad01559b262 Initial revision
claus
parents:
diff changeset
    95
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    96
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    97
nextStatement:s
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    98
    nextStatement := s
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    99
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   100
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   101
!StatementNode methodsFor:'code generation'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   102
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   103
codeForSideEffectOn:aStream inBlock:b for:aCompiler
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   104
    "generate code for this statement - value not needed"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   105
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   106
    expression codeForSideEffectOn:aStream inBlock:b for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   107
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   108
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   109
codeOn:aStream inBlock:b for:aCompiler
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   110
    "generate code for this statement"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   111
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   112
    expression codeOn:aStream inBlock:b for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   113
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   114
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   115
!StatementNode methodsFor:'enumeration'!
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   116
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   117
nodeDo:anEnumerator
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   118
    "helper for parse tree walking"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   119
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   120
    |stats this|
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   121
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   122
    "/ too stupid: ST/X statements are linked as a list ...
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   123
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   124
    stats := OrderedCollection new.
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   125
    this := self.
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   126
    [this notNil] whileTrue:[
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   127
        stats add:this expression.
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   128
        this := this nextStatement
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   129
    ].
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   130
    ^ anEnumerator doSequence:self temporaries:#() statements:stats
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   131
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   132
    "Created: 19.6.1997 / 16:45:34 / cg"
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   133
    "Modified: 19.6.1997 / 17:06:47 / cg"
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   134
! !
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   135
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   136
!StatementNode methodsFor:'evaluating'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   137
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   138
evaluate
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   139
    |lastValue thisStatement|
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   140
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   141
    "this could be done more elegant - but with lots of recursion"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   142
    thisStatement := self.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   143
    [thisStatement notNil] whileTrue:[
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   144
	lastValue := thisStatement evaluateExpression.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   145
	thisStatement := thisStatement nextStatement
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   146
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   147
    ^ lastValue
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   148
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   149
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   150
evaluateExpression
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   151
    ^ expression evaluate
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   152
! !
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   153
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   154
!StatementNode methodsFor:'printing'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   155
7ad01559b262 Initial revision
claus
parents:
diff changeset
   156
printAllOn:aStream 
7ad01559b262 Initial revision
claus
parents:
diff changeset
   157
    self printAllOn:aStream indent:4
7ad01559b262 Initial revision
claus
parents:
diff changeset
   158
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   159
7ad01559b262 Initial revision
claus
parents:
diff changeset
   160
printAllOn:aStream indent:i
7ad01559b262 Initial revision
claus
parents:
diff changeset
   161
    |thisStatement|
7ad01559b262 Initial revision
claus
parents:
diff changeset
   162
7ad01559b262 Initial revision
claus
parents:
diff changeset
   163
    thisStatement := self.
7ad01559b262 Initial revision
claus
parents:
diff changeset
   164
    [thisStatement notNil] whileTrue:[
98
claus
parents: 52
diff changeset
   165
	aStream spaces:i.
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   166
	thisStatement printOn:aStream indent:i.
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   167
	thisStatement nextStatement notNil ifTrue:[
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   168
	    aStream nextPut:$..
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   169
	    aStream cr.
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   170
	].
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   171
	thisStatement := thisStatement nextStatement
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   172
    ]
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   173
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   174
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   175
printOn:aStream indent:i
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   176
    expression printOn:aStream indent:i.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   177
! !
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   178
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   179
!StatementNode methodsFor:'queries'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   180
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   181
collectBlocksInto:aCollection
511
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   182
    |this ex|
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   183
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   184
    this := self.
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   185
    [this notNil] whileTrue:[
511
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   186
        ex := this expression.
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   187
        ex notNil ifTrue:[
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   188
            ex collectBlocksInto:aCollection.
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   189
        ].
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   190
        this := this nextStatement
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   191
    ].
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   192
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   193
    "Created: 23.10.1996 / 15:44:13 / cg"
511
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   194
    "Modified: 20.4.1997 / 12:10:18 / cg"
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   195
!
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   196
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   197
isConstant
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   198
    nextStatement notNil ifTrue:[^ false].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   199
    ^ expression isConstant
332
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   200
!
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   201
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   202
listEndsWithReturn
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   203
    |thisStatement lastStatement|
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   204
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   205
    thisStatement := self.
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   206
    [thisStatement notNil] whileTrue:[
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   207
        lastStatement := thisStatement.
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   208
        thisStatement := thisStatement nextStatement
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   209
    ].
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   210
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   211
    ^ lastStatement isReturnNode
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   212
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   213
    "Created: 19.8.1996 / 14:32:47 / cg"
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   214
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   215
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   216
!StatementNode class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   217
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   218
version
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   219
    ^ '$Header: /cvs/stx/stx/libcomp/Attic/StatNode.st,v 1.20 1997-06-19 16:38:28 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   220
! !