StatementNode.st
author Claus Gittinger <cg@exept.de>
Sat, 12 Feb 2000 16:34:02 +0100
changeset 1035 8848672cb893
parent 985 082a5f214443
child 1080 bd3f19f6009a
permissions -rw-r--r--
category rename
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
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    77
lineNumber
392
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
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    82
    "Created: / 14.5.1998 / 19:31:06 / cg"
392
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
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    85
lineNumber:something
392
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
711
25b9a501b97d lineNr -> lineNumber
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
    90
    "Created: / 14.5.1998 / 19:31:11 / cg"
392
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
985
082a5f214443 care for empty statements
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
   106
    expression notNil ifTrue:[
082a5f214443 care for empty statements
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
   107
        expression codeForSideEffectOn:aStream inBlock:b for:aCompiler
082a5f214443 care for empty statements
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
   108
    ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   109
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   110
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   111
codeOn:aStream inBlock:b for:aCompiler
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   112
    "generate code for this statement"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   113
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   114
    expression codeOn:aStream inBlock:b for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   115
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   116
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   117
!StatementNode methodsFor:'enumerating'!
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   118
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   119
nodeDo:anEnumerator
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   120
    "helper for parse tree walking"
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
    |stats this|
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
    "/ 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
   125
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   126
    stats := OrderedCollection new.
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   127
    this := self.
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   128
    [this notNil] whileTrue:[
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   129
        stats add:this expression.
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   130
        this := this nextStatement
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
    ^ anEnumerator doSequence:self temporaries:#() statements:stats
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   133
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   134
    "Created: 19.6.1997 / 16:45:34 / cg"
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   135
    "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
   136
! !
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   137
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   138
!StatementNode methodsFor:'evaluation'!
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   139
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   140
evaluate
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   141
    |lastValue thisStatement|
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   142
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   143
    "this could be done more elegant - but with lots of recursion"
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   144
    thisStatement := self.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   145
    [thisStatement notNil] whileTrue:[
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   146
	lastValue := thisStatement evaluateExpression.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   147
	thisStatement := thisStatement nextStatement
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
    ^ lastValue
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   150
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   151
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   152
evaluateExpression
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   153
    ^ expression evaluate
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   154
! !
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   155
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   156
!StatementNode methodsFor:'printing'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   157
7ad01559b262 Initial revision
claus
parents:
diff changeset
   158
printAllOn:aStream 
7ad01559b262 Initial revision
claus
parents:
diff changeset
   159
    self printAllOn:aStream indent:4
7ad01559b262 Initial revision
claus
parents:
diff changeset
   160
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   161
7ad01559b262 Initial revision
claus
parents:
diff changeset
   162
printAllOn:aStream indent:i
7ad01559b262 Initial revision
claus
parents:
diff changeset
   163
    |thisStatement|
7ad01559b262 Initial revision
claus
parents:
diff changeset
   164
7ad01559b262 Initial revision
claus
parents:
diff changeset
   165
    thisStatement := self.
7ad01559b262 Initial revision
claus
parents:
diff changeset
   166
    [thisStatement notNil] whileTrue:[
98
claus
parents: 52
diff changeset
   167
	aStream spaces:i.
52
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   168
	thisStatement printOn:aStream indent:i.
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   169
	thisStatement nextStatement notNil ifTrue:[
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   170
	    aStream nextPut:$..
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   171
	    aStream cr.
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   172
	].
d80ec10c3321 *** empty log message ***
claus
parents: 33
diff changeset
   173
	thisStatement := thisStatement nextStatement
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   174
    ]
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   175
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   176
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   177
printOn:aStream indent:i
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   178
    expression printOn:aStream indent:i.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   179
! !
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   180
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   181
!StatementNode methodsFor:'queries'!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   182
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   183
collectBlocksInto:aCollection
511
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   184
    |this ex|
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   185
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   186
    this := self.
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   187
    [this notNil] whileTrue:[
511
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   188
        ex := this expression.
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   189
        ex notNil ifTrue:[
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   190
            ex collectBlocksInto:aCollection.
c144804051db handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   191
        ].
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   192
        this := this nextStatement
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   193
    ].
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   194
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   195
    "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
   196
    "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
   197
!
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   198
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   199
isConstant
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   200
    nextStatement notNil ifTrue:[^ false].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   201
    ^ expression isConstant
332
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   202
!
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   203
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   204
listEndsWithReturn
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   205
    |thisStatement lastStatement|
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   206
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   207
    thisStatement := self.
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   208
    [thisStatement notNil] whileTrue:[
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   209
        lastStatement := thisStatement.
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   210
        thisStatement := thisStatement nextStatement
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   211
    ].
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
    ^ lastStatement isReturnNode
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   214
7ffd2016cf73 added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   215
    "Created: 19.8.1996 / 14:32:47 / cg"
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   216
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   217
392
cce48e2f0778 moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   218
!StatementNode class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   219
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   220
version
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   221
    ^ '$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.23 2000-02-12 15:32:20 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   222
! !