BreakpointAnalyzer.st
branchjv
changeset 4723 524785227024
parent 3841 a22f33410bdf
parent 4467 4698a67f4800
--- a/BreakpointAnalyzer.st	Sat Aug 08 22:49:53 2020 +0100
+++ b/BreakpointAnalyzer.st	Tue Aug 25 12:20:06 2020 +0100
@@ -48,13 +48,14 @@
     "invoked whenever a message send node has been generated;
      gives subclasses a chance to rewrite (instrument) it"
 
-    (messageSendMap at: aMessageNode line ifAbsentPut:[Bag new])
-        add: aMessageNode selector.
+    (messageSendMap at:(aMessageNode line) ifAbsentPut:[Bag new])
+        add:(aMessageNode selector).
 
     ^ aMessageNode
 
     "Created: / 15-04-2013 / 15:32:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 16-04-2013 / 23:07:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 20-02-2019 / 10:49:33 / Claus Gittinger"
 ! !
 
 !BreakpointAnalyzer methodsFor:'initialization'!
@@ -71,13 +72,23 @@
 genMakeArrayWith:elementExpressions
     "return a node to generate an array at runtime.
      Will generate:
-        Array with:el1 ... with:elN                             (if N <= 5)
+        literal shallowCopy                                     (if all elements are literals)
+     or else:
+        Array with:el1 ... with:elN                             (if N <= 8)
      or:
         (Array new at:1 put:el1; ... at:N put:elN; yourself)    (otherwise)
+
+     SIGH: duplicate code here, because the other implementation is on the class side,
+     and shared by JavaScriptParser and regular Parser.
     "
 
     |numEl arrRec sel expr|
 
+    (elementExpressions conform:#isConstant) ifTrue:[
+        arrRec := ConstantNode type:#Array value:(elementExpressions collect:#value as:Array) from:-1 to:-1. "/ position -1 means artifitial node
+        ^ self messageNodeRewriteHookFor:(MessageNode receiver:arrRec selector:#shallowCopy).
+    ].
+
     arrRec := VariableNode globalNamed:#Array.
     arrRec startPosition: -1 endPosition: -1. "/ -1 means artifitial node
 
@@ -134,10 +145,10 @@
 !BreakpointAnalyzer class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/BreakpointAnalyzer.st,v 1.3 2013-04-24 20:26:44 vrany Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/BreakpointAnalyzer.st,v 1.3 2013-04-24 20:26:44 vrany Exp $'
+    ^ '$Header$'
 ! !