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

Unified Diff: tests/standalone/debugger/local_function_test.dart

Issue 116223006: Fix setting breakpoint in non-finalized class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 12 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
« runtime/vm/debugger.cc ('K') | « runtime/vm/debugger.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/debugger/local_function_test.dart
===================================================================
--- tests/standalone/debugger/local_function_test.dart (revision 31442)
+++ tests/standalone/debugger/local_function_test.dart (working copy)
@@ -14,16 +14,38 @@
// Check that if a breakpoint is requested on the line containing the
// one-liner with a local function below, the breakpoint gets set in
// the outer function.
-foo(x) => (n) => x * n;
+foo(x) => (n) => x * n; // Breakpoint 1 on this line.
// Check that if a breakpoint is requested on the line "return n*x"
// below, the breakpoint is set in the local function (closure).
bar(x) {
return (n) {
- return n * x;
+ return n * x; // Breakpoint 2 on this line.
};
}
+// Check that setting a breakpoint works in the case where the
+// class has not been parsed yet.
+// No reference to class C must appear in main(), so that the class is not
+// yet parsed when the breakpoint in the closure nested in the constructor
+// is set.
+class C {
+ var closure;
+ C() {
+ closure = () {
+ var z = 10; // Breakpoint 3 on this line.
+ z = z * 2;
+ return z;
+ };
+ }
+}
+
+checkBpInLazilyParsedClass() {
+ var c = new C();
+ c.closure(); // Expected to hit breakpoint.
+}
+
+
main(List<String> arguments) {
if (RunScript(testScript, arguments)) return;
print("Hello from debuggee");
@@ -31,16 +53,20 @@
print(f(5));
var b = bar(10);
print(b(10)); // Hits breakpoint.
+ checkBpInLazilyParsedClass();
}
// Expected debugger events and commands.
var testScript = [
MatchFrame(0, "main"), // Top frame in trace is function "main".
- SetBreakpoint(17), // Set breakpoint in function foo.
- SetBreakpoint(23), // Set breakpoint in local function inside bar.
+ SetBreakpoint(17), // Breakpoint 1 in function foo.
+ SetBreakpoint(23), // Breakpoint 2 in local function inside bar.
+ SetBreakpoint(36), // Breakpoint 3 in local function inside constructor C.
Resume(),
MatchFrames(["foo", "main"]),
Resume(),
MatchFrames(["<anonymous closure>", "main"]),
- Resume()
+ Resume(),
+ MatchFrames(["C.<anonymous closure>", "checkBpInLazilyParsedClass"]),
+ Resume(),
];
« runtime/vm/debugger.cc ('K') | « runtime/vm/debugger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698