jquery / esprima

ECMAScript parsing infrastructure for multipurpose analysis
http://esprima.org
BSD 2-Clause "Simplified" License
7.04k stars 786 forks source link

Fix parsing error in exponent expressions with unary left-hand sides. #2070

Open luiscubal opened 3 years ago

luiscubal commented 3 years ago

Esprima (correctly) rejects expressions like -12. However, expressions like (-1)2 are valid but still rejected. This commit fixes this issue by identifying when the left operand is parenthesized.

Fixes https://github.com/jquery/esprima/issues/1981