jquery / esprima

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

Parsing `-999999984306749440;` turns into `999999984306749400` #2118

Closed modulovalue closed 2 years ago

modulovalue commented 2 years ago

See: https://esprima.org/demo/parse.html?code=-999999984306749440%3B

Source:

-999999984306749440;

Syntax tab:

{
  "type": "Program",
  "body": [
    {
      "type": "ExpressionStatement",
      "expression": {
        "type": "UnaryExpression",
        "operator": "-",
        "argument": {
          "type": "Literal",
          "value": 999999984306749400,
          "raw": "999999984306749440"
        },
        "prefix": true
      }
    }
  ],
  "sourceType": "script"
}

Notice how the value is not 999999984306749440 but 999999984306749400

modulovalue commented 2 years ago

Sorry for the false alarm, I suppose that's just how JS works. :/