Hi all,

With CVS version, the below code outputs "var x = 1  x = x + 1;" which I 
believe is incorrect.

            Parser p = new Parser(); 
            AstRoot ast = p.parse("function foo() {var x = 1; x = x + 1}", 
"<cmd>", 0); 
            FunctionNode f = (FunctionNode) ast.getFirstChild();
            System.out.println(f.toSource());


If "var" was removed, then the output is

  x = 1;
  x = x + 1;



The reason is VariableDeclaration.toSource() doesn't append ";\n" at the end, 
unlike ExpressionStatement

Is that on purpose?

Yours,
Ahmed
----
Blog: http://asashour.blogspot.com


      
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to