tc39 / proposal-explicit-resource-management

ECMAScript Explicit Resource Management

Home Page:https://arai-a.github.io/ecma262-compare/?pr=3000

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can an `ExpressionStatement` start with `using [` ?

lgalfaso opened this issue · comments

If this proposal were to be accepted, can an ExpressionStatement start with using [?

Eg, how should the code below be interpreted?

function foo() {
  return {};
}

const a = 1;
var using = [];
{
  using [a] = foo();
}

There is currently nothing in the proposal that adds a restriction on ExpressionStatement to prevent an ExpressionStatement to start with using [. This implies that the line using [a] = foo(); can be interpreted as an ExpressionStatement and as a UsingDeclaration.

I just notice that there is a new parameter Pattern in BindingList that would prevent this from being interpreted as a UsingDeclaration. Sorry for the noise.