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

Side by Side Diff: runtime/lib/errors_patch.dart

Issue 2785623004: Fix #14144 confusing error message misusing a callable object (Closed)
Patch Set: Realized that doing .runtimeType == _Closure is unnecessary, doing 'is' now. Created 3 years, 8 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_inliner.cc » ('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 @patch 5 @patch
6 class Error { 6 class Error {
7 @patch 7 @patch
8 static String _objectToString(Object object) { 8 static String _objectToString(Object object) {
9 return Object._toString(object); 9 return Object._toString(object);
10 } 10 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 { 305 {
306 if (_receiver == null) { 306 if (_receiver == null) {
307 if (args_mismatch) { 307 if (args_mismatch) {
308 msg_buf.writeln("The null object does not have a $type_str " 308 msg_buf.writeln("The null object does not have a $type_str "
309 "'$memberName'$args_message."); 309 "'$memberName'$args_message.");
310 } else { 310 } else {
311 msg_buf 311 msg_buf
312 .writeln("The $type_str '$memberName' was called on null."); 312 .writeln("The $type_str '$memberName' was called on null.");
313 } 313 }
314 } else { 314 } else {
315 if (_receiver is Function) { 315 if (_receiver is _Closure) {
316 msg_buf.writeln("Closure call with mismatched arguments: " 316 msg_buf.writeln("Closure call with mismatched arguments: "
317 "function '$memberName'"); 317 "function '$memberName'");
318 } else if (_receiver is _Type && memberName == "call") { 318 } else if (_receiver is _Type && memberName == "call") {
319 is_type_call = true; 319 is_type_call = true;
320 String name = _receiver.toString(); 320 String name = _receiver.toString();
321 msg_buf.writeln("Attempted to use type '$name' as a function. " 321 msg_buf.writeln("Attempted to use type '$name' as a function. "
322 "Since types do not define a method 'call', this is not " 322 "Since types do not define a method 'call', this is not "
323 "possible. Did you intend to call the $name constructor and " 323 "possible. Did you intend to call the $name constructor and "
324 "forget the 'new' operator?"); 324 "forget the 'new' operator?");
325 } else { 325 } else {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 return msg_buf.toString(); 389 return msg_buf.toString();
390 } 390 }
391 } 391 }
392 392
393 class _CompileTimeError extends Error { 393 class _CompileTimeError extends Error {
394 final String _errorMsg; 394 final String _errorMsg;
395 _CompileTimeError(this._errorMsg); 395 _CompileTimeError(this._errorMsg);
396 String toString() => _errorMsg; 396 String toString() => _errorMsg;
397 } 397 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698