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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart

Issue 2621823002: Disable auto "debugger" call for tests (Closed)
Patch Set: Created 3 years, 11 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
Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
index 0f8d0b407f7c1577156d7aa6c405b79e426da9c4..49bc1cc11afb09fdf88249a0a93b02af77434ae4 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
@@ -3,41 +3,48 @@
// BSD-style license that can be found in the LICENSE file.
part of dart._runtime;
+bool _trapRuntimeErrors = true;
+
+// Override, e.g., for testing
+void trapRuntimeErrors(bool flag) {
+ _trapRuntimeErrors = flag;
+}
+
throwCastError(object, actual, type) => JS('', '''(() => {
- debugger;
- $throw_(new $CastErrorImplementation($object,
- $typeName($actual),
- $typeName($type)));
+ var found = $typeName($actual);
+ var expected = $typeName($type);
+ if ($_trapRuntimeErrors) debugger;
+ $throw_(new $CastErrorImplementation($object, found, expected));
})()''');
throwTypeError(object, actual, type) => JS('', '''(() => {
- debugger;
- $throw_(new $TypeErrorImplementation($object,
- $typeName($actual),
- $typeName($type)));
+ var found = $typeName($actual);
+ var expected = $typeName($type);
+ if ($_trapRuntimeErrors) debugger;
+ $throw_(new $TypeErrorImplementation($object, found, expected));
})()''');
throwStrongModeCastError(object, actual, type) => JS('', '''(() => {
- debugger;
- $throw_(new $StrongModeCastError($object,
- $typeName($actual),
- $typeName($type)));
+ var found = $typeName($actual);
+ var expected = $typeName($type);
+ if ($_trapRuntimeErrors) debugger;
+ $throw_(new $StrongModeCastError($object, found, expected));
})()''');
throwStrongModeTypeError(object, actual, type) => JS('', '''(() => {
- debugger;
- $throw_(new $StrongModeTypeError($object,
- $typeName($actual),
- $typeName($type)));
+ var found = $typeName($actual);
+ var expected = $typeName($type);
+ if ($_trapRuntimeErrors) debugger;
+ $throw_(new $StrongModeTypeError($object, found, expected));
})()''');
throwUnimplementedError(message) => JS('', '''(() => {
- debugger;
+ if ($_trapRuntimeErrors) debugger;
$throw_(new $UnimplementedError($message));
})()''');
throwAssertionError([message]) => JS('', '''(() => {
- debugger;
+ if ($_trapRuntimeErrors) debugger;
let error = $message != null
? new $AssertionErrorWithMessage($message())
: new $AssertionError();
@@ -48,7 +55,7 @@ throwNullValueError() => JS('', '''(() => {
// TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought
// to thread through method info, but that uglifies the code and can't
// actually be queried ... it only affects how the error is printed.
- debugger;
+ if ($_trapRuntimeErrors) debugger;
$throw_(new $NoSuchMethodError(null,
new $Symbol('<Unexpected Null Value>'), null, null, null));
})()''');
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698