Fix two variants of Node::substitute().
authorMorgan Deters <mdeters@cs.nyu.edu>
Fri, 21 Feb 2014 19:45:52 +0000 (14:45 -0500)
committerMorgan Deters <mdeters@cs.nyu.edu>
Fri, 21 Feb 2014 20:06:14 +0000 (15:06 -0500)
Node::substitute() is overloaded.  One version was properly substituting
operators (e.g. the "f" in f(x) could be substituted).  The others were
ignoring anything in function position.  Fixed.  Thanks to Wei Wang for
pointing this out.

src/expr/node.h

index e7c51f0e211ac4512bd412e88b0c61c73d52e54b..9ada7879ce37fdfd2466994d619a70eaf947d0b3 100644 (file)
@@ -1376,7 +1376,9 @@ NodeTemplate<ref_count>::substitute(Iterator1 nodesBegin,
     NodeBuilder<> nb(getKind());
     if(getMetaKind() == kind::metakind::PARAMETERIZED) {
       // push the operator
-      nb << getOperator();
+      nb << getOperator().substitute(nodesBegin, nodesEnd,
+                                     replacementsBegin, replacementsEnd,
+                                     cache);
     }
     for(const_iterator i = begin(),
           iend = end();
@@ -1427,7 +1429,7 @@ NodeTemplate<ref_count>::substitute(Iterator substitutionsBegin,
     NodeBuilder<> nb(getKind());
     if(getMetaKind() == kind::metakind::PARAMETERIZED) {
       // push the operator
-      nb << getOperator();
+      nb << getOperator().substitute(substitutionsBegin, substitutionsEnd, cache);
     }
     for(const_iterator i = begin(),
           iend = end();