Bug 220142 - A possible issue about variable redeclaration
Summary: A possible issue about variable redeclaration
Status: RESOLVED DUPLICATE of bug 163209
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-24 05:20 PST by Yang Tian
Modified: 2020-12-31 12:28 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yang Tian 2020-12-24 05:20:53 PST
# Version
d940b47(https://github.com/WebKit/WebKit-http/commit/d940b477848884f63752d25491d9dd0b9d3ccb2d)

# Testcase1:
// Will throw an SyntaxError
function func() {
    if (1) {
        function o() {}
        var o = 1;
    }
}

# Testcase2:
// Will not throw an SyntaxError
if (1) {
    function o() {};
    var o = 1;
}

# Description
In both of the above examples, an variable 'o' declaration error occurred, however Testcase1 throws an exception and Testcase2 doesn't.

I've tried other engines(such as V8, SpiderMonkey), and they all throw SyntaxError, So i suspect it's a bug of jsc.

Please let me know the result whether this is a bug or not. Looking forward to your reply, thanks! 😆
Comment 1 Radar WebKit Bug Importer 2020-12-31 05:21:13 PST
<rdar://problem/72754003>
Comment 2 Yusuke Suzuki 2020-12-31 12:28:26 PST
Thanks, this is dupe of 163209 :)

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