tc39/proposal-explicit-resource-management

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

lgalfaso opened this issue · 1 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.