On 5/10/16, 2:40 AM, "Harbs" <harbs.li...@gmail.com> wrote:

>I’m not sure I totally understand the pattern:
>
>                       else if (node.getNodeID() == ASTNodeID.Op_AddAssignID)
>                       {
>                           getWalker().walk(xmlNode);
>                           write(".concat(");
>                           getWalker().walk(node.getRightOperandNode());
>                           write(ASEmitterTokens.PAREN_CLOSE);
>                           return;
>                       }
>                       else if (node.getNodeID() == ASTNodeID.Op_AddID)
>                       {
>                           getWalker().walk(xmlNode);
>                           write(".copy().concat(");
>                           getWalker().walk(node.getRightOperandNode());
>                           write(ASEmitterTokens.PAREN_CLOSE);
>                           return;
>                       }
>I think there’s two changes which need to happen. One seems easy:
>write(".copy().concat(“); needs to become write(“.plus(“);
>
>However, for ASTNodeID.Op_AddAssignID we need to add in foo = foo before
>the plus. I’m not sure what I need to do for that. I tried figuring out
>what’s happening in getWalker.walk(), but after a few minutes my limited
>attention span lost it… ;-)

I would first just try changing that to plus() as well. Then compile it
and see if the output is correct or not.  If not we can discuss more.  In
theory, the left hand side "foo" was already emitted.  Is plus() going to
modify foo() or return a copy of the modified results()?  IOW, what is the
full JS you want generated for foo += bar?

-Alex

Reply via email to