Chromium Code Reviews| 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 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 class Error { | 7 class Error { |
| 8 /** | 8 /** |
| 9 * Safely convert a value to a [String] description. | 9 * Safely convert a value to a [String] description. |
| 10 * | 10 * |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 FallThroughError(); | 147 FallThroughError(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 class AbstractClassInstantiationError extends Error { | 151 class AbstractClassInstantiationError extends Error { |
| 152 final String _className; | 152 final String _className; |
| 153 AbstractClassInstantiationError(String this._className); | 153 AbstractClassInstantiationError(String this._className); |
| 154 String toString() => "Cannot instantiate abstract class: '$_className'"; | 154 String toString() => "Cannot instantiate abstract class: '$_className'"; |
| 155 } | 155 } |
| 156 | 156 |
| 157 | |
| 157 /** | 158 /** |
| 158 * Error thrown by the default implementation of [:noSuchMethod:] on [Object]. | 159 * Error thrown by the default implementation of [:noSuchMethod:] on [Object]. |
| 159 */ | 160 */ |
| 160 class NoSuchMethodError extends Error { | 161 class NoSuchMethodError extends Error { |
| 161 final Object _receiver; | 162 final Object _receiver; |
| 162 final String _memberName; | 163 final Symbol _memberName; |
| 163 final List _arguments; | 164 final List _arguments; |
| 164 final Map<String,dynamic> _namedArguments; | 165 final Map<Symbol, dynamic> _namedArguments; |
| 165 final List _existingArgumentNames; | 166 final List _existingArgumentNames; |
| 166 | 167 |
| 167 /** | 168 /** |
| 168 * Create a [NoSuchMethodError] corresponding to a failed method call. | 169 * Create a [NoSuchMethodError] corresponding to a failed method call. |
| 169 * | 170 * |
| 170 * The first parameter to this constructor is the receiver of the method call. | 171 * The [receiver] is the receiver of the method call. |
| 171 * That is, the object on which the method was attempted called. | 172 * That is, the object on which the method was attempted called. |
| 172 * The second parameter is the name of the called method or accessor. | 173 * If this is `null`, it is interpreted as a call to a top-level function |
| 173 * The third parameter is a list of the positional arguments that the method | 174 * of a library. |
| 174 * was called with. | 175 * |
| 175 * The fourth parameter is a map from [String] names to the values of named | 176 * The [memberNamed] is a [Symbol] representing the name of the called method |
| 177 * or accessor. It should not be `null`. | |
| 178 * | |
| 179 * The [positionalArguments] is a list of the positional arguments that the | |
| 180 * method was called with. If `null`, it is considered equivalent to the | |
| 181 * empty list. | |
| 182 * | |
| 183 * The [namedArguments] is a map from [Symbol]s to the values of named | |
| 176 * arguments that the method was called with. | 184 * arguments that the method was called with. |
| 185 * | |
| 177 * The optional [exisitingArgumentNames] is the expected parameters of a | 186 * The optional [exisitingArgumentNames] is the expected parameters of a |
| 178 * method with the same name on the receiver, if available. This is | 187 * method with the same name on the receiver, if available. This is |
| 179 * the method that would have been called if the parameters had matched. | 188 * the signature of the method that would have been called if the parameters |
| 189 * had matched. | |
| 180 */ | 190 */ |
| 181 NoSuchMethodError(Object this._receiver, | 191 NoSuchMethodError(Object receiver, |
|
ahe
2013/08/30 06:46:35
FWIW, this constructor is somewhat useless for dar
Lasse Reichstein Nielsen
2013/08/30 14:06:02
I agree that this is an odd signature for a class
| |
| 182 String this._memberName, | 192 Symbol memberName, |
| 183 List this._arguments, | 193 List positionalArguments, |
| 184 Map<String,dynamic> this._namedArguments, | 194 Map<Symbol ,dynamic> namedArguments, |
| 185 [List existingArgumentNames = null]) | 195 [List existingArgumentNames = null]) |
| 186 : this._existingArgumentNames = existingArgumentNames; | 196 : _receiver = receiver, |
|
ahe
2013/08/30 06:46:35
Why not use "this" parameters?
Lasse Reichstein Nielsen
2013/08/30 14:06:02
This is a public constructor, so that would make t
| |
| 197 _memberName = memberName, | |
| 198 _arguments = positionalArguments, | |
| 199 _namedArguments = namedArguments, | |
| 200 _existingArgumentNames = existingArgumentNames; | |
| 187 | 201 |
| 188 external String toString(); | 202 external String toString(); |
| 189 } | 203 } |
| 190 | 204 |
| 191 | 205 |
| 192 /** | 206 /** |
| 193 * The operation was not allowed by the object. | 207 * The operation was not allowed by the object. |
| 194 * | 208 * |
| 195 * This [Error] is thrown when an instance cannot implement one of the methods | 209 * This [Error] is thrown when an instance cannot implement one of the methods |
| 196 * in its signature. | 210 * in its signature. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 * the first time it is read. If evaluating the initializer expression causes | 293 * the first time it is read. If evaluating the initializer expression causes |
| 280 * another read of the variable, this error is thrown. | 294 * another read of the variable, this error is thrown. |
| 281 */ | 295 */ |
| 282 class CyclicInitializationError extends Error { | 296 class CyclicInitializationError extends Error { |
| 283 final String variableName; | 297 final String variableName; |
| 284 CyclicInitializationError([this.variableName]); | 298 CyclicInitializationError([this.variableName]); |
| 285 String toString() => variableName == null | 299 String toString() => variableName == null |
| 286 ? "Reading static variable during its initialization" | 300 ? "Reading static variable during its initialization" |
| 287 : "Reading static variable '$variableName' during its initialization"; | 301 : "Reading static variable '$variableName' during its initialization"; |
| 288 } | 302 } |
| OLD | NEW |