Skip to content

Distinguish block statement from expression statement of an object literal #2626

Open
@dcodeIO

Description

@dcodeIO

Right now, when encountering an open brace in a statement context, the parser simply assumes a block

{
  ...
}

whereas it is also possible that the respective open brace begins an expression statement of an object literal

{
  key: value
}

which can become arbitrarily nested before knowing given that key: may as well indicate a labeled statement:

{
  a: {
    b: {
      c; // here we know that these are labeled blocks
    }
  }
}

Given that there is nothing useful one can do right now with an object literal like this, this issue doesn't seem to be of high priority, but might become relevant in the future.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions