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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 part of dart._runtime; 4 part of dart._runtime;
5 5
6 bool _trapRuntimeErrors = true;
7
8 // Override, e.g., for testing
9 void trapRuntimeErrors(bool flag) {
10 _trapRuntimeErrors = flag;
11 }
12
6 throwCastError(object, actual, type) => JS('', '''(() => { 13 throwCastError(object, actual, type) => JS('', '''(() => {
7 debugger; 14 var found = $typeName($actual);
8 $throw_(new $CastErrorImplementation($object, 15 var expected = $typeName($type);
9 $typeName($actual), 16 if ($_trapRuntimeErrors) debugger;
10 $typeName($type))); 17 $throw_(new $CastErrorImplementation($object, found, expected));
11 })()'''); 18 })()''');
12 19
13 throwTypeError(object, actual, type) => JS('', '''(() => { 20 throwTypeError(object, actual, type) => JS('', '''(() => {
14 debugger; 21 var found = $typeName($actual);
15 $throw_(new $TypeErrorImplementation($object, 22 var expected = $typeName($type);
16 $typeName($actual), 23 if ($_trapRuntimeErrors) debugger;
17 $typeName($type))); 24 $throw_(new $TypeErrorImplementation($object, found, expected));
18 })()'''); 25 })()''');
19 26
20 throwStrongModeCastError(object, actual, type) => JS('', '''(() => { 27 throwStrongModeCastError(object, actual, type) => JS('', '''(() => {
21 debugger; 28 var found = $typeName($actual);
22 $throw_(new $StrongModeCastError($object, 29 var expected = $typeName($type);
23 $typeName($actual), 30 if ($_trapRuntimeErrors) debugger;
24 $typeName($type))); 31 $throw_(new $StrongModeCastError($object, found, expected));
25 })()'''); 32 })()''');
26 33
27 throwStrongModeTypeError(object, actual, type) => JS('', '''(() => { 34 throwStrongModeTypeError(object, actual, type) => JS('', '''(() => {
28 debugger; 35 var found = $typeName($actual);
29 $throw_(new $StrongModeTypeError($object, 36 var expected = $typeName($type);
30 $typeName($actual), 37 if ($_trapRuntimeErrors) debugger;
31 $typeName($type))); 38 $throw_(new $StrongModeTypeError($object, found, expected));
32 })()'''); 39 })()''');
33 40
34 throwUnimplementedError(message) => JS('', '''(() => { 41 throwUnimplementedError(message) => JS('', '''(() => {
35 debugger; 42 if ($_trapRuntimeErrors) debugger;
36 $throw_(new $UnimplementedError($message)); 43 $throw_(new $UnimplementedError($message));
37 })()'''); 44 })()''');
38 45
39 throwAssertionError([message]) => JS('', '''(() => { 46 throwAssertionError([message]) => JS('', '''(() => {
40 debugger; 47 if ($_trapRuntimeErrors) debugger;
41 let error = $message != null 48 let error = $message != null
42 ? new $AssertionErrorWithMessage($message()) 49 ? new $AssertionErrorWithMessage($message())
43 : new $AssertionError(); 50 : new $AssertionError();
44 $throw_(error); 51 $throw_(error);
45 })()'''); 52 })()''');
46 53
47 throwNullValueError() => JS('', '''(() => { 54 throwNullValueError() => JS('', '''(() => {
48 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought 55 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought
49 // to thread through method info, but that uglifies the code and can't 56 // to thread through method info, but that uglifies the code and can't
50 // actually be queried ... it only affects how the error is printed. 57 // actually be queried ... it only affects how the error is printed.
51 debugger; 58 if ($_trapRuntimeErrors) debugger;
52 $throw_(new $NoSuchMethodError(null, 59 $throw_(new $NoSuchMethodError(null,
53 new $Symbol('<Unexpected Null Value>'), null, null, null)); 60 new $Symbol('<Unexpected Null Value>'), null, null, null));
54 })()'''); 61 })()''');
OLDNEW
« 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