Re-resolve unresolvable references on the global in PutValue. Supports tc39/ecma262#2205

This commit is contained in:
Rick Waldron 2020-11-02 14:57:08 -05:00
parent 20b11bee0f
commit 4caf66a5cc
2 changed files with 25 additions and 5 deletions

View File

@ -3,18 +3,18 @@
/*---
esid: sec-initializeboundname
description: >
In strict mode code, attempts to assign to an unresolvable reference must throw a ReferenceError exception
In strict mode code, re-resolve unresolvable references on the global in PutValue.
info: |
via sec-putvalue
If IsUnresolvableReference(V) is true, then
If IsStrictReference(V) is true, then
Throw a ReferenceError exception.
Let realm be the current Realm Record.
Set V to ? ResolveBinding(realm.[[GlobalEnv]], name).
Assert: IsStrictReference(V) is true.
If IsUnresolvableReference(V) is true, throw a ReferenceError exception.
flags: [onlyStrict]
negative:
phase: runtime
type: ReferenceError
---*/
undeclared = (this.undeclared = 5);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializeboundname
description: >
In strict mode code, re-resolve unresolvable references on the global in PutValue.
info: |
via sec-putvalue
If IsUnresolvableReference(V) is true, then
If IsStrictReference(V) is true, then
Let realm be the current Realm Record.
Set V to ? ResolveBinding(realm.[[GlobalEnv]], name).
Assert: IsStrictReference(V) is true.
If IsUnresolvableReference(V) is true, throw a ReferenceError exception.
flags: [onlyStrict]
---*/
undeclared = (globalThis.undeclared = 5);