VSEFileSourceWriter.st
changeset 3782 2060e392285f
parent 3766 f17fd01f67e8
child 3787 efa99df885de
--- a/VSEFileSourceWriter.st	Tue Feb 10 21:25:31 2015 +0100
+++ b/VSEFileSourceWriter.st	Fri Feb 13 02:54:12 2015 +0100
@@ -227,6 +227,7 @@
 
     "/ all references to namespace variables
     parser := Parser new.
+    parser foldConstants:false.
     parser parserFlags 
         allowOldStyleAssignment:true;
         warnOldStyleAssignment:true.
@@ -252,11 +253,13 @@
     |parser|
 
     "/ all references to namespace variables
-    parser := Parser 
-                parseMethod:source 
-                in:methodClass
-                ignoreErrors:false
-                ignoreWarnings:true.
+    parser := Parser new.
+    parser foldConstants:false.
+    parser
+        parseMethod:source 
+        in:methodClass
+        ignoreErrors:false
+        ignoreWarnings:true.
 
     (parser messagesSent includesAny: #( 
             'answer:do:' 
@@ -284,6 +287,7 @@
     |parser annots|
 
     parser := Parser new.
+    parser foldConstants:false.
     parser saveComments:true.
     parser parseMethod:source in:methodClass ignoreErrors:true ignoreWarnings:true.
 
@@ -305,11 +309,13 @@
     |parser globalsToRename symbolsToRename replacer newSource tree|
 
     "/ all references to namespace variables
-    parser := Parser 
-                parseMethod:source 
-                in:methodClass
-                ignoreErrors:false
-                ignoreWarnings:false.
+    parser := Parser new.
+    parser foldConstants:false.
+    parser
+        parseMethod:source 
+        in:methodClass
+        ignoreErrors:false
+        ignoreWarnings:false.
 
     globalsToRename := Dictionary new.
     symbolsToRename := Dictionary new.
@@ -393,6 +399,7 @@
     |tree parser eolComments|
 
     parser := Parser new.
+    parser foldConstants:false.
     parser saveComments:true.
     parser parseMethod:source in:methodClass ignoreErrors:true ignoreWarnings:true.
 
@@ -423,11 +430,13 @@
     |parser replacer newSource tree|
 
     "/ all references to namespace variables
-    parser := Parser 
-                parseMethod:source 
-                in:methodClass
-                ignoreErrors:false
-                ignoreWarnings:false.
+    parser := Parser new. 
+    parser foldConstants:false.
+    parser
+        parseMethod:source 
+        in:methodClass
+        ignoreErrors:false
+        ignoreWarnings:false.
 
     (parser messagesSent includesAny: #( 'answer:do:' 'ignoreIn:' )) ifTrue:[
         self halt
@@ -453,19 +462,23 @@
         parseMethod:source
         onError:[:aString :pos | self halt. ^ self].
 
+"/((method selector == #'stackTraceFrom:')
+"/and:[ methodClass == SOAP::SoPortableUtil class ]) ifTrue:[self halt].
+
     (replacer executeTree: tree) ifTrue:[
-        newSource := replacer executeReplacementsInSource:source.
+        newSource := replacer executeReplacementsInSource:source copy.
         (newSource ~= source) ifTrue:[
             Transcript showCR:('- rewrote exception handler(s) (%1)' bindWith:method whoString).
             "/ self halt.
+
+            "/ to verify, check parsability    
+            RBParser 
+                parseMethod:newSource
+                onError:[:aString :pos | self halt.].           
+
             source := newSource.
         ].
     ].
-
-    "/ to verify, check parsability    
-    RBParser 
-        parseMethod:source
-        onError:[:aString :pos | self halt.].           
 !
 
 rewriteGlobalsWithNamespace
@@ -476,6 +489,7 @@
     namesToRewrite := OrderedCollection new.
 
     parser := Parser new.
+    parser foldConstants:false.
     parser saveComments:true.
     parser parseMethod:source in:methodClass ignoreErrors:true ignoreWarnings:true.
     parser tree isNil ifTrue:[ ^ self ].
@@ -530,10 +544,10 @@
 !VSEFileSourceWriter class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/VSEFileSourceWriter.st,v 1.15 2015-02-06 10:08:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/VSEFileSourceWriter.st,v 1.16 2015-02-13 01:54:12 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/VSEFileSourceWriter.st,v 1.15 2015-02-06 10:08:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/VSEFileSourceWriter.st,v 1.16 2015-02-13 01:54:12 cg Exp $'
 ! !