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([String message]) { |
| 92 if (_trapRuntimeErrors) JS('', 'debugger'); |
| 93 throw new CyclicInitializationError(message); |
| 94 } |
| 95 |
91 throwNullValueError() => JS( | 96 throwNullValueError() => JS( |
92 '', | 97 '', |
93 '''(() => { | 98 '''(() => { |
94 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought | 99 // 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 | 100 // 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. | 101 // actually be queried ... it only affects how the error is printed. |
97 if ($_trapRuntimeErrors) debugger; | 102 if ($_trapRuntimeErrors) debugger; |
98 $throw_(new $NoSuchMethodError(null, | 103 $throw_(new $NoSuchMethodError(null, |
99 new $Symbol('<Unexpected Null Value>'), null, null, null)); | 104 new $Symbol('<Unexpected Null Value>'), null, null, null)); |
100 })()'''); | 105 })()'''); |
101 | 106 |
102 throwNoSuchMethodError( | 107 throwNoSuchMethodError( |
103 receiver, memberName, positionalArguments, namedArguments) => | 108 receiver, memberName, positionalArguments, namedArguments) => |
104 JS( | 109 JS( |
105 '', | 110 '', |
106 '''(() => { | 111 '''(() => { |
107 if ($_trapRuntimeErrors) debugger; | 112 if ($_trapRuntimeErrors) debugger; |
108 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $
namedArguments)); | 113 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $
namedArguments)); |
109 })()'''); | 114 })()'''); |
OLD | NEW |