WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 148763
153441
Global lexical declarations should shadow configurable global properties
https://bugs.webkit.org/show_bug.cgi?id=153441
Summary
Global lexical declarations should shadow configurable global properties
Elliott Sprehn
Reported
2016-01-25 13:18:54 PST
ex. class Node { } SyntaxError: Can't create duplicate variable that shadows a global property: 'Node' but you can write var Node = class Node { } this works fine in Chrome and Firefox 45.
Attachments
Add attachment
proposed patch, testcase, etc.
Elliott Sprehn
Comment 1
2016-06-23 11:13:10 PDT
This is still broken, I think something is wrong in your lexical scoping.
Elliott Sprehn
Comment 2
2016-06-23 11:14:58 PDT
I just checked today's nightly:
r202375
and it still happens.
Adam Klein
Comment 3
2016-06-23 11:22:11 PDT
In general, it seems that JSC refuses to create lexical bindings that shadow configurable properties on the global object, contra the spec (see
https://tc39.github.io/ecma262/#sec-hasrestrictedglobalproperty
). Here's a DOM-less repro:
>>> let Array = 5
Exception: SyntaxError: Can't create duplicate variable that shadows a global property: 'Array' or one with a self-created property:
>>> Object.defineProperty(this, 'foo', {value: 5, configurable: true, writable: true})
[object global]
>>> let foo = 10
Exception: SyntaxError: Can't create duplicate variable that shadows a global property: 'Foo'
Saam Barati
Comment 4
2016-06-23 11:30:12 PDT
*** This bug has been marked as a duplicate of
bug 148763
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug