Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we're expecting this test to execute, we should include an assertion for the result of the expression, like assert.sameValue(undeclared, 5);

Original file line number Diff line number Diff line change
@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how the globalThis binding is related to the normative change. By my reading, this test only differs from the existing test in that it also includes semantics that are verified by test/built-ins/global/global-object.js.