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 import 'dart:_internal' as internal; | 5 import 'dart:_internal' as internal; |
6 import 'dart:convert' show JSON; | 6 import 'dart:convert' show JSON; |
7 | 7 |
8 patch class Error { | 8 patch class Error { |
9 /* patch */ static String _objectToString(Object object) { | 9 /* patch */ static String _objectToString(Object object) { |
10 return Object._toString(object); | 10 return Object._toString(object); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 this._errorMsg) | 50 this._errorMsg) |
51 : super._create("is assignable", url, line, column); | 51 : super._create("is assignable", url, line, column); |
52 | 52 |
53 static _throwNew(int location, | 53 static _throwNew(int location, |
54 Object src_value, | 54 Object src_value, |
55 String dst_type_name, | 55 String dst_type_name, |
56 String dst_name, | 56 String dst_name, |
57 String error_msg) | 57 String error_msg) |
58 native "TypeError_throwNew"; | 58 native "TypeError_throwNew"; |
59 | 59 |
| 60 static _throwNewIfNotLoaded(_LibraryPrefix prefix, |
| 61 int location, |
| 62 Object src_value, |
| 63 String dst_type_name, |
| 64 String dst_name, |
| 65 String error_msg) { |
| 66 if (!prefix.isLoaded()) { |
| 67 _throwNew(location, src_value, dst_type_name, dst_name, error_msg); |
| 68 } |
| 69 } |
| 70 |
| 71 |
60 String toString() { | 72 String toString() { |
61 String str = (_errorMsg != null) ? _errorMsg : ""; | 73 String str = (_errorMsg != null) ? _errorMsg : ""; |
62 if ((_dstName != null) && (_dstName.length > 0)) { | 74 if ((_dstName != null) && (_dstName.length > 0)) { |
63 str = "${str}type '$_srcType' is not a subtype of " | 75 str = "${str}type '$_srcType' is not a subtype of " |
64 "type '$_dstType' of '$_dstName'."; | 76 "type '$_dstType' of '$_dstName'."; |
65 } else { | 77 } else { |
66 str = "${str}type error."; | 78 str = "${str}type error."; |
67 } | 79 } |
68 return str; | 80 return str; |
69 } | 81 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 namedArguments[new Symbol(argumentNames[i])] = arg_value; | 186 namedArguments[new Symbol(argumentNames[i])] = arg_value; |
175 } | 187 } |
176 throw new NoSuchMethodError._withType(receiver, | 188 throw new NoSuchMethodError._withType(receiver, |
177 new Symbol(memberName), | 189 new Symbol(memberName), |
178 invocation_type, | 190 invocation_type, |
179 positionalArguments, | 191 positionalArguments, |
180 namedArguments, | 192 namedArguments, |
181 existingArgumentNames); | 193 existingArgumentNames); |
182 } | 194 } |
183 | 195 |
| 196 static void _throwNewIfNotLoaded(_LibraryPrefix prefix, |
| 197 Object receiver, |
| 198 String memberName, |
| 199 int invocation_type, |
| 200 List arguments, |
| 201 List argumentNames, |
| 202 List existingArgumentNames) { |
| 203 if (!prefix.isLoaded()) { |
| 204 _throwNew(receiver, memberName, invocation_type, arguments, |
| 205 argumentNames, existingArgumentNames); |
| 206 } |
| 207 } |
| 208 |
184 // Remember the type from the invocation mirror or static compilation | 209 // Remember the type from the invocation mirror or static compilation |
185 // analysis when thrown directly with _throwNew. A negative value means | 210 // analysis when thrown directly with _throwNew. A negative value means |
186 // that no information is available. | 211 // that no information is available. |
187 final int _invocation_type; | 212 final int _invocation_type; |
188 | 213 |
189 NoSuchMethodError(Object this._receiver, | 214 NoSuchMethodError(Object this._receiver, |
190 Symbol this._memberName, | 215 Symbol this._memberName, |
191 List this._arguments, | 216 List this._arguments, |
192 Map<Symbol, dynamic> this._namedArguments, | 217 Map<Symbol, dynamic> this._namedArguments, |
193 [List existingArgumentNames = null]) | 218 [List existingArgumentNames = null]) |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 String toString() => "Javascript Integer Overflow: $_value"; | 370 String toString() => "Javascript Integer Overflow: $_value"; |
346 } | 371 } |
347 | 372 |
348 class _JavascriptCompatibilityError extends Error { | 373 class _JavascriptCompatibilityError extends Error { |
349 final String _msg; | 374 final String _msg; |
350 | 375 |
351 _JavascriptCompatibilityError(this._msg); | 376 _JavascriptCompatibilityError(this._msg); |
352 String toString() => "Javascript Compatibility Error: $_msg"; | 377 String toString() => "Javascript Compatibility Error: $_msg"; |
353 } | 378 } |
354 | 379 |
OLD | NEW |