Bug 33849 - const decl shadowing
Summary: const decl shadowing
Status: RESOLVED DUPLICATE of bug 31813
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-19 10:58 PST by anton muhin
Modified: 2012-03-07 00:33 PST (History)
5 users (show)

See Also:


Attachments
Small test to see how var and const declared properties are shadowed in various browsers (761 bytes, text/html)
2010-01-19 10:58 PST, anton muhin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description anton muhin 2010-01-19 10:58:09 PST
Created attachment 46928 [details]
Small test to see how var and const declared properties are shadowed in various browsers

http://trac.webkit.org/changeset/47062 added a layout test to check that shadowing of const declared properties on global object is impossible.  However most of other browsers behave differently---attached HTML shows that FF, Opera and Safari allow to shadow both var and const declared properties (IE8 didn't output anything)---and only Safari forbids shadowing of const properties.

Semantics of shadowing/constness is not quite obvious, so it might be easily not a bug though.
Comment 1 anton muhin 2010-01-19 10:59:21 PST
(In reply to comment #0)
> Created an attachment (id=46928) [details]
> Small test to see how var and const declared properties are shadowed in various
> browsers
> 
> http://trac.webkit.org/changeset/47062 added a layout test to check that
> shadowing of const declared properties on global object is impossible.  However
> most of other browsers behave differently---attached HTML shows that FF, Opera
> and Safari allow to shadow both var and const declared properties (IE8 didn't
> output anything)---and only Safari forbids shadowing of const properties.
> 
> Semantics of shadowing/constness is not quite obvious, so it might be easily
> not a bug though.

Correction: FF, Opera and <Chromium> allow to shadow both var and const declared properties.
Comment 2 Gavin Barraclough 2012-03-07 00:33:04 PST
We should resolved this by implementing ES Harmony block scoped const.

*** This bug has been marked as a duplicate of bug 31813 ***