Skip to content

Commit 9a56bf1

Browse files
committed
.
1 parent 59232d0 commit 9a56bf1

19 files changed

+126
-41
lines changed

builtintests-todo.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,6 @@ Generated from failing/ecma262.testsession (BuiltInsTests section). Each entry l
724724
- **SharedArrayBuffer_prototype_slice** – 64 failing tests. Sample: built-ins/SharedArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js, built-ins/SharedArrayBuffer/prototype/slice/context-is-not-object.js, built-ins/SharedArrayBuffer/prototype/slice/descriptor.js.
725725
- **Statements_asyncFunction** – 2 failing tests. Sample: language/statements/async-function/unscopables-with-in-nested-fn.js, language/statements/async-function/unscopables-with.js.
726726
- **Statements_asyncGenerator** – 13 failing tests. Sample: language/statements/async-generator/eval-var-scope-syntax-err.js, language/statements/async-generator/unscopables-with-in-nested-fn.js, language/statements/async-generator/unscopables-with.js.
727-
- **Statements_awaitUsing** – 2 failing tests. Sample: language/statements/await-using/throws-if-initializer-not-object.js.
728727
- **Statements_break** – 2 failing tests. Sample: language/statements/break/S12.8_A7.js.
729728
- **Statements_class** – 24 failing tests. Sample: language/statements/class/accessor-name-inst-computed-yield-expr.js, language/statements/class/accessor-name-static-computed-yield-expr.js, language/statements/class/classelementname-abrupt-completion.js.
730729
- **Statements_class_accessorNameInst** – 2 failing tests. Sample: language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js.
@@ -785,7 +784,6 @@ Generated from failing/ecma262.testsession (BuiltInsTests section). Each entry l
785784
- **Statements_let_syntax** – 10 failing tests. Sample: language/statements/let/syntax/let-closure-inside-condition.js, language/statements/let/syntax/let-closure-inside-initialization.js, language/statements/let/syntax/let-closure-inside-next-expression.js.
786785
- **Statements_switch** – 55 failing tests. Sample: language/statements/switch/cptn-a-abrupt-empty.js, language/statements/switch/cptn-a-fall-thru-abrupt-empty.js, language/statements/switch/cptn-a-fall-thru-nrml.js.
787786
- **Statements_try** – 36 failing tests. Sample: language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws.js, language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws.js, language/statements/try/completion-values.js.
788-
- **Statements_using** – 2 failing tests. Sample: language/statements/using/throws-if-initializer-not-object.js.
789787
- **Statements_variable** – 12 failing tests. Sample: language/statements/variable/12.2.1-10-s.js, language/statements/variable/12.2.1-18-s.js, language/statements/variable/12.2.1-21-s.js.
790788
- **Statements_variable_dstr** – 2 failing tests. Sample: language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js, language/types/number/S8.5_A9.js.
791789
- **String** – 64 failing tests. Sample: built-ins/String/length.js, built-ins/String/numeric-properties.js, built-ins/String/prop-desc.js.

continue.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Private name assignments now route through private scope/brand resolution, so instance/static private setter brand-checks across multiple class evaluations (factory/eval/realm variants) are passing alongside the private static getter/setter cases.
2222
- Super() in derived class constructors now finds the owning `this` binding without triggering TDZ ReferenceErrors, so the `this-access-restriction` class definition cases are green in strict and sloppy mode.
2323
- Logical assignment short-circuits skip `PutValue` (including private refs/accessors), and RHS NamedEvaluation now applies to ||=/&&=/??= with identifier LHS, so the logical-assignment cluster (read-only/accessor/non-extensible and name inference) is green.
24+
- `using` and `await using` declarations parse correctly and throw TypeError on non-object initializers, so the explicit resource management statement cases now pass.
2425

2526
## Next Iteration Plan
2627
1. Re-run the Language suite to refresh the current failure set after the this-access/super binding fixes.

languagetests.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@
8989
Statements_asyncGenerator
9090
Statements_asyncGenerator("language/statements/async-generator/yield-star-async-from-sync-iterator-inaccessible.js",False)
9191
Statements_asyncGenerator("language/statements/async-generator/yield-star-async-from-sync-iterator-inaccessible.js",True)
92-
Statements_awaitUsing
93-
Statements_awaitUsing("language/statements/await-using/throws-if-initializer-not-object.js",False)
94-
Statements_awaitUsing("language/statements/await-using/throws-if-initializer-not-object.js",True)
9592
Statements_class_definition
9693
Statements_class_definition("language/statements/class/definition/constructable-but-no-prototype.js",False)
9794
Statements_class_definition("language/statements/class/definition/constructable-but-no-prototype.js",True)
@@ -145,9 +142,6 @@
145142
Statements_labeled("language/statements/labeled/value-yield-non-strict.js",False)
146143
Statements_switch
147144
Statements_switch("language/statements/switch/scope-lex-async-function.js",False)
148-
Statements_using
149-
Statements_using("language/statements/using/throws-if-initializer-not-object.js",False)
150-
Statements_using("language/statements/using/throws-if-initializer-not-object.js",True)
151145
Statements_variable
152146
Statements_variable("language/statements/variable/binding-resolution.js",False)
153147
Statements_variable_dstr

src/Asynkron.JsEngine/Ast/BindingTargetExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ private void AssignLoopBinding(object? value, JsEnvironment loopEnvironment,
2020
break;
2121
case VariableKind.Let:
2222
case VariableKind.Const:
23+
case VariableKind.Using:
24+
case VariableKind.AwaitUsing:
2325
DefineBindingTarget(target, value, loopEnvironment, context,
24-
declarationKind == VariableKind.Const);
26+
declarationKind is VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing);
2527
CollectSymbolsFromBinding(target, context.BlockedFunctionVarNames);
2628
break;
2729
default:

src/Asynkron.JsEngine/Ast/BlockStatementExtensions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ public static partial class TypedAstEvaluator
3939
// and throw ReferenceError if accessed before initialization.
4040
foreach (var stmt in block.Statements)
4141
{
42-
if (stmt is VariableDeclaration { Kind: VariableKind.Let or VariableKind.Const } lexDecl)
42+
if (stmt is VariableDeclaration
43+
{
44+
Kind: VariableKind.Let or VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing
45+
} lexDecl)
4346
{
44-
var isConst = lexDecl.Kind == VariableKind.Const;
47+
var isConst = lexDecl.Kind is VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing;
4548
foreach (var declarator in lexDecl.Declarators)
4649
{
4750
HoistLexicalBindingTargetForTdz(block, declarator.Target, scope, isConst);

src/Asynkron.JsEngine/Ast/ForEachStatementExtensions.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ public static partial class TypedAstEvaluator
1717
}
1818

1919
var iterableEnvironment = environment;
20-
if (statement.DeclarationKind is VariableKind.Let or VariableKind.Const)
20+
if (statement.DeclarationKind is VariableKind.Let or VariableKind.Const or VariableKind.Using
21+
or VariableKind.AwaitUsing)
2122
{
2223
iterableEnvironment = new JsEnvironment(environment, creatingSource: statement.Source,
2324
description: "for-each-head-tdz");
24-
statement.Target.CreateUninitializedLexicalBindings(iterableEnvironment,
25-
statement.DeclarationKind == VariableKind.Const);
25+
var isConstDeclaration = statement.DeclarationKind is VariableKind.Const or VariableKind.Using
26+
or VariableKind.AwaitUsing;
27+
statement.Target.CreateUninitializedLexicalBindings(iterableEnvironment, isConstDeclaration);
2628
}
2729

2830
var iterable = EvaluateExpression(statement.Iterable, iterableEnvironment, context);
@@ -86,6 +88,7 @@ statement.Body is BlockStatement b
8688
}
8789

8890
var iterationEnvironment = statement.DeclarationKind is VariableKind.Let or VariableKind.Const
91+
or VariableKind.Using or VariableKind.AwaitUsing
8992
? new JsEnvironment(loopEnvironment, creatingSource: statement.Source,
9093
description: "for-each-iteration")
9194
: loopEnvironment;
@@ -118,12 +121,14 @@ statement.Body is BlockStatement b
118121
EvaluationContext context, Symbol? loopLabel)
119122
{
120123
var iterableEnvironment = environment;
121-
if (statement.DeclarationKind is VariableKind.Let or VariableKind.Const)
124+
if (statement.DeclarationKind is VariableKind.Let or VariableKind.Const or VariableKind.Using
125+
or VariableKind.AwaitUsing)
122126
{
123127
iterableEnvironment = new JsEnvironment(environment, creatingSource: statement.Source,
124128
description: "for-each-head-tdz");
125-
statement.Target.CreateUninitializedLexicalBindings(iterableEnvironment,
126-
statement.DeclarationKind == VariableKind.Const);
129+
var isConstDeclaration = statement.DeclarationKind is VariableKind.Const or VariableKind.Using
130+
or VariableKind.AwaitUsing;
131+
statement.Target.CreateUninitializedLexicalBindings(iterableEnvironment, isConstDeclaration);
127132
}
128133

129134
var iterable = EvaluateExpression(statement.Iterable, iterableEnvironment, context);

src/Asynkron.JsEngine/Ast/IteratorDriverPlanExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public static partial class TypedAstEvaluator
104104
}
105105

106106
var iterationEnvironment = plan.DeclarationKind is VariableKind.Let or VariableKind.Const
107+
or VariableKind.Using or VariableKind.AwaitUsing
107108
? new JsEnvironment(loopEnvironment, creatingSource: plan.Body.Source,
108109
description: "for-each-iteration")
109110
: loopEnvironment;
@@ -149,6 +150,7 @@ public static partial class TypedAstEvaluator
149150

150151
// Enumerator path (non-object next)
151152
var iterationEnvironment = plan.DeclarationKind is VariableKind.Let or VariableKind.Const
153+
or VariableKind.Using or VariableKind.AwaitUsing
152154
? new JsEnvironment(loopEnvironment, creatingSource: plan.Body.Source,
153155
description: "for-each-iteration")
154156
: loopEnvironment;

src/Asynkron.JsEngine/Ast/ProgramNodeExtensions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,11 @@ trueGlobalEnvironment is not null &&
191191
{
192192
switch (stmt)
193193
{
194-
case VariableDeclaration { Kind: VariableKind.Let or VariableKind.Const } lexDecl:
195-
var isConst = lexDecl.Kind == VariableKind.Const;
194+
case VariableDeclaration
195+
{
196+
Kind: VariableKind.Let or VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing
197+
} lexDecl:
198+
var isConst = lexDecl.Kind is VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing;
196199
foreach (var declarator in lexDecl.Declarators)
197200
{
198201
HoistLexicalBindingTargetForGlobalTdz(declarator.Target, executionEnvironment, isConst);
@@ -259,7 +262,10 @@ private static HashSet<Symbol> CollectTopLevelLexicalNames(ImmutableArray<Statem
259262
{
260263
switch (statement)
261264
{
262-
case VariableDeclaration { Kind: VariableKind.Let or VariableKind.Const } decl:
265+
case VariableDeclaration
266+
{
267+
Kind: VariableKind.Let or VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing
268+
} decl:
263269
foreach (var declarator in decl.Declarators)
264270
{
265271
CollectBindingNames(declarator.Target, names);

src/Asynkron.JsEngine/Ast/StatementNodeExtensions.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ private void CollectLexicalNamesFromStatement(HashSet<Symbol> names)
299299
}
300300

301301
break;
302-
case VariableDeclaration { Kind: VariableKind.Let or VariableKind.Const } letDecl:
302+
case VariableDeclaration
303+
{
304+
Kind: VariableKind.Let or VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing
305+
} letDecl:
303306
foreach (var declarator in letDecl.Declarators)
304307
{
305308
CollectSymbolsFromBinding(declarator.Target, names);
@@ -334,7 +337,7 @@ private void CollectLexicalNamesFromStatement(HashSet<Symbol> names)
334337
case ForStatement forStatement:
335338
if (forStatement.Initializer is VariableDeclaration
336339
{
337-
Kind: VariableKind.Let or VariableKind.Const
340+
Kind: VariableKind.Let or VariableKind.Const or VariableKind.Using or VariableKind.AwaitUsing
338341
} decl)
339342
{
340343
foreach (var declarator in decl.Declarators)
@@ -346,7 +349,8 @@ private void CollectLexicalNamesFromStatement(HashSet<Symbol> names)
346349
statement = forStatement.Body;
347350
continue;
348351
case ForEachStatement forEachStatement:
349-
if (forEachStatement.DeclarationKind is VariableKind.Let or VariableKind.Const)
352+
if (forEachStatement.DeclarationKind is VariableKind.Let or VariableKind.Const
353+
or VariableKind.Using or VariableKind.AwaitUsing)
350354
{
351355
CollectSymbolsFromBinding(forEachStatement.Target, names);
352356
}

src/Asynkron.JsEngine/Ast/Statements.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public enum VariableKind
2424
{
2525
Var,
2626
Let,
27-
Const
27+
Const,
28+
Using,
29+
AwaitUsing
2830
}
2931

3032
/// <summary>

0 commit comments

Comments
 (0)