Issue metadata
Sign in to add a comment
|
Inherited argument variables in nested functions appear to be treated differently in the debugger
Reported by
lolbum...@gmail.com,
Jul 25 2017
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Steps to reproduce the problem:
1. Open the console
2. Run the following code:
```
var foo = function(bar) {
return {
baz: function() {
[1, 2, 3, 4, 5].forEach(function() {
debugger;
});
}
}
};
var x = foo('hello');
x.baz();
```
3. When the debugger hits, attempt to get the value of bar.
What is the expected behavior?
The console should yield `hello`.
What went wrong?
Uncaught ReferenceError: bar is not defined
at eval (eval at <anonymous> (:5:17), <anonymous>:1:1)
at <anonymous>:5:17
at Array.forEach (<anonymous>)
at Object.baz (<anonymous>:4:29)
at <anonymous>:11:3
Did this work before? N/A
Chrome version: 59.0.3071.115 Channel: stable
OS Version: OS X 10.12.5
Flash Version:
If you reference bar anywhere inside of that function before the debugger, all works as expected.
,
Jul 27 2017
This is a known problem: since |bar| is not used anywhere it is optimized out by V8. This makes it impossible to reference it using debugger. Not sure what's the plan here, and even if we can do anything. Alexey? Note that easy workaround is to set a breakpoint directly in |foo|, so that |bar| parameter is available.
,
Oct 12 2017
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by nyerramilli@chromium.org
, Jul 26 2017