| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
| 5 library dart._interceptors; | 5 library dart._interceptors; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:_internal' hide Symbol; | 8 import 'dart:_internal' hide Symbol; |
| 9 import 'dart:_js_helper'; | 9 import 'dart:_js_helper'; |
| 10 import 'dart:_foreign_helper' show JS; | 10 import 'dart:_foreign_helper' show JS; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Note that this needs to be in interceptors.dart in order for | 97 // Note that this needs to be in interceptors.dart in order for |
| 98 // it to be picked up as an extension type. | 98 // it to be picked up as an extension type. |
| 99 @JsPeerInterface(name: 'TypeError') | 99 @JsPeerInterface(name: 'TypeError') |
| 100 class NullError extends Interceptor implements NoSuchMethodError { | 100 class NullError extends Interceptor implements NoSuchMethodError { |
| 101 StackTrace get stackTrace => Primitives.extractStackTrace(this); | 101 StackTrace get stackTrace => Primitives.extractStackTrace(this); |
| 102 | 102 |
| 103 String toString() { | 103 String toString() { |
| 104 // TODO(vsm): Distinguish between null reference errors and other | 104 // TODO(vsm): Distinguish between null reference errors and other |
| 105 // TypeErrors. We should not get non-null TypeErrors from DDC code, | 105 // TypeErrors. We should not get non-null TypeErrors from DDC code, |
| 106 // but we may from native JavaScript. | 106 // but we may from native JavaScript. |
| 107 var message = JS('String', '#.message', this); | 107 return "NullError: ${JS('String', '#.message', this)}"; |
| 108 return "NullError: $message"; | |
| 109 } | 108 } |
| 110 } | 109 } |
| 111 | 110 |
| 111 // Note that this needs to be in interceptors.dart in order for |
| 112 // it to be picked up as an extension type. |
| 113 @JsPeerInterface(name: 'RangeError') |
| 114 class JSRangeError extends Interceptor implements ArgumentError { |
| 115 StackTrace get stackTrace => Primitives.extractStackTrace(this); |
| 116 |
| 117 get invalidValue => null; |
| 118 get name => null; |
| 119 get message => JS('String', '#.message', this); |
| 120 |
| 121 String toString() => "Invalid argument: $message"; |
| 122 } |
| 123 |
| 112 // Obsolete in dart dev compiler. Added only so that the same version of | 124 // Obsolete in dart dev compiler. Added only so that the same version of |
| 113 // dart:html can be used in dart2js an dev compiler. | 125 // dart:html can be used in dart2js an dev compiler. |
| 114 // Warning: calls to these methods need to be removed before custom elements | 126 // Warning: calls to these methods need to be removed before custom elements |
| 115 // and cross-frame dom objects behave correctly in ddc. | 127 // and cross-frame dom objects behave correctly in ddc. |
| 116 // See https://github.com/dart-lang/sdk/issues/28326 | 128 // See https://github.com/dart-lang/sdk/issues/28326 |
| 117 findInterceptorConstructorForType(Type type) {} | 129 findInterceptorConstructorForType(Type type) {} |
| 118 findConstructorForNativeSubclassType(Type type, String name) {} | 130 findConstructorForNativeSubclassType(Type type, String name) {} |
| 119 getNativeInterceptor(object) {} | 131 getNativeInterceptor(object) {} |
| 120 setDispatchProperty(object, value) {} | 132 setDispatchProperty(object, value) {} |
| OLD | NEW |