Issue metadata
Sign in to add a comment
|
Syntax error when declaring a function within conditional scope
Reported by
tomh...@gmail.com,
Mar 7 2016
|
||||||||||||||||||||||
Issue description
Chrome Version : 49.0.2623.75 m
Other browsers tested:
Chrome: OK version 48.0.2564.116 m
Safari: OK 9.01 (10601.2.7.2)
IE: OK version 11.0.960017207
What steps will reproduce the problem?
1. Try to open the following page in Chrome 49
<html>
<head>
<title></title>
</head>
<body>
<script>
if (true) {
var test = new test();
function test() { }
}
</script>
</body>
</html>
What is the expected result?
No syntax errors
What happens instead?
Syntax errors
"Uncaught SyntaxError: Identifier 'test' has already been declared"
Please provide any additional information below. Attach a screenshot if
possible.
,
Mar 16 2016
https://codereview.chromium.org/1530643003 is unrelated. It looks v8 roll is supicious. https://chromium.googlesource.com/chromium/src/+/738ab011f3ba03a698ba51e8a525b41a3605e33d tkonchada@, could you reassign this to V8 guy?
,
Mar 16 2016
hayato@, Sure. Thanks for the update hablich@, Could you please take a look
,
Mar 16 2016
I could be wrong, but this looks like working as intended.
For the following script:
if (true) {
function test() { }
}
We resolve the scopes like this:
global { // (0, 1412)
// scope has trivial outer context
// 2 stack slots
// temporary vars:
TEMPORARY .result; // local[1]
// local vars:
VAR test; //
block { // (1317, 1411)
// scope has trivial outer context
// local vars:
LET test; // local[0]
function test () { // (1391, 1397)
// scope has trivial outer context
// local vars:
}
}
}
The if-body is a sloppy block scope. Functions defined in it are local let-variables. Defining another var-variable with the same name fails.
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by tkonch...@chromium.org
, Mar 16 2016Components: Blink>HTML
Labels: -Type-Bug -Pri-3 ReleaseBlock-Stable M-51 OS-Windows Pri-1 Type-Bug-Regression
Owner: hayato@chromium.org
Status: Assigned (was: Unconfirmed)