-
-
Notifications
You must be signed in to change notification settings - Fork 641
Closed
Labels
Description
Explicit resource management proposal describes using
as describing "a synchronously-disposed, block-scoped resource". The intent of using
is that the resource is automatically disposed of at the end of the enclosing block, so block scoping makes sense.
Additionally, the proposal shows equivalent transpiled code as using a const
binding.
Currently Oxc generates a binding with symbol flags FunctionScopedVariable
, and hoists the binding to scope of enclosing function (like var
). I believe it should behave like const
- flags BlockScopedVariable | ConstVariable
, and the binding should not be hoisted.
function f() {
{
using x = 123;
}
}
In the above example, the binding x
should not be hoisted to top level of function f
.