New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 592548 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug-Regression



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.


 
example.png
68.9 KB View Download
Cc: tkent@chromium.org kochi@chromium.org
Components: 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)
Able to reproduce the issue on win8.1 chrome version 49.0.2623.87 and canary

This is working fine in 48.0.2564.116 

This got regressed in M49 and bisect results are below

Manual Bisect:
Good Build: 49.0.2614.0 
Bad Build: 49.0.2615.0

Bisect Tool Info
You are probably looking for a change made after 367788 (known good), but no later than 367792 (first known bad).
CHANGELOG URL:
  https://chromium.googlesource.com/chromium/src/+log/58c142c6eccd0287edcf0194391f785e45a8de92..a4231e4994a90b513122bdb9a58069d26938849f

Possible suspect : https://codereview.chromium.org/1530643003

Please reasssign if this is not related to your change.

Comment 2 by hayato@chromium.org, Mar 16 2016

Cc: -tkent@chromium.org -kochi@chromium.org
Components: -Blink>HTML Blink>JavaScript
Owner: tkonch...@chromium.org
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?



Cc: yangguo@chromium.org vogelheim@chromium.org machenb...@chromium.org
Owner: hablich@chromium.org
hayato@, Sure. Thanks for the update

hablich@, Could you please take a look
Cc: -machenb...@chromium.org -vogelheim@chromium.org rossberg@chromium.org
Status: WontFix (was: Assigned)
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