Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: test/mjsunit/regress/regress-131994.js

Issue 10585002: Correctly resolve local var shadowing a context-allocated var in debugger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698