Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: sdk/lib/core/errors.dart

Issue 23486007: Change the field and constructor parameter types of NoSuchMethodError to Symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/collection/linked_hash_map.dart ('k') | sdk/lib/core/map.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
floitsch 2013/08/30 15:36:44 attempted to be called.
Lasse Reichstein Nielsen 2013/09/02 09:36:29 I think the original sounds more correct, "attempt
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
floitsch 2013/08/30 15:36:44 If it is `null` ... (don't use "this")
Lasse Reichstein Nielsen 2013/09/02 09:36:29 As a rule of thumb, I try to avoid "it" as well. I
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
floitsch 2013/08/30 15:36:44 memberName
Lasse Reichstein Nielsen 2013/09/02 09:36:29 Done.
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,
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,
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/linked_hash_map.dart ('k') | sdk/lib/core/map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698