CascadeNode.st
author Claus Gittinger <cg@exept.de>
Sun, 29 Jan 2017 12:55:36 +0100
changeset 4103 2536fe3291dd
parent 3155 5ab5d8ad71ed
child 4181 21f00e5abe0a
permissions -rw-r--r--
#UI_ENHANCEMENT by cg class: Parser declare as: better chices for shared pools
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
104
claus
parents: 103
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
"
1079
2a996e0def30 category change
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
    12
"{ Package: 'stx:libcomp' }"
2a996e0def30 category change
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
    13
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    14
MessageNode subclass:#CascadeNode
261
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    15
	instanceVariableNames:''
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    16
	classVariableNames:''
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    17
	poolDictionaries:''
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    18
	category:'System-Compiler-Support'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    19
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    20
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    21
!CascadeNode class methodsFor:'documentation'!
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    22
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    23
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    24
"
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    25
 COPYRIGHT (c) 1989 by Claus Gittinger
104
claus
parents: 103
diff changeset
    26
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    27
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    28
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    29
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    31
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    32
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    33
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    34
"
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    35
!
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    36
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    37
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    38
"
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    39
    node for parse-trees, representing cascade message sends
261
0372e948ca2d commentary
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    40
    This is a helper class for the compiler.
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    41
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    42
    [author:]
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    43
        Claus Gittinger
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    44
"
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    45
! !
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    46
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    47
!CascadeNode methodsFor:'*VMMaker-C translation'!
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    48
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    49
asTranslatorNodeIn: aTMethod
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    50
        "make a CCodeGenerator equivalent of me"
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    51
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    52
        ^Squeak::TStmtListNode new
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    53
                setArguments: #()
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    54
                statements:
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    55
                        (Array streamContents:
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    56
                                [:s| | receiverNode |
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    57
                                receiverNode := self realReceiver "receiver" asTranslatorNodeIn: aTMethod.   
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    58
                                receiverNode isLeaf ifFalse:
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    59
                                        [| varNode |
2700
f894f188aefc comment/format in: #asTranslatorNodeIn:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
    60
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    61
                                         varNode := aTMethod newCascadeTempFor: receiverNode.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    62
                                         s nextPut: (Squeak::TAssignmentNode new
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    63
                                                                setVariable: varNode
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    64
                                                                expression: receiverNode).
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    65
                                        receiverNode := varNode].
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    66
                                self messages do:
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    67
                                        [ :msg | s nextPut: ((msg asTranslatorNodeIn: aTMethod) receiver: receiverNode)]]);
2700
f894f188aefc comment/format in: #asTranslatorNodeIn:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
    68
                comment: ((comments ? #()) firstIfEmpty:nil)
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    69
2700
f894f188aefc comment/format in: #asTranslatorNodeIn:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
    70
    "Modified: / 14-09-2011 / 10:41:14 / cg"
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    71
!
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    72
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    73
realReceiver
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    74
    "return the real receiver
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    75
     (sigh; ST/X encodes things differently)"
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    76
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    77
    |r|
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    78
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    79
    r := receiver.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    80
    [r isCascade] whileTrue:[
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    81
        r := r receiver.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    82
    ].
2700
f894f188aefc comment/format in: #asTranslatorNodeIn:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
    83
    ^ r receiver
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    84
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    85
    "Created: / 12-09-2011 / 10:01:48 / cg"
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    86
! !
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    87
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    88
!CascadeNode methodsFor:'code generation'!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    89
104
claus
parents: 103
diff changeset
    90
codeForCascadeOn:aStream inBlock:b for:aCompiler
claus
parents: 103
diff changeset
    91
    receiver codeForCascadeOn:aStream inBlock:b for:aCompiler.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    92
    aStream nextPut:#dup.
104
claus
parents: 103
diff changeset
    93
    self codeSendOn:aStream inBlock:b valueNeeded:false for:aCompiler
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    94
!
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    95
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    96
codeOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    97
    receiver codeForCascadeOn:aStream inBlock:b for:aCompiler.
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    98
    self codeSendOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    99
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   100
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
   101
!CascadeNode methodsFor:'enumerating'!
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   102
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   103
messages
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   104
    "helper for parse tree walking"
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   105
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   106
    "/ sigh; ST/X encodes things differently ...
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   107
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   108
    |r nd msgs msg|
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   109
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   110
    msgs := OrderedCollection new.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   111
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   112
    r := receiver.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   113
    [r isCascade] whileTrue:[
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   114
        r := r receiver.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   115
    ].
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   116
    r := r receiver.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   117
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   118
    nd := self.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   119
    [nd isCascade] whileTrue:[
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   120
        msg := MessageNode new.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   121
        msg receiver:r selector:nd selector args:nd args lineno:nd lineNumber.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   122
        msgs addFirst:msg.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   123
        nd := nd receiver.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   124
    ].
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   125
    msg := MessageNode new.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   126
    msg receiver:r selector:nd selector args:nd args lineno:nd lineNumber.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   127
    msgs addFirst:msg.
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   128
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   129
    ^ msgs
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   130
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   131
    "Created: / 12-09-2011 / 10:04:31 / cg"
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   132
!
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   133
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   134
nodeDo:anEnumerator
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   135
    "helper for parse tree walking"
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   136
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   137
    "/ sigh; ST/X encodes things differently ...
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   138
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   139
    |r nd msgs msg|
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   140
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   141
    msgs := OrderedCollection new.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   142
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   143
    r := receiver.
819
83f614a5a77d eliminated isKindOf
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   144
    [r isCascade] whileTrue:[
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   145
        r := r receiver.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   146
    ].
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   147
    r := r receiver.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   148
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   149
    nd := self.
819
83f614a5a77d eliminated isKindOf
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   150
    [nd isCascade] whileTrue:[
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   151
        msg := MessageNode new.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   152
        msg receiver:r selector:nd selector args:nd args lineno:nd lineNumber.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   153
        msgs addFirst:msg.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   154
        nd := nd receiver.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   155
    ].
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   156
    msg := MessageNode new.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   157
    msg receiver:r selector:nd selector args:nd args lineno:nd lineNumber.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   158
    msgs addFirst:msg.
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   159
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   160
    ^ anEnumerator doCascade:self receiver:r messages:msgs
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   161
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   162
    "Created: 19.6.1997 / 16:39:17 / cg"
542
728300bd8861 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
   163
    "Modified: 19.6.1997 / 17:32:47 / cg"
539
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   164
! !
69a1cd05c7d6 added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   165
1035
8848672cb893 category rename
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
   166
!CascadeNode methodsFor:'evaluation'!
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   167
1384
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   168
evaluateForCascadeIn:anEnvironment
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   169
    |t argValueArray|
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   170
1500
3c4cb012b24b Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents: 1387
diff changeset
   171
    selector := selector asSymbol.
3c4cb012b24b Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents: 1387
diff changeset
   172
1384
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   173
    receiver isSuper ifTrue:[
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   174
        ^ super evaluateForCascadeIn:anEnvironment
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   175
    ].
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   176
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   177
    t := receiver evaluateForCascadeIn:anEnvironment.
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   178
    argArray isNil ifTrue:[
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   179
        t perform:selector.
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   180
        ^ t
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   181
    ].
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   182
    argValueArray := argArray collect:[:arg | arg evaluateIn:anEnvironment]. 
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   183
    t perform:selector withArguments:argValueArray.
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   184
    ^ t
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   185
!
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   186
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   187
evaluateIn:anEnvironment
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   188
    |t argValueArray|
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   189
1500
3c4cb012b24b Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents: 1387
diff changeset
   190
    selector := selector asSymbol.
3c4cb012b24b Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents: 1387
diff changeset
   191
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   192
    receiver isSuper ifTrue:[
1384
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   193
        ^ super evaluateIn:anEnvironment
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   194
    ].
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   195
1384
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   196
    t := receiver evaluateForCascadeIn:anEnvironment.
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   197
    argArray isNil ifTrue:[
1344
e181501d8aa0 oops - cascade-evaluation did not return last value
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   198
        ^ t perform:selector.
e181501d8aa0 oops - cascade-evaluation did not return last value
Claus Gittinger <cg@exept.de>
parents: 1079
diff changeset
   199
        "/ t perform:selector. ^ t
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   200
    ].
1384
0db9682870d9 evaluate -> evaluateIn:
Claus Gittinger <cg@exept.de>
parents: 1344
diff changeset
   201
    argValueArray := argArray collect:[:arg | arg evaluateIn:anEnvironment].
140
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   202
    ^ t perform:selector withArguments:argValueArray
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   203
! !
1ef1d1395146 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   204
1079
2a996e0def30 category change
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   205
!CascadeNode methodsFor:'printing & storing'!
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   206
1588
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   207
printOn:aStream indent:i 
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   208
    |selectorParts|
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   209
1588
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   210
    selectorParts := selector asCollectionOfSubstringsSeparatedBy:$:.
3155
5ab5d8ad71ed Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 2700
diff changeset
   211
    selectorParts last isEmpty ifTrue:[selectorParts := selectorParts copyButLast:1].
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   212
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   213
    receiver printOn:aStream indent:i.
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   214
    aStream nextPutAll:'; '.
1588
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   215
    argArray size == 0 ifTrue:[
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   216
        selector printOn:aStream
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   217
    ] ifFalse:[
1588
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   218
        argArray 
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   219
            with:selectorParts
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   220
            do:[:arg :selPart | 
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   221
                aStream 
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   222
                    space;
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   223
                    nextPutAll:selPart;
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   224
                    nextPutAll:': '.
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   225
                arg printOn:aStream indent:i + 4 parenthized:(arg precedence <= self precedence).
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   226
            ]
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   227
    ]
1588
4c3183dfaa5f printing
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   228
2693
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   229
    "Modified: / 12-09-2011 / 09:46:45 / cg"
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   230
! !
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   231
2319
636647549e7c category change
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
   232
!CascadeNode methodsFor:'testing'!
744
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   233
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   234
isCascade
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   235
    ^ true
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   236
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   237
    "Created: / 16.7.1998 / 20:03:51 / cg"
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   238
! !
e871f9f072f8 changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   239
2593
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   240
!CascadeNode methodsFor:'visiting'!
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   241
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   242
acceptVisitor:aVisitor 
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   243
    "Double dispatch back to the visitor, passing my type encoded in
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   244
     the selector (visitor pattern)"
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   245
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   246
    "stub code automatically generated - please change if required"
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   247
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   248
    ^ aVisitor visitCascadeNode:self
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   249
! !
557c0dddfd66 - added acceptVisior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2319
diff changeset
   250
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   251
!CascadeNode 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
3155
5ab5d8ad71ed Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 2700
diff changeset
   254
    ^ '$Header: /cvs/stx/stx/libcomp/CascadeNode.st,v 1.32 2013-04-25 13:10:46 stefan Exp $'
2319
636647549e7c category change
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
   255
!
636647549e7c category change
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
   256
636647549e7c category change
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
   257
version_CVS
3155
5ab5d8ad71ed Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 2700
diff changeset
   258
    ^ '$Header: /cvs/stx/stx/libcomp/CascadeNode.st,v 1.32 2013-04-25 13:10:46 stefan Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 140
diff changeset
   259
! !
3155
5ab5d8ad71ed Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 2700
diff changeset
   260