OLD | NEW |
---|---|
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 bool _failForWeakModeIsChecks = true; | 8 bool _failForWeakModeIsChecks = true; |
9 | 9 |
10 // Override, e.g., for testing | 10 // Override, e.g., for testing |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 throwAssertionError([message]) => JS( | 81 throwAssertionError([message]) => JS( |
82 '', | 82 '', |
83 '''(() => { | 83 '''(() => { |
84 if ($_trapRuntimeErrors) debugger; | 84 if ($_trapRuntimeErrors) debugger; |
85 let error = $message != null | 85 let error = $message != null |
86 ? new $AssertionErrorWithMessage($message()) | 86 ? new $AssertionErrorWithMessage($message()) |
87 : new $AssertionError(); | 87 : new $AssertionError(); |
88 $throw_(error); | 88 $throw_(error); |
89 })()'''); | 89 })()'''); |
90 | 90 |
91 throwCyclicInitializationError([message]) => JS( | |
Jennifer Messerly
2017/05/05 23:59:15
I know this is the style of all these helpers but
vsm
2017/05/08 17:07:44
Done.
| |
92 '', | |
93 '''(() => { | |
94 if ($_trapRuntimeErrors) debugger; | |
95 $throw_(new $CyclicInitializationError($message)); | |
96 })()'''); | |
97 | |
91 throwNullValueError() => JS( | 98 throwNullValueError() => JS( |
92 '', | 99 '', |
93 '''(() => { | 100 '''(() => { |
94 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought | 101 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought |
95 // to thread through method info, but that uglifies the code and can't | 102 // to thread through method info, but that uglifies the code and can't |
96 // actually be queried ... it only affects how the error is printed. | 103 // actually be queried ... it only affects how the error is printed. |
97 if ($_trapRuntimeErrors) debugger; | 104 if ($_trapRuntimeErrors) debugger; |
98 $throw_(new $NoSuchMethodError(null, | 105 $throw_(new $NoSuchMethodError(null, |
99 new $Symbol('<Unexpected Null Value>'), null, null, null)); | 106 new $Symbol('<Unexpected Null Value>'), null, null, null)); |
100 })()'''); | 107 })()'''); |
101 | 108 |
102 throwNoSuchMethodError( | 109 throwNoSuchMethodError( |
103 receiver, memberName, positionalArguments, namedArguments) => | 110 receiver, memberName, positionalArguments, namedArguments) => |
104 JS( | 111 JS( |
105 '', | 112 '', |
106 '''(() => { | 113 '''(() => { |
107 if ($_trapRuntimeErrors) debugger; | 114 if ($_trapRuntimeErrors) debugger; |
108 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $ namedArguments)); | 115 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $ namedArguments)); |
109 })()'''); | 116 })()'''); |
OLD | NEW |