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 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 var expected = typeName(type); | 66 var expected = typeName(type); |
67 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 67 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
68 throw new StrongModeTypeError(object, found, expected); | 68 throw new StrongModeTypeError(object, found, expected); |
69 } | 69 } |
70 | 70 |
71 throwUnimplementedError(String message) { | 71 throwUnimplementedError(String message) { |
72 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 72 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
73 throw new UnimplementedError(message); | 73 throw new UnimplementedError(message); |
74 } | 74 } |
75 | 75 |
76 throwAssertionError([String message()]) { | 76 throwAssertionError(messageFn()) { |
77 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 77 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
78 throw message != null | 78 var message = messageFn != null ? messageFn() : null; |
79 ? new AssertionErrorWithMessage(message()) | 79 throw new AssertionErrorImpl(message); |
80 : new AssertionError(); | |
81 } | 80 } |
82 | 81 |
83 throwCyclicInitializationError([String message]) { | 82 throwCyclicInitializationError([String message]) { |
84 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 83 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
85 throw new CyclicInitializationError(message); | 84 throw new CyclicInitializationError(message); |
86 } | 85 } |
87 | 86 |
88 throwNullValueError() { | 87 throwNullValueError() { |
89 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought | 88 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought |
90 // to thread through method info, but that uglifies the code and can't | 89 // to thread through method info, but that uglifies the code and can't |
91 // actually be queried ... it only affects how the error is printed. | 90 // actually be queried ... it only affects how the error is printed. |
92 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 91 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
93 throw new NoSuchMethodError( | 92 throw new NoSuchMethodError( |
94 null, new Symbol('<Unexpected Null Value>'), null, null, null); | 93 null, new Symbol('<Unexpected Null Value>'), null, null, null); |
95 } | 94 } |
96 | 95 |
97 throwNoSuchMethodError(Object receiver, Symbol memberName, | 96 throwNoSuchMethodError(Object receiver, Symbol memberName, |
98 List positionalArguments, Map<Symbol, dynamic> namedArguments) { | 97 List positionalArguments, Map<Symbol, dynamic> namedArguments) { |
99 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); | 98 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); |
100 throw new NoSuchMethodError( | 99 throw new NoSuchMethodError( |
101 receiver, memberName, positionalArguments, namedArguments); | 100 receiver, memberName, positionalArguments, namedArguments); |
102 } | 101 } |
OLD | NEW |