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

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

Issue 2752163002: Format all dart dev compiler files (Closed)
Patch Set: Created 3 years, 9 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; 6 bool _trapRuntimeErrors = true;
7 bool _ignoreWhitelistedErrors = true; 7 bool _ignoreWhitelistedErrors = true;
8 8
9 // Override, e.g., for testing 9 // Override, e.g., for testing
10 void trapRuntimeErrors(bool flag) { 10 void trapRuntimeErrors(bool flag) {
11 _trapRuntimeErrors = flag; 11 _trapRuntimeErrors = flag;
12 } 12 }
13 13
14 void ignoreWhitelistedErrors(bool flag) { 14 void ignoreWhitelistedErrors(bool flag) {
15 _ignoreWhitelistedErrors = flag; 15 _ignoreWhitelistedErrors = flag;
16 } 16 }
17 17
18 throwCastError(object, actual, type) => JS('', '''(() => { 18 throwCastError(object, actual, type) => JS(
19 '',
20 '''(() => {
19 var found = $typeName($actual); 21 var found = $typeName($actual);
20 var expected = $typeName($type); 22 var expected = $typeName($type);
21 if ($_trapRuntimeErrors) debugger; 23 if ($_trapRuntimeErrors) debugger;
22 $throw_(new $CastErrorImplementation($object, found, expected)); 24 $throw_(new $CastErrorImplementation($object, found, expected));
23 })()'''); 25 })()''');
24 26
25 throwTypeError(object, actual, type) => JS('', '''(() => { 27 throwTypeError(object, actual, type) => JS(
28 '',
29 '''(() => {
26 var found = $typeName($actual); 30 var found = $typeName($actual);
27 var expected = $typeName($type); 31 var expected = $typeName($type);
28 if ($_trapRuntimeErrors) debugger; 32 if ($_trapRuntimeErrors) debugger;
29 $throw_(new $TypeErrorImplementation($object, found, expected)); 33 $throw_(new $TypeErrorImplementation($object, found, expected));
30 })()'''); 34 })()''');
31 35
32 throwStrongModeCastError(object, actual, type) => JS('', '''(() => { 36 throwStrongModeCastError(object, actual, type) => JS(
37 '',
38 '''(() => {
33 var found = $typeName($actual); 39 var found = $typeName($actual);
34 var expected = $typeName($type); 40 var expected = $typeName($type);
35 if ($_trapRuntimeErrors) debugger; 41 if ($_trapRuntimeErrors) debugger;
36 $throw_(new $StrongModeCastError($object, found, expected)); 42 $throw_(new $StrongModeCastError($object, found, expected));
37 })()'''); 43 })()''');
38 44
39 throwStrongModeTypeError(object, actual, type) => JS('', '''(() => { 45 throwStrongModeTypeError(object, actual, type) => JS(
46 '',
47 '''(() => {
40 var found = $typeName($actual); 48 var found = $typeName($actual);
41 var expected = $typeName($type); 49 var expected = $typeName($type);
42 if ($_trapRuntimeErrors) debugger; 50 if ($_trapRuntimeErrors) debugger;
43 $throw_(new $StrongModeTypeError($object, found, expected)); 51 $throw_(new $StrongModeTypeError($object, found, expected));
44 })()'''); 52 })()''');
45 53
46 throwUnimplementedError(message) => JS('', '''(() => { 54 throwUnimplementedError(message) => JS(
55 '',
56 '''(() => {
47 if ($_trapRuntimeErrors) debugger; 57 if ($_trapRuntimeErrors) debugger;
48 $throw_(new $UnimplementedError($message)); 58 $throw_(new $UnimplementedError($message));
49 })()'''); 59 })()''');
50 60
51 throwAssertionError([message]) => JS('', '''(() => { 61 throwAssertionError([message]) => JS(
62 '',
63 '''(() => {
52 if ($_trapRuntimeErrors) debugger; 64 if ($_trapRuntimeErrors) debugger;
53 let error = $message != null 65 let error = $message != null
54 ? new $AssertionErrorWithMessage($message()) 66 ? new $AssertionErrorWithMessage($message())
55 : new $AssertionError(); 67 : new $AssertionError();
56 $throw_(error); 68 $throw_(error);
57 })()'''); 69 })()''');
58 70
59 throwNullValueError() => JS('', '''(() => { 71 throwNullValueError() => JS(
72 '',
73 '''(() => {
60 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought 74 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought
61 // to thread through method info, but that uglifies the code and can't 75 // to thread through method info, but that uglifies the code and can't
62 // actually be queried ... it only affects how the error is printed. 76 // actually be queried ... it only affects how the error is printed.
63 if ($_trapRuntimeErrors) debugger; 77 if ($_trapRuntimeErrors) debugger;
64 $throw_(new $NoSuchMethodError(null, 78 $throw_(new $NoSuchMethodError(null,
65 new $Symbol('<Unexpected Null Value>'), null, null, null)); 79 new $Symbol('<Unexpected Null Value>'), null, null, null));
66 })()'''); 80 })()''');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698