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) { | 20 void ignoreAllErrors(bool flag) { |
21 JS('', 'dart.__ignoreAllErrors = #', flag); | 21 JS('', 'dart.__ignoreAllErrors = #', flag); |
22 } | 22 } |
23 | 23 |
| 24 argumentError(value) { |
| 25 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
| 26 throw new ArgumentError.value(value); |
| 27 } |
| 28 |
24 throwCastError(object, actual, type) { | 29 throwCastError(object, actual, type) { |
25 var found = typeName(actual); | 30 var found = typeName(actual); |
26 var expected = typeName(type); | 31 var expected = typeName(type); |
27 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 32 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
28 throw new CastErrorImplementation(object, found, expected); | 33 throw new CastErrorImplementation(object, found, expected); |
29 } | 34 } |
30 | 35 |
31 throwTypeError(object, actual, type) { | 36 throwTypeError(object, actual, type) { |
32 var found = typeName(actual); | 37 var found = typeName(actual); |
33 var expected = typeName(type); | 38 var expected = typeName(type); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 throw new NoSuchMethodError( | 77 throw new NoSuchMethodError( |
73 null, new Symbol('<Unexpected Null Value>'), null, null, null); | 78 null, new Symbol('<Unexpected Null Value>'), null, null, null); |
74 } | 79 } |
75 | 80 |
76 throwNoSuchMethodError(Object receiver, Symbol memberName, | 81 throwNoSuchMethodError(Object receiver, Symbol memberName, |
77 List positionalArguments, Map<Symbol, dynamic> namedArguments) { | 82 List positionalArguments, Map<Symbol, dynamic> namedArguments) { |
78 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 83 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
79 throw new NoSuchMethodError( | 84 throw new NoSuchMethodError( |
80 receiver, memberName, positionalArguments, namedArguments); | 85 receiver, memberName, positionalArguments, namedArguments); |
81 } | 86 } |
OLD | NEW |