Provide a dart2js implementation of dart:debugger

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1121293003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45577 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
alanknight@google.com 2015-05-06 22:36:01 +00:00
parent 37feb0c855
commit 6fe25b0578
3 changed files with 36 additions and 7 deletions

View file

@ -0,0 +1,32 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Patch file for dart:debugger library.
import 'dart:_js_helper' show patch;
import 'dart:_foreign_helper' show JS;
@patch class Debugger {
/// Stop the program as if a breakpoint where hit at the following statement.
/// NOTE: When invoked, the isolate will not return until a debugger
/// continues execution. When running in the Dart VM the behaviour is the same
/// regardless of whether or not a debugger is connected. When compiled to
/// JavaScript, this uses the "debugger" statement, and behaves exactly as
/// that does.
@patch
@ForceInline()
static void breakHere() {
JS('', 'debugger');
}
/// If [expr] is true, stop the program as if a breakpoint where hit at the
/// following statement. See [breakHere].
@patch
@ForceInline()
static void breakHereIf(bool expr) {
if (expr) {
breakHere();
}
}
}

View file

@ -56,7 +56,8 @@ const Map<String, LibraryInfo> LIBRARIES = const {
"debugger": const LibraryInfo(
"debugger/debugger.dart",
maturity: Maturity.UNSTABLE),
maturity: Maturity.UNSTABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/debugger_patch.dart"),
"html": const LibraryInfo(
"html/dartium/html_dartium.dart",

View file

@ -11,13 +11,9 @@ class Debugger {
/// NOTE: When invoked, the isolate will not return until a debugger
/// continues execution. The behaviour is the same regardless of whether or
/// not a debugger is connected.
static void breakHere() {
print('Debugger.breakHere not supported on this platform.');
}
external static void breakHere();
/// If [expr] is true, stop the program as if a breakpoint where hit at the
/// following statement.
static void breakHereIf(bool expr) {
print('Debugger.breakHereIf not supported on this platform.');
}
external static void breakHereIf(bool expr);
}