| 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 @patch class Error { | 5 @patch | 
| 6   @patch static String _objectToString(Object object) { | 6 class Error { | 
|  | 7   @patch | 
|  | 8   static String _objectToString(Object object) { | 
| 7     return Object._toString(object); | 9     return Object._toString(object); | 
| 8   } | 10   } | 
| 9 | 11 | 
| 10   @patch static String _stringToSafeString(String string) { | 12   @patch | 
|  | 13   static String _stringToSafeString(String string) { | 
| 11     return JSON.encode(string); | 14     return JSON.encode(string); | 
| 12   } | 15   } | 
| 13 | 16 | 
| 14   @patch StackTrace get stackTrace => _stackTrace; | 17   @patch | 
|  | 18   StackTrace get stackTrace => _stackTrace; | 
| 15 | 19 | 
| 16   StackTrace _stackTrace; | 20   StackTrace _stackTrace; | 
| 17 } | 21 } | 
| 18 | 22 | 
| 19 class _AssertionError extends Error implements AssertionError { | 23 class _AssertionError extends Error implements AssertionError { | 
| 20   _AssertionError._create( | 24   _AssertionError._create( | 
| 21       this._failedAssertion, this._url, this._line, this._column, | 25       this._failedAssertion, this._url, this._line, this._column, this.message); | 
| 22       this.message); |  | 
| 23 |  | 
| 24 | 26 | 
| 25   // AssertionError_throwNew in errors.cc fishes the assertion source code | 27   // AssertionError_throwNew in errors.cc fishes the assertion source code | 
| 26   // out of the script. It expects a Dart stack frame from class | 28   // out of the script. It expects a Dart stack frame from class | 
| 27   // _AssertionError. Thus we need a Dart stub that calls the native code. | 29   // _AssertionError. Thus we need a Dart stub that calls the native code. | 
| 28   static _throwNew(int assertionStart, int assertionEnd, Object message) { | 30   static _throwNew(int assertionStart, int assertionEnd, Object message) { | 
| 29     _doThrowNew(assertionStart, assertionEnd, message); | 31     _doThrowNew(assertionStart, assertionEnd, message); | 
| 30   } | 32   } | 
| 31 | 33 | 
| 32   static _doThrowNew(int assertionStart, int assertionEnd, Object message) | 34   static _doThrowNew(int assertionStart, int assertionEnd, Object message) | 
| 33     native "AssertionError_throwNew"; | 35       native "AssertionError_throwNew"; | 
| 34 | 36 | 
| 35   static _evaluateAssertion(condition) { | 37   static _evaluateAssertion(condition) { | 
| 36     if (identical(condition, true) || identical(condition, false)) { | 38     if (identical(condition, true) || identical(condition, false)) { | 
| 37       return condition; | 39       return condition; | 
| 38     } | 40     } | 
| 39     if (condition is _Closure) { | 41     if (condition is _Closure) { | 
| 40       return condition(); | 42       return condition(); | 
| 41     } | 43     } | 
| 42     if (condition is Function) { | 44     if (condition is Function) { | 
| 43       condition = condition(); | 45       condition = condition(); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 57       return "'$_failedAssertion': $_messageString"; | 59       return "'$_failedAssertion': $_messageString"; | 
| 58     } | 60     } | 
| 59     var columnInfo = ""; | 61     var columnInfo = ""; | 
| 60     if (_column > 0) { | 62     if (_column > 0) { | 
| 61       // Only add column information if it is valid. | 63       // Only add column information if it is valid. | 
| 62       columnInfo = " pos $_column"; | 64       columnInfo = " pos $_column"; | 
| 63     } | 65     } | 
| 64     return "'$_url': Failed assertion: line $_line$columnInfo: " | 66     return "'$_url': Failed assertion: line $_line$columnInfo: " | 
| 65         "'$_failedAssertion': $_messageString"; | 67         "'$_failedAssertion': $_messageString"; | 
| 66   } | 68   } | 
|  | 69 | 
| 67   final String _failedAssertion; | 70   final String _failedAssertion; | 
| 68   final String _url; | 71   final String _url; | 
| 69   final int _line; | 72   final int _line; | 
| 70   final int _column; | 73   final int _column; | 
| 71   final Object message; | 74   final Object message; | 
| 72 } | 75 } | 
| 73 | 76 | 
| 74 class _TypeError extends _AssertionError implements TypeError { | 77 class _TypeError extends _AssertionError implements TypeError { | 
| 75   _TypeError._create(String url, int line, int column, String errorMsg) | 78   _TypeError._create(String url, int line, int column, String errorMsg) | 
| 76       : super._create("is assignable", url, line, column, errorMsg); | 79       : super._create("is assignable", url, line, column, errorMsg); | 
| 77 | 80 | 
| 78   static _throwNew(int location, | 81   static _throwNew(int location, Object src_value, _Type dst_type, | 
| 79                    Object src_value, | 82       String dst_name, String bound_error_msg) native "TypeError_throwNew"; | 
| 80                    _Type dst_type, |  | 
| 81                    String dst_name, |  | 
| 82                    String bound_error_msg) |  | 
| 83       native "TypeError_throwNew"; |  | 
| 84 | 83 | 
| 85   static _throwNewIfNotLoaded(_LibraryPrefix prefix, | 84   static _throwNewIfNotLoaded( | 
| 86                               int location, | 85       _LibraryPrefix prefix, | 
| 87                               Object src_value, | 86       int location, | 
| 88                               _Type dst_type, | 87       Object src_value, | 
| 89                               String dst_name, | 88       _Type dst_type, | 
| 90                               String bound_error_msg) { | 89       String dst_name, | 
|  | 90       String bound_error_msg) { | 
| 91     if (!prefix.isLoaded()) { | 91     if (!prefix.isLoaded()) { | 
| 92       _throwNew(location, src_value, dst_type, dst_name, bound_error_msg); | 92       _throwNew(location, src_value, dst_type, dst_name, bound_error_msg); | 
| 93     } | 93     } | 
| 94   } | 94   } | 
| 95 | 95 | 
| 96   String toString() => super.message; | 96   String toString() => super.message; | 
| 97 } | 97 } | 
| 98 | 98 | 
| 99 class _CastError extends Error implements CastError { | 99 class _CastError extends Error implements CastError { | 
| 100   _CastError._create(this._url, this._line, this._column, this._errorMsg); | 100   _CastError._create(this._url, this._line, this._column, this._errorMsg); | 
| 101 | 101 | 
| 102   // A CastError is allocated by TypeError._throwNew() when dst_name equals | 102   // A CastError is allocated by TypeError._throwNew() when dst_name equals | 
| 103   // Symbols::InTypeCast(). | 103   // Symbols::InTypeCast(). | 
| 104 | 104 | 
| 105   String toString() => _errorMsg; | 105   String toString() => _errorMsg; | 
| 106 | 106 | 
| 107   // Fields _url, _line, and _column are only used for debugging purposes. | 107   // Fields _url, _line, and _column are only used for debugging purposes. | 
| 108   final String _url; | 108   final String _url; | 
| 109   final int _line; | 109   final int _line; | 
| 110   final int _column; | 110   final int _column; | 
| 111   final String _errorMsg; | 111   final String _errorMsg; | 
| 112 } | 112 } | 
| 113 | 113 | 
| 114 @patch class FallThroughError { | 114 @patch | 
|  | 115 class FallThroughError { | 
| 115   FallThroughError._create(this._url, this._line); | 116   FallThroughError._create(this._url, this._line); | 
| 116 | 117 | 
| 117   static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; | 118   static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; | 
| 118 | 119 | 
| 119   @patch | 120   @patch | 
| 120   String toString() { | 121   String toString() { | 
| 121     return "'$_url': Switch case fall-through at line $_line."; | 122     return "'$_url': Switch case fall-through at line $_line."; | 
| 122   } | 123   } | 
| 123 | 124 | 
| 124   // These new fields cannot be declared final, because a constructor exists | 125   // These new fields cannot be declared final, because a constructor exists | 
| 125   // in the original version of this patched class. | 126   // in the original version of this patched class. | 
| 126   String _url; | 127   String _url; | 
| 127   int _line; | 128   int _line; | 
| 128 } | 129 } | 
| 129 | 130 | 
| 130 class _InternalError { | 131 class _InternalError { | 
| 131   const _InternalError(this._msg); | 132   const _InternalError(this._msg); | 
| 132   String toString() => "InternalError: '${_msg}'"; | 133   String toString() => "InternalError: '${_msg}'"; | 
| 133   final String _msg; | 134   final String _msg; | 
| 134 } | 135 } | 
| 135 | 136 | 
| 136 @patch class UnsupportedError { | 137 @patch | 
|  | 138 class UnsupportedError { | 
| 137   static _throwNew(String msg) { | 139   static _throwNew(String msg) { | 
| 138     throw new UnsupportedError(msg); | 140     throw new UnsupportedError(msg); | 
| 139   } | 141   } | 
| 140 } | 142 } | 
| 141 | 143 | 
| 142 @patch class CyclicInitializationError { | 144 @patch | 
|  | 145 class CyclicInitializationError { | 
| 143   static _throwNew(String variableName) { | 146   static _throwNew(String variableName) { | 
| 144     throw new CyclicInitializationError(variableName); | 147     throw new CyclicInitializationError(variableName); | 
| 145   } | 148   } | 
| 146 } | 149 } | 
| 147 | 150 | 
| 148 @patch class AbstractClassInstantiationError { | 151 @patch | 
|  | 152 class AbstractClassInstantiationError { | 
| 149   AbstractClassInstantiationError._create( | 153   AbstractClassInstantiationError._create( | 
| 150       this._className, this._url, this._line); | 154       this._className, this._url, this._line); | 
| 151 | 155 | 
| 152   static _throwNew(int case_clause_pos, String className) | 156   static _throwNew(int case_clause_pos, String className) | 
| 153       native "AbstractClassInstantiationError_throwNew"; | 157       native "AbstractClassInstantiationError_throwNew"; | 
| 154 | 158 | 
| 155   @patch String toString() { | 159   @patch | 
|  | 160   String toString() { | 
| 156     return "Cannot instantiate abstract class $_className: " | 161     return "Cannot instantiate abstract class $_className: " | 
| 157            "_url '$_url' line $_line"; | 162         "_url '$_url' line $_line"; | 
| 158   } | 163   } | 
| 159 | 164 | 
| 160   // These new fields cannot be declared final, because a constructor exists | 165   // These new fields cannot be declared final, because a constructor exists | 
| 161   // in the original version of this patched class. | 166   // in the original version of this patched class. | 
| 162   String _url; | 167   String _url; | 
| 163   int _line; | 168   int _line; | 
| 164 } | 169 } | 
| 165 | 170 | 
| 166 @patch class NoSuchMethodError { | 171 @patch | 
|  | 172 class NoSuchMethodError { | 
| 167   // The compiler emits a call to _throwNew when it cannot resolve a static | 173   // The compiler emits a call to _throwNew when it cannot resolve a static | 
| 168   // method at compile time. The receiver is actually the literal class of the | 174   // method at compile time. The receiver is actually the literal class of the | 
| 169   // unresolved method. | 175   // unresolved method. | 
| 170   static void _throwNew(Object receiver, | 176   static void _throwNew(Object receiver, String memberName, int invocation_type, | 
| 171                         String memberName, | 177       List arguments, List argumentNames, List existingArgumentNames) { | 
| 172                         int invocation_type, |  | 
| 173                         List arguments, |  | 
| 174                         List argumentNames, |  | 
| 175                         List existingArgumentNames) { |  | 
| 176     int numNamedArguments = argumentNames == null ? 0 : argumentNames.length; | 178     int numNamedArguments = argumentNames == null ? 0 : argumentNames.length; | 
| 177     int numPositionalArguments = arguments == null ? 0 : arguments.length; | 179     int numPositionalArguments = arguments == null ? 0 : arguments.length; | 
| 178     numPositionalArguments -= numNamedArguments; | 180     numPositionalArguments -= numNamedArguments; | 
| 179     List positionalArguments; | 181     List positionalArguments; | 
| 180     if (numPositionalArguments > 0) { | 182     if (numPositionalArguments > 0) { | 
| 181       // TODO(srdjan): Unresolvable static methods sometimes do not provide the | 183       // TODO(srdjan): Unresolvable static methods sometimes do not provide the | 
| 182       // arguments, because the arguments are evaluated but not passed to the | 184       // arguments, because the arguments are evaluated but not passed to the | 
| 183       // throwing stub (see EffectGraphVisitor::BuildThrowNoSuchMethodError and | 185       // throwing stub (see EffectGraphVisitor::BuildThrowNoSuchMethodError and | 
| 184       // Parser::ThrowNoSuchMethodError)). There is no way to distinguish the | 186       // Parser::ThrowNoSuchMethodError)). There is no way to distinguish the | 
| 185       // case of no arguments from the case of the arguments not being passed | 187       // case of no arguments from the case of the arguments not being passed | 
| 186       // in here, though. See https://github.com/dart-lang/sdk/issues/27572 | 188       // in here, though. See https://github.com/dart-lang/sdk/issues/27572 | 
| 187       positionalArguments = arguments.sublist(0, numPositionalArguments); | 189       positionalArguments = arguments.sublist(0, numPositionalArguments); | 
| 188     } | 190     } | 
| 189     Map<Symbol, dynamic> namedArguments = new Map<Symbol, dynamic>(); | 191     Map<Symbol, dynamic> namedArguments = new Map<Symbol, dynamic>(); | 
| 190     for (int i = 0; i < numNamedArguments; i++) { | 192     for (int i = 0; i < numNamedArguments; i++) { | 
| 191       var arg_value = arguments[numPositionalArguments + i]; | 193       var arg_value = arguments[numPositionalArguments + i]; | 
| 192       namedArguments[new Symbol(argumentNames[i])] = arg_value; | 194       namedArguments[new Symbol(argumentNames[i])] = arg_value; | 
| 193     } | 195     } | 
| 194     throw new NoSuchMethodError._withType(receiver, | 196     throw new NoSuchMethodError._withType( | 
| 195                                           new Symbol(memberName), | 197         receiver, | 
| 196                                           invocation_type, | 198         new Symbol(memberName), | 
| 197                                           positionalArguments, | 199         invocation_type, | 
| 198                                           namedArguments, | 200         positionalArguments, | 
| 199                                           existingArgumentNames); | 201         namedArguments, | 
|  | 202         existingArgumentNames); | 
| 200   } | 203   } | 
| 201 | 204 | 
| 202   static void _throwNewIfNotLoaded(_LibraryPrefix prefix, | 205   static void _throwNewIfNotLoaded( | 
| 203                                    Object receiver, | 206       _LibraryPrefix prefix, | 
| 204                                    String memberName, | 207       Object receiver, | 
| 205                                    int invocation_type, | 208       String memberName, | 
| 206                                    List arguments, | 209       int invocation_type, | 
| 207                                    List argumentNames, | 210       List arguments, | 
| 208                                    List existingArgumentNames) { | 211       List argumentNames, | 
|  | 212       List existingArgumentNames) { | 
| 209     if (!prefix.isLoaded()) { | 213     if (!prefix.isLoaded()) { | 
| 210       _throwNew(receiver, memberName, invocation_type, arguments, | 214       _throwNew(receiver, memberName, invocation_type, arguments, argumentNames, | 
| 211                 argumentNames, existingArgumentNames); | 215           existingArgumentNames); | 
| 212     } | 216     } | 
| 213   } | 217   } | 
| 214 | 218 | 
| 215   // Remember the type from the invocation mirror or static compilation | 219   // Remember the type from the invocation mirror or static compilation | 
| 216   // analysis when thrown directly with _throwNew. A negative value means | 220   // analysis when thrown directly with _throwNew. A negative value means | 
| 217   // that no information is available. | 221   // that no information is available. | 
| 218   final int _invocation_type; | 222   final int _invocation_type; | 
| 219 | 223 | 
| 220   @patch | 224   @patch | 
| 221   NoSuchMethodError(Object receiver, | 225   NoSuchMethodError(Object receiver, Symbol memberName, | 
| 222                     Symbol memberName, | 226       List positionalArguments, Map<Symbol, dynamic> namedArguments, | 
| 223                     List positionalArguments, | 227       [List existingArgumentNames = null]) | 
| 224                     Map<Symbol, dynamic> namedArguments, |  | 
| 225                     [List existingArgumentNames = null]) |  | 
| 226       : _receiver = receiver, | 228       : _receiver = receiver, | 
| 227         _memberName = memberName, | 229         _memberName = memberName, | 
| 228         _arguments = positionalArguments, | 230         _arguments = positionalArguments, | 
| 229         _namedArguments = namedArguments, | 231         _namedArguments = namedArguments, | 
| 230         _existingArgumentNames = existingArgumentNames, | 232         _existingArgumentNames = existingArgumentNames, | 
| 231         _invocation_type = -1; | 233         _invocation_type = -1; | 
| 232 | 234 | 
| 233   // This constructor seems to be called with either strings or | 235   // This constructor seems to be called with either strings or | 
| 234   // values read from another NoSuchMethodError. | 236   // values read from another NoSuchMethodError. | 
| 235   NoSuchMethodError._withType(this._receiver, | 237   NoSuchMethodError._withType( | 
| 236                               /*String|Symbol*/ memberName, | 238       this._receiver, | 
| 237                               this._invocation_type, | 239       /*String|Symbol*/ memberName, | 
| 238                               this._arguments, | 240       this._invocation_type, | 
| 239                               Map<dynamic, dynamic> namedArguments, | 241       this._arguments, | 
| 240                               [List existingArgumentNames = null]) | 242       Map<dynamic, dynamic> namedArguments, | 
|  | 243       [List existingArgumentNames = null]) | 
| 241       : this._memberName = | 244       : this._memberName = | 
| 242             (memberName is String) ? new Symbol(memberName) : memberName, | 245             (memberName is String) ? new Symbol(memberName) : memberName, | 
| 243         this._namedArguments = | 246         this._namedArguments = (namedArguments == null) | 
| 244             (namedArguments == null) | 247             ? null | 
| 245                 ? null | 248             : new Map<Symbol, dynamic>.fromIterable(namedArguments.keys, | 
| 246                 : new Map<Symbol, dynamic>.fromIterable( | 249                 key: (k) => (k is String) ? new Symbol(k) : k, | 
| 247                     namedArguments.keys, | 250                 value: (k) => namedArguments[k]), | 
| 248                     key: (k) => (k is String) ? new Symbol(k) : k, |  | 
| 249                     value: (k) => namedArguments[k]), |  | 
| 250         this._existingArgumentNames = existingArgumentNames; | 251         this._existingArgumentNames = existingArgumentNames; | 
| 251 | 252 | 
| 252   @patch String toString() { | 253   @patch | 
|  | 254   String toString() { | 
| 253     var level = (_invocation_type >> _InvocationMirror._CALL_SHIFT) & | 255     var level = (_invocation_type >> _InvocationMirror._CALL_SHIFT) & | 
| 254         _InvocationMirror._CALL_MASK; | 256         _InvocationMirror._CALL_MASK; | 
| 255     var type = _invocation_type & _InvocationMirror._TYPE_MASK; | 257     var type = _invocation_type & _InvocationMirror._TYPE_MASK; | 
| 256     String memberName = (_memberName == null) ? "" : | 258     String memberName = (_memberName == null) | 
| 257         internal.Symbol.getUnmangledName(_memberName); | 259         ? "" | 
|  | 260         : internal.Symbol.getUnmangledName(_memberName); | 
| 258 | 261 | 
| 259     if (type == _InvocationMirror._LOCAL_VAR) { | 262     if (type == _InvocationMirror._LOCAL_VAR) { | 
| 260       return "NoSuchMethodError: Cannot assign to final variable '$memberName'"; | 263       return "NoSuchMethodError: Cannot assign to final variable '$memberName'"; | 
| 261     } | 264     } | 
| 262 | 265 | 
| 263     StringBuffer arguments = new StringBuffer(); | 266     StringBuffer arguments = new StringBuffer(); | 
| 264     int argumentCount = 0; | 267     int argumentCount = 0; | 
| 265     if (_arguments != null) { | 268     if (_arguments != null) { | 
| 266       for (; argumentCount < _arguments.length; argumentCount++) { | 269       for (; argumentCount < _arguments.length; argumentCount++) { | 
| 267         if (argumentCount > 0) { | 270         if (argumentCount > 0) { | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 279         arguments.write(": "); | 282         arguments.write(": "); | 
| 280         arguments.write(Error.safeToString(value)); | 283         arguments.write(Error.safeToString(value)); | 
| 281         argumentCount++; | 284         argumentCount++; | 
| 282       }); | 285       }); | 
| 283     } | 286     } | 
| 284     bool args_mismatch = _existingArgumentNames != null; | 287     bool args_mismatch = _existingArgumentNames != null; | 
| 285     String args_message = args_mismatch ? " with matching arguments" : ""; | 288     String args_message = args_mismatch ? " with matching arguments" : ""; | 
| 286 | 289 | 
| 287     String type_str; | 290     String type_str; | 
| 288     if (type >= 0 && type < 5) { | 291     if (type >= 0 && type < 5) { | 
| 289       type_str = (const ["method", "getter", "setter", "getter or setter", | 292       type_str = (const [ | 
| 290           "variable"])[type]; | 293         "method", | 
|  | 294         "getter", | 
|  | 295         "setter", | 
|  | 296         "getter or setter", | 
|  | 297         "variable" | 
|  | 298       ])[type]; | 
| 291     } | 299     } | 
| 292 | 300 | 
| 293     StringBuffer msg_buf = new StringBuffer("NoSuchMethodError: "); | 301     StringBuffer msg_buf = new StringBuffer("NoSuchMethodError: "); | 
| 294     bool is_type_call = false; | 302     bool is_type_call = false; | 
| 295     switch (level) { | 303     switch (level) { | 
| 296       case _InvocationMirror._DYNAMIC: { | 304       case _InvocationMirror._DYNAMIC: | 
| 297         if (_receiver == null) { | 305         { | 
| 298           if (args_mismatch) { | 306           if (_receiver == null) { | 
| 299             msg_buf.writeln("The null object does not have a $type_str " | 307             if (args_mismatch) { | 
| 300                 "'$memberName'$args_message."); | 308               msg_buf.writeln("The null object does not have a $type_str " | 
|  | 309                   "'$memberName'$args_message."); | 
|  | 310             } else { | 
|  | 311               msg_buf | 
|  | 312                   .writeln("The $type_str '$memberName' was called on null."); | 
|  | 313             } | 
| 301           } else { | 314           } else { | 
| 302             msg_buf.writeln("The $type_str '$memberName' was called on null."); | 315             if (_receiver is Function) { | 
|  | 316               msg_buf.writeln("Closure call with mismatched arguments: " | 
|  | 317                   "function '$memberName'"); | 
|  | 318             } else if (_receiver is _Type && memberName == "call") { | 
|  | 319               is_type_call = true; | 
|  | 320               String name = _receiver.toString(); | 
|  | 321               msg_buf.writeln("Attempted to use type '$name' as a function. " | 
|  | 322                   "Since types do not define a method 'call', this is not " | 
|  | 323                   "possible. Did you intend to call the $name constructor and " | 
|  | 324                   "forget the 'new' operator?"); | 
|  | 325             } else { | 
|  | 326               msg_buf | 
|  | 327                   .writeln("Class '${_receiver.runtimeType}' has no instance " | 
|  | 328                       "$type_str '$memberName'$args_message."); | 
|  | 329             } | 
| 303           } | 330           } | 
| 304         } else { | 331           break; | 
| 305           if (_receiver is Function) { |  | 
| 306             msg_buf.writeln("Closure call with mismatched arguments: " |  | 
| 307                 "function '$memberName'"); |  | 
| 308           } else if (_receiver is _Type && memberName == "call") { |  | 
| 309             is_type_call = true; |  | 
| 310             String name = _receiver.toString(); |  | 
| 311             msg_buf.writeln("Attempted to use type '$name' as a function. " |  | 
| 312                 "Since types do not define a method 'call', this is not " |  | 
| 313                 "possible. Did you intend to call the $name constructor and " |  | 
| 314                 "forget the 'new' operator?"); |  | 
| 315           } else { |  | 
| 316             msg_buf.writeln("Class '${_receiver.runtimeType}' has no instance " |  | 
| 317                 "$type_str '$memberName'$args_message."); |  | 
| 318           } |  | 
| 319         } | 332         } | 
| 320         break; | 333       case _InvocationMirror._SUPER: | 
| 321       } | 334         { | 
| 322       case _InvocationMirror._SUPER: { | 335           msg_buf.writeln("Super class of class '${_receiver.runtimeType}' has " | 
| 323         msg_buf.writeln("Super class of class '${_receiver.runtimeType}' has " |  | 
| 324               "no instance $type_str '$memberName'$args_message."); | 336               "no instance $type_str '$memberName'$args_message."); | 
| 325         memberName = "super.$memberName"; | 337           memberName = "super.$memberName"; | 
| 326         break; | 338           break; | 
| 327       } | 339         } | 
| 328       case _InvocationMirror._STATIC: { | 340       case _InvocationMirror._STATIC: | 
| 329         msg_buf.writeln("No static $type_str '$memberName'$args_message " | 341         { | 
| 330             "declared in class '$_receiver'."); | 342           msg_buf.writeln("No static $type_str '$memberName'$args_message " | 
| 331         break; | 343               "declared in class '$_receiver'."); | 
| 332       } | 344           break; | 
| 333       case _InvocationMirror._CONSTRUCTOR: { | 345         } | 
| 334         msg_buf.writeln("No constructor '$memberName'$args_message declared " | 346       case _InvocationMirror._CONSTRUCTOR: | 
| 335             "in class '$_receiver'."); | 347         { | 
| 336         memberName = "new $memberName"; | 348           msg_buf.writeln("No constructor '$memberName'$args_message declared " | 
| 337         break; | 349               "in class '$_receiver'."); | 
| 338       } | 350           memberName = "new $memberName"; | 
| 339       case _InvocationMirror._TOP_LEVEL: { | 351           break; | 
| 340         msg_buf.writeln("No top-level $type_str '$memberName'$args_message " | 352         } | 
| 341             "declared."); | 353       case _InvocationMirror._TOP_LEVEL: | 
| 342         break; | 354         { | 
| 343       } | 355           msg_buf.writeln("No top-level $type_str '$memberName'$args_message " | 
|  | 356               "declared."); | 
|  | 357           break; | 
|  | 358         } | 
| 344     } | 359     } | 
| 345 | 360 | 
| 346     if (level == _InvocationMirror._TOP_LEVEL) { | 361     if (level == _InvocationMirror._TOP_LEVEL) { | 
| 347       msg_buf.writeln("Receiver: top-level"); | 362       msg_buf.writeln("Receiver: top-level"); | 
| 348     } else { | 363     } else { | 
| 349       msg_buf.writeln("Receiver: ${Error.safeToString(_receiver)}"); | 364       msg_buf.writeln("Receiver: ${Error.safeToString(_receiver)}"); | 
| 350     } | 365     } | 
| 351 | 366 | 
| 352     if (type == _InvocationMirror._METHOD) { | 367     if (type == _InvocationMirror._METHOD) { | 
| 353       String m = is_type_call ? "$_receiver" : "$memberName"; | 368       String m = is_type_call ? "$_receiver" : "$memberName"; | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 368         } | 383         } | 
| 369         formalParameters.write(_existingArgumentNames[i]); | 384         formalParameters.write(_existingArgumentNames[i]); | 
| 370       } | 385       } | 
| 371       msg_buf.write("\nFound: $memberName($formalParameters)"); | 386       msg_buf.write("\nFound: $memberName($formalParameters)"); | 
| 372     } | 387     } | 
| 373 | 388 | 
| 374     return msg_buf.toString(); | 389     return msg_buf.toString(); | 
| 375   } | 390   } | 
| 376 } | 391 } | 
| 377 | 392 | 
| 378 |  | 
| 379 class _CompileTimeError extends Error { | 393 class _CompileTimeError extends Error { | 
| 380   final String _errorMsg; | 394   final String _errorMsg; | 
| 381   _CompileTimeError(this._errorMsg); | 395   _CompileTimeError(this._errorMsg); | 
| 382   String toString() => _errorMsg; | 396   String toString() => _errorMsg; | 
| 383 } | 397 } | 
| OLD | NEW | 
|---|