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); |
11 } | 11 } |
12 | 12 |
13 /* @patch */ static String _stringToSafeString(String string) { | 13 @patch static String _stringToSafeString(String string) { |
14 return JSON.encode(string); | 14 return JSON.encode(string); |
15 } | 15 } |
16 | 16 |
17 /* @patch */ StackTrace get stackTrace => _stackTrace; | 17 @patch StackTrace get stackTrace => _stackTrace; |
18 | 18 |
19 StackTrace _stackTrace; | 19 StackTrace _stackTrace; |
20 } | 20 } |
21 | 21 |
22 class _AssertionError extends Error implements AssertionError { | 22 class _AssertionError extends Error implements AssertionError { |
23 _AssertionError._create( | 23 _AssertionError._create( |
24 this._failedAssertion, this._url, this._line, this._column); | 24 this._failedAssertion, this._url, this._line, this._column); |
25 | 25 |
26 static _throwNew(int assertionStart, int assertionEnd) | 26 static _throwNew(int assertionStart, int assertionEnd) |
27 native "AssertionError_throwNew"; | 27 native "AssertionError_throwNew"; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 final int _line; | 93 final int _line; |
94 final int _column; | 94 final int _column; |
95 final String _errorMsg; | 95 final String _errorMsg; |
96 } | 96 } |
97 | 97 |
98 @patch class FallThroughError { | 98 @patch class FallThroughError { |
99 FallThroughError._create(this._url, this._line); | 99 FallThroughError._create(this._url, this._line); |
100 | 100 |
101 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; | 101 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; |
102 | 102 |
103 /* @patch */ String toString() { | 103 @patch String toString() { |
104 return "'$_url': Switch case fall-through at line $_line."; | 104 return "'$_url': Switch case fall-through at line $_line."; |
105 } | 105 } |
106 | 106 |
107 // These new fields cannot be declared final, because a constructor exists | 107 // These new fields cannot be declared final, because a constructor exists |
108 // in the original version of this patched class. | 108 // in the original version of this patched class. |
109 String _url; | 109 String _url; |
110 int _line; | 110 int _line; |
111 } | 111 } |
112 | 112 |
113 class _InternalError { | 113 class _InternalError { |
(...skipping 14 matching lines...) Expand all Loading... |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 @patch class AbstractClassInstantiationError { | 131 @patch class AbstractClassInstantiationError { |
132 AbstractClassInstantiationError._create( | 132 AbstractClassInstantiationError._create( |
133 this._className, this._url, this._line); | 133 this._className, this._url, this._line); |
134 | 134 |
135 static _throwNew(int case_clause_pos, String className) | 135 static _throwNew(int case_clause_pos, String className) |
136 native "AbstractClassInstantiationError_throwNew"; | 136 native "AbstractClassInstantiationError_throwNew"; |
137 | 137 |
138 /* @patch */ String toString() { | 138 @patch String toString() { |
139 return "Cannot instantiate abstract class $_className: " | 139 return "Cannot instantiate abstract class $_className: " |
140 "_url '$_url' line $_line"; | 140 "_url '$_url' line $_line"; |
141 } | 141 } |
142 | 142 |
143 // These new fields cannot be declared final, because a constructor exists | 143 // These new fields cannot be declared final, because a constructor exists |
144 // in the original version of this patched class. | 144 // in the original version of this patched class. |
145 String _url; | 145 String _url; |
146 int _line; | 146 int _line; |
147 } | 147 } |
148 | 148 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 break; | 277 break; |
278 } | 278 } |
279 case _InvocationMirror._TOP_LEVEL: { | 279 case _InvocationMirror._TOP_LEVEL: { |
280 msg = "No top-level $type_str '$memberName'$args_message declared."; | 280 msg = "No top-level $type_str '$memberName'$args_message declared."; |
281 break; | 281 break; |
282 } | 282 } |
283 } | 283 } |
284 return "$msg\n\n"; | 284 return "$msg\n\n"; |
285 } | 285 } |
286 | 286 |
287 /* @patch */ String toString() { | 287 @patch String toString() { |
288 StringBuffer actual_buf = new StringBuffer(); | 288 StringBuffer actual_buf = new StringBuffer(); |
289 int i = 0; | 289 int i = 0; |
290 if (_arguments == null) { | 290 if (_arguments == null) { |
291 // Actual arguments unknown. | 291 // Actual arguments unknown. |
292 // TODO(srdjan): Remove once arguments are passed for unresolvable | 292 // TODO(srdjan): Remove once arguments are passed for unresolvable |
293 // static methods. | 293 // static methods. |
294 actual_buf.write("..."); | 294 actual_buf.write("..."); |
295 } else { | 295 } else { |
296 for (; i < _arguments.length; i++) { | 296 for (; i < _arguments.length; i++) { |
297 if (i > 0) { | 297 if (i > 0) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 msg_buf.write( | 345 msg_buf.write( |
346 "NoSuchMethodError: incorrect number of arguments passed to " | 346 "NoSuchMethodError: incorrect number of arguments passed to " |
347 "method named '$memberName'\n" | 347 "method named '$memberName'\n" |
348 "Receiver: $receiver_str\n" | 348 "Receiver: $receiver_str\n" |
349 "Tried calling: $memberName($actualParameters)\n" | 349 "Tried calling: $memberName($actualParameters)\n" |
350 "Found: $memberName($formalParameters)"); | 350 "Found: $memberName($formalParameters)"); |
351 } | 351 } |
352 return msg_buf.toString(); | 352 return msg_buf.toString(); |
353 } | 353 } |
354 } | 354 } |
OLD | NEW |