You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
escodegen does not support the combination of unary minus and exponentiation:
➜arith2js-parallel-computing-group-parallel git:(essay-2023-02-15-miercoles)✗nodeWelcometoNode.jsv18.8.0.Type".help"formoreinformation.>letespree=require('espree')>letast=espree.parse('(-2)**2')// gives an error since the default compiler is ecma 5Uncaught[SyntaxError: Unexpectedtoken*>letast3=espree.parse('(-2)**2',{ecmaVersion: 7})// no errors. Right AST>letescodegen=require('escodegen')>letgc=escodegen.generate(ast3)// escodegen does not support this feature. The code generated is wrong>gc'-2 ** 2;'>eval(gc)// the evaluation of the code produces errorsUncaught:
SyntaxError: Unaryoperatorusedimmediatelybeforeexponentiationexpression.Parenthesismustbeusedtodisambiguateoperatorprecedence>-2**2 # JSdoesnotacceptthisexpression-2**2^^^^^Uncaught:
SyntaxError: Unaryoperatorusedimmediatelybeforeexponentiationexpression.Parenthesismustbeusedtodisambiguateoperatorprecedence>(-2)**2 # ... Butthiscodeworks4
The text was updated successfully, but these errors were encountered:
escodegen does not support the combination of unary minus and exponentiation:
The text was updated successfully, but these errors were encountered: