| 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 // We need to set these properties while the sdk is only partially initialized | 6 // We need to set these properties while the sdk is only partially initialized |
| 7 // so we cannot use regular Dart fields. | 7 // so we cannot use regular Dart fields. |
| 8 // The default values for these properties are set when the global_ final field | 8 // The default values for these properties are set when the global_ final field |
| 9 // in runtime.dart is initialized. | 9 // in runtime.dart is initialized. |
| 10 | 10 |
| 11 // Override, e.g., for testing | 11 // Override, e.g., for testing |
| 12 void trapRuntimeErrors(bool flag) { | 12 void trapRuntimeErrors(bool flag) { |
| 13 JS('', 'dart.__trapRuntimeErrors = #', flag); | 13 JS('', 'dart.__trapRuntimeErrors = #', flag); |
| 14 } | 14 } |
| 15 | 15 |
| 16 void ignoreWhitelistedErrors(bool flag) { | 16 void ignoreWhitelistedErrors(bool flag) { |
| 17 JS('', 'dart.__ignoreWhitelistedErrors = #', flag); | 17 JS('', 'dart.__ignoreWhitelistedErrors = #', flag); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void ignoreAllErrors(bool flag) { |
| 21 JS('', 'dart.__ignoreAllErrors = #', flag); |
| 22 } |
| 23 |
| 20 /// Throw an exception on `is` checks that would return an unsound answer in | 24 /// Throw an exception on `is` checks that would return an unsound answer in |
| 21 /// non-strong mode Dart. | 25 /// non-strong mode Dart. |
| 22 /// | 26 /// |
| 23 /// For example `x is List<int>` where `x = <Object>['hello']`. | 27 /// For example `x is List<int>` where `x = <Object>['hello']`. |
| 24 /// | 28 /// |
| 25 /// These checks behave correctly in strong mode (they return false), however, | 29 /// These checks behave correctly in strong mode (they return false), however, |
| 26 /// they will produce a different answer if run on a platform without strong | 30 /// they will produce a different answer if run on a platform without strong |
| 27 /// mode. As a debugging feature, these checks can be configured to throw, to | 31 /// mode. As a debugging feature, these checks can be configured to throw, to |
| 28 /// avoid seeing different behavior between modes. | 32 /// avoid seeing different behavior between modes. |
| 29 /// | 33 /// |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 })()'''); | 110 })()'''); |
| 107 | 111 |
| 108 throwNoSuchMethodError( | 112 throwNoSuchMethodError( |
| 109 receiver, memberName, positionalArguments, namedArguments) => | 113 receiver, memberName, positionalArguments, namedArguments) => |
| 110 JS( | 114 JS( |
| 111 '', | 115 '', |
| 112 '''(() => { | 116 '''(() => { |
| 113 if (dart.__trapRuntimeErrors) debugger; | 117 if (dart.__trapRuntimeErrors) debugger; |
| 114 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $
namedArguments)); | 118 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $
namedArguments)); |
| 115 })()'''); | 119 })()'''); |
| OLD | NEW |