Skip to content

Commit d3cdc27

Browse files
committed
.
1 parent 30942cf commit d3cdc27

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

continue.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- Parameter environments now hang off their function environments so default-parameter `super`/`this` lookups see the right bindings, and sloppy generator methods coerce `this` to the realm global object; the object method definition default-super/sloppy-this generators are passing.
3333
- Named generator function expressions now skip the internal const name binding when a function-name environment already exists, so sloppy reassignments of the generator name are ignored instead of throwing (covers the generator `reassign-fn-name` and `scope-name-var-open` tests).
3434
- `yield*` now treats a delegated iterator's `throw` result with `done: true` as a normal completion, propagating the returned `value` and finalizing delegation instead of yielding again (fixes the `star-rhs-iter-thrw-res-*` throw/done cases).
35+
- GlobalDeclarationInstantiation now resolves restricted globals against the root global object (so `let undefined` is rejected even in strict wrappers), deletable direct-eval bindings no longer block later global lexical declarations, and function hoists on non-extensible globals throw a proper TypeError instead of null-refing in DefineFunctionScoped.
3536

3637
## Next Iteration Plan
3738
1. When resuming broader work, run a narrow Language filter outside `ArgumentsObject`/`Array_fromAsync` to find the next hot cluster (avoid full 43k sweep).

src/Asynkron.JsEngine/JsEnvironment.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,11 @@ public void DefineFunctionScoped(
221221

222222
if (!canDeclareFunction)
223223
{
224+
var existingConfig = existingDescriptor?.Configurable;
225+
var existingWritable = existingDescriptor?.Writable;
226+
var existingEnumerable = existingDescriptor?.Enumerable;
224227
LogRealm("DefineFunctionScoped cannot declare global function name={Name} existingConfig={Config} writable={Writable} enumerable={Enumerable}",
225-
name.Name, existingDescriptor.Configurable, existingDescriptor.Writable, existingDescriptor.Enumerable);
228+
name.Name, existingConfig, existingWritable, existingEnumerable);
226229
throw StandardLibrary.ThrowTypeError("Cannot redeclare non-configurable global function",
227230
context, context?.RealmState);
228231
}
@@ -907,13 +910,12 @@ internal bool HasRestrictedGlobalProperty(Symbol name)
907910
return false;
908911
}
909912

910-
if (!scope._values.TryGetValue(Symbol.This, out var thisBinding) ||
911-
thisBinding.Value is not JsObject globalObject)
913+
var descriptor = scope.GetGlobalOwnPropertyDescriptor(name, out var globalObject);
914+
if (globalObject is null)
912915
{
913916
return false;
914917
}
915918

916-
var descriptor = globalObject.GetOwnPropertyDescriptor(name.Name);
917919
if (descriptor is not null && !descriptor.Configurable)
918920
{
919921
return true;
@@ -999,6 +1001,13 @@ public bool HasVarDeclaration(Symbol name)
9991001
// Check if there's a non-lexical binding in _values
10001002
if (_values.TryGetValue(name, out var binding) && !binding.IsLexical)
10011003
{
1004+
if (binding.CanDelete && IsGlobalFunctionScope)
1005+
{
1006+
// Non-strict direct eval creates deletable global var bindings (configurable properties)
1007+
// which should not block future lexical declarations in GlobalDeclarationInstantiation.
1008+
return false;
1009+
}
1010+
10021011
return true;
10031012
}
10041013

0 commit comments

Comments
 (0)