Skip to content

Commit 64cf17b

Browse files
committed
.
1 parent b578f40 commit 64cf17b

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

continue.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
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.
2424
- Array index assignments now walk prototype accessors/writable descriptors (including inherited setters) before falling back to element storage, so member-expression for-in targets trigger Array.prototype setters and typed array for-in over resizable buffers enumerates the expected indices.
2525
- `using` and `await using` declarations still TypeError on non-object initializers but now allow initializer-less for-in/of heads with per-iteration lexical environments, so the TDZ/fresh-binding for-of cases are green.
26+
- Typed array subclass instances now report their concrete @@toStringTag, generator/async generator functions (and their bound/proxy wrappers) are treated as non-constructors during class heritage resolution, and derived classes extending null leave `this` uninitialized until super, so the class subclass builtins/null-proto/generator superclass cases are green.
2627

2728
## Next Iteration Plan
2829
1. Re-run the Language suite to refresh the current failure set after the for-in/of using and array setter fixes.

src/Asynkron.JsEngine/Ast/TypedAstEvaluator.AsyncGeneratorFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public bool TryGetProperty(string name, object? receiver, out object? value)
218218
finalArgs[boundArgs.Count + i] = innerArgs[i];
219219

220220
return callable.Invoke(finalArgs, boundThis);
221-
}) { DisallowConstruct = true };
221+
}, _realmState, isConstructor: false) { DisallowConstruct = true };
222222
});
223223
return true;
224224
}

src/Asynkron.JsEngine/Ast/TypedAstEvaluator.TypedGeneratorFactory.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -210,27 +210,27 @@ public bool TryGetProperty(string name, object? receiver, out object? value)
210210
value = new HostFunction((_, args) =>
211211
{
212212
var boundThis = args.GetArgument(0);
213-
var boundArgs = args.SliceFrom(1);
213+
var boundArgs = args.SliceFrom(1);
214214

215-
// Generator functions are never constructors, so bound generator functions
216-
// must also have DisallowConstruct = true per ES spec.
217-
return new HostFunction((_, innerArgs) =>
218-
{
219-
if (boundArgs.Count == 0)
220-
return callable.Invoke(innerArgs, boundThis);
221-
if (innerArgs.Count == 0)
222-
return callable.Invoke(boundArgs, boundThis);
223-
224-
var finalArgs = new object?[boundArgs.Count + innerArgs.Count];
225-
for (var i = 0; i < boundArgs.Count; i++)
226-
finalArgs[i] = boundArgs[i];
227-
for (var i = 0; i < innerArgs.Count; i++)
228-
finalArgs[boundArgs.Count + i] = innerArgs[i];
229-
230-
return callable.Invoke(finalArgs, boundThis);
231-
}) { DisallowConstruct = true };
232-
});
233-
return true;
215+
// Generator functions are never constructors, so bound generator functions
216+
// must also have DisallowConstruct = true per ES spec.
217+
return new HostFunction((_, innerArgs) =>
218+
{
219+
if (boundArgs.Count == 0)
220+
return callable.Invoke(innerArgs, boundThis);
221+
if (innerArgs.Count == 0)
222+
return callable.Invoke(boundArgs, boundThis);
223+
224+
var finalArgs = new object?[boundArgs.Count + innerArgs.Count];
225+
for (var i = 0; i < boundArgs.Count; i++)
226+
finalArgs[i] = boundArgs[i];
227+
for (var i = 0; i < innerArgs.Count; i++)
228+
finalArgs[boundArgs.Count + i] = innerArgs[i];
229+
230+
return callable.Invoke(finalArgs, boundThis);
231+
}, _realmState, isConstructor: false) { DisallowConstruct = true };
232+
});
233+
return true;
234234
}
235235

236236
// Fall back to properties lookup for all other properties

src/Asynkron.JsEngine/JsTypes/HostFunction.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,12 @@ internal static HostFunction CreateBoundFunction(IJsCallable target, object? bou
347347
{
348348
var finalArgs = Combine(boundArgs, innerArgs);
349349
return target.Invoke(finalArgs, boundThis);
350-
}, realmState, isConstructor: targetIsConstructor)
350+
}, realmState, isConstructor: false)
351351
{
352-
IsBoundFunction = true
352+
IsBoundFunction = true,
353+
IsConstructor = targetIsConstructor
353354
};
354355

355-
boundFunction.PropertiesObject.DeleteOwnProperty("prototype");
356-
357356
boundFunction.SetInvokeWithContext((invokeArgs, _, context, newTarget) =>
358357
{
359358
var finalArgs = Combine(boundArgs, invokeArgs);
@@ -424,7 +423,7 @@ private void InitializePrototype()
424423

425424
private void EnsurePrototypeDataProperty()
426425
{
427-
if (!_isConstructor || HasPrototypeDataProperty())
426+
if (!_isConstructor || HasPrototypeDataProperty() || IsBoundFunction)
428427
{
429428
return;
430429
}

0 commit comments

Comments
 (0)