assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Distinguish block statement from expression statement of an object literal

Open dcodeIO opened this issue 2 years ago • 0 comments

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.

dcodeIO avatar Jan 20 '23 22:01 dcodeIO