class: MessageNode
authorClaus Gittinger <cg@exept.de>
Fri, 06 Feb 2015 09:33:09 +0100
changeset 3573 1f32e1038e8e
parent 3572 0a5f2ae67ab2
child 3574 2fcbcae02707
class: MessageNode changed: #withConstantValueDo:
MessageNode.st
--- a/MessageNode.st	Wed Feb 04 11:14:21 2015 +0100
+++ b/MessageNode.st	Fri Feb 06 09:33:09 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libcomp' }"
 
+"{ NameSpace: Smalltalk }"
+
 ParseNode subclass:#MessageNode
 	instanceVariableNames:'receiver selector argArray lineNr selectorPosition lines
 		endLineNr endCharPosition selectorPartPositions'
@@ -3277,7 +3279,9 @@
 
 withConstantValueDo:aBlock
     "return true, if this evaluates to a constant value
-     and evaluate aBlock with it. Used for constant folding"
+     and evaluate aBlock with it. 
+     Also return true, if the node can be evaluated at compile time.
+     Used for constant folding"
 
     |recVal argValues allArgsConstant fold cond2 condVal2|
 
@@ -3286,7 +3290,9 @@
         (selector == #respondsTo:) ifTrue:[
             argArray size == 1 ifTrue:[
                 argArray first isConstant ifTrue:[
-                    argArray first value == #isSmalltalkX ifTrue:[
+                    (#(isSmalltalkX isVisualSmalltalkEnterprise isVisualWorks isSqueak)
+                        includesIdentical: argArray first value)
+                    ifTrue:[
                         "/ true here !!
                         aBlock value:true.
                         ^ true
@@ -3300,6 +3306,14 @@
             aBlock value:true.
             ^ true
         ].
+        "/ (Smalltalk isVisualSmalltalkEnterprise) -> false
+        ((selector == #isVisualSmalltalkEnterprise) 
+        or:[ (selector == #isVisualWorks) 
+        or:[ (selector == #isSqueak) ]]) ifTrue:[
+            "/ true here !!
+            aBlock value:false.
+            ^ true
+        ].
     ].
 
     (receiver withConstantValueDo:[:val | recVal := val]) ifTrue:[
@@ -3398,11 +3412,11 @@
 !MessageNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.212 2014-07-12 05:41:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.213 2015-02-06 08:33:09 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.212 2014-07-12 05:41:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.213 2015-02-06 08:33:09 cg Exp $'
 !
 
 version_SVN