On Wed, 2007-01-10 at 14:14 -0600, Stephen Compall wrote:
> That will hide the example I've given, because arguments in the notFound
> messages are rewritten.  This means, however, that certain arguments, or
> parts thereof, will be rewritten *again*.  This can be seen by adding a
> '[EMAIL PROTECTED] value' => '[EMAIL PROTECTED]' rewrite rule.  I'll add this 
> to ptrtests.st
> later.

I've named the two issues non-messages-are-found and rsic-doesnt-copy,
respectively.  Below are three new tests demonstrating three situations.

If you agree that both issues should be fixed, attached is a patch that
fixes them.  They succeed against a different version of the tests in:

http://scompall.nocandysw.com/gst/ptrtests-post-nmaf+rdc.st

Meanwhile, from http://scompall.nocandysw.com/gst/ptrtests.st :

    [| rsicCopiesPRewriter sourceExp |
     rsicCopiesPRewriter := self rewriterClass new
           replace: '[EMAIL PROTECTED] display: [EMAIL PROTECTED]' with: 
'[EMAIL PROTECTED]';
           replace: '[EMAIL PROTECTED] value' with: '[EMAIL PROTECTED]';
           yourself.
     sourceExp := RBParser parseExpression:
         'qqq display: (qqq display: sss value value);
              display: [qqq display: sss value value]'.
     self assert: (self rewriting: sourceExp
                        with: rsicCopiesPRewriter
                        yields:
                            'qqq display: (qqq display: sss value value);
                              display: [[sss value]]')
          description:
              'neither non-messages-are-found nor rsic-doesnt-copy fixed'.
     self deny: (self rewriting: sourceExp
                      with: rsicCopiesPRewriter
                      yields:
                          'qqq display: [sss value];
                            display: [[sss]]')
          description:
              'non-messages-are-found fixed, but not rsic-doesnt-copy'.
     self deny: (self rewriting: sourceExp
                      with: rsicCopiesPRewriter
                      yields:
                          'qqq display: [sss value];
                            display: [[sss value]]')
          description:
              'both non-messages-are-found and rsic-doesnt-copy fixed'.]
        value.

-- 
Stephen Compall
http://scompall.nocandysw.com/blog
--- orig/compiler/ParseTreeSearcher.st
+++ mod/compiler/ParseTreeSearcher.st
@@ -296,10 +296,7 @@
 !RBSmallDictionary class methodsFor: 'instance creation'!
 
 new
-    ^self new: 2!
-
-new: anInteger
-    ^(self basicNew: anInteger) initialize: anInteger! !
+    ^self new: 2! !
 
 
 RBProgramNodeVisitor subclass: #ParseTreeSearcher
@@ -750,7 +747,7 @@
 	    [:key :value | 
 	    (key isString not and: [key recurseInto]) 
 		ifTrue: 
-		    [oldContext at: key put: (value collect: [:each | self visitNode: each])]]! !
+		    [oldContext at: key put: (value collect: [:each | self visitNode: each copy])]]! !
 
 !ParseTreeRewriter methodsFor: 'visiting'!
 
@@ -791,6 +788,7 @@
 			    [Transcript
 				show: 'Cannot replace message node inside of cascaded node with non-message node.';
 				cr.
+			    notFound add: each.
 			    newMessages add: each]]].
     notFound size == aCascadeNode messages size 
 	ifTrue: 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to