Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 133e011511b5b82e015c005ac961fab21b4ce825
https://github.com/WebKit/WebKit/commit/133e011511b5b82e015c005ac961fab21b4ce825
Author: Alexey Shvayka <[email protected]>
Date: 2023-09-29 (Fri, 29 Sep 2023)
Changed paths:
M JSTests/test262/expectations.yaml
M LayoutTests/js/parser-syntax-check-expected.txt
M LayoutTests/js/script-tests/parser-syntax-check.js
M Source/JavaScriptCore/parser/Parser.h
Log Message:
-----------
[JSC] Block-level function declarations shouldn't be allowed to shadow `var`
bindings
https://bugs.webkit.org/show_bug.cgi?id=262330
<rdar://problem/116202546>
Reviewed by Yusuke Suzuki and Justin Michaud.
This change aligns non-`var` case of declareFunction() with
declareLexicalVariable() to throw a
SyntaxError if a block-level function declaration would shadow a `var` binding,
previously declared
in this or in a nested scope.
The early error is specified here [1], while the fact of FunctionDeclaration
being lexical is
described here [2].
Aligns JSC with V8 and SpiderMonkey.
[1]: https://tc39.es/ecma262/#sec-block-static-semantics-early-errors
[2]: https://tc39.es/ecma262/#sec-static-semantics-lexicallydeclarednames
* JSTests/test262/expectations.yaml: Mark 24 tests as passing.
* LayoutTests/js/parser-syntax-check-expected.txt:
* LayoutTests/js/script-tests/parser-syntax-check.js:
* Source/JavaScriptCore/parser/Parser.h:
(JSC::Scope::declareFunction):
Canonical link: https://commits.webkit.org/268634@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes