Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression after do/while #102

Closed
neumatho opened this issue Oct 12, 2020 · 1 comment
Closed

Expression after do/while #102

neumatho opened this issue Oct 12, 2020 · 1 comment

Comments

@neumatho
Copy link

Hi,

The following statement cannot be parsed in Meriyah, while both Acorn and Esprima parses it without problems.

{ do { } while (false) false }

Here is the result from Acorn which should be returned:

{
  "type": "Program",
  "start": 0,
  "end": 30,
  "body": [
    {
      "type": "BlockStatement",
      "start": 0,
      "end": 30,
      "body": [
        {
          "type": "DoWhileStatement",
          "start": 2,
          "end": 22,
          "body": {
            "type": "BlockStatement",
            "start": 5,
            "end": 8,
            "body": []
          },
          "test": {
            "type": "Literal",
            "start": 16,
            "end": 21,
            "value": false,
            "raw": "false"
          }
        },
        {
          "type": "ExpressionStatement",
          "start": 23,
          "end": 28,
          "expression": {
            "type": "Literal",
            "start": 23,
            "end": 28,
            "value": false,
            "raw": "false"
          }
        }
      ]
    }
  ],
  "sourceType": "module"
}

-Thomas

@3cp
Copy link
Member

3cp commented Oct 15, 2020

@KFlash sorry, we didn't force it. I will add the missing implementation for the spec.

The previous token is ) and the inserted semicolon would then be parsed as the terminating semicolon of a do-while statement (13.7.2).

@3cp 3cp closed this as completed in faa96bb Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants