| Index: test/mjsunit/regress/regress-131994.js
|
| diff --git a/test/mjsunit/regress/regress-119609.js b/test/mjsunit/regress/regress-131994.js
|
| similarity index 73%
|
| copy from test/mjsunit/regress/regress-119609.js
|
| copy to test/mjsunit/regress/regress-131994.js
|
| index 99041adaf435cfd0a90f973404452e5fcf2fbfbf..8347653a941da257d501277f986ee301a1967f87 100644
|
| --- a/test/mjsunit/regress/regress-119609.js
|
| +++ b/test/mjsunit/regress/regress-131994.js
|
| @@ -27,45 +27,44 @@
|
|
|
| // Flags: --expose-debug-as debug
|
|
|
| +// Test that a variable in the local scope that shadows a context-allocated
|
| +// variable is correctly resolved when being evaluated in the debugger.
|
| +
|
| Debug = debug.Debug;
|
|
|
| var exception = false;
|
|
|
| function listener(event, exec_state, event_data, data) {
|
| + if (event != Debug.DebugEvent.Break) return;
|
| + var breakpoint = exec_state.frame(0);
|
| try {
|
| - if (event == Debug.DebugEvent.Break) {
|
| - function lookup(name) {
|
| - return exec_state.frame(0).evaluate(name).value();
|
| - }
|
| -
|
| - assertEquals(3, lookup("e"));
|
| - assertEquals(4, lookup("f"));
|
| - assertEquals(1, lookup("a"));
|
| -
|
| - try {
|
| - assertEquals(2, lookup("b"));
|
| - } catch (e) {
|
| - assertEquals("ReferenceError: b is not defined", e.toString());
|
| - }
|
| - }
|
| + // Assert correct break point.
|
| + assertTrue(breakpoint.sourceLineText().indexOf("// Break") > -1);
|
| + // Assert correct value.
|
| + assertEquals(3, breakpoint.evaluate('x').value());
|
| } catch (e) {
|
| - exception = e.toString() + e.stack;
|
| + exception = e;
|
| }
|
| }
|
|
|
| Debug.setListener(listener);
|
|
|
| -function f(a, b) {
|
| - var c = 3;
|
| - function d(e, f) {
|
| - var g = a;
|
| - var h = c;
|
| - debugger;
|
| - }
|
| +function h() {
|
| + var x; // Context-allocated due to g().
|
|
|
| - return d;
|
| + var g = function g() {
|
| + x = -7;
|
| + };
|
| +
|
| + var f = function f() {
|
| + var x = 3; // Allocated in the local scope.
|
| + debugger; // Break.
|
| + };
|
| +
|
| + f();
|
| }
|
|
|
| -f(1, 2)(3, 4);
|
| +h();
|
|
|
| assertFalse(exception);
|
| +
|
|
|