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

Unified Diff: pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart

Issue 2962263002: fix #30030, fix #27327 - fix tearoffs and various Object member bugs (Closed)
Patch Set: fix Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
index 83937394714a1d5324d1abc8c22b7663fd39a5fc..fb5447e02cd3185ac19c9c89fe6a8adea0fa4324 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
@@ -553,46 +553,38 @@ class NoSuchMethodError {
@patch
String toString() {
- StringBuffer sb = new StringBuffer();
- int i = 0;
+ StringBuffer sb = new StringBuffer('');
+ String comma = '';
if (_arguments != null) {
- for (; i < _arguments.length; i++) {
- if (i > 0) {
- sb.write(", ");
- }
- sb.write(Error.safeToString(_arguments[i]));
+ for (var argument in _arguments) {
+ sb.write(comma);
+ sb.write(Error.safeToString(argument));
+ comma = ', ';
}
}
if (_namedArguments != null) {
_namedArguments.forEach((Symbol key, var value) {
- if (i > 0) {
- sb.write(", ");
- }
+ sb.write(comma);
sb.write(_symbolToString(key));
sb.write(": ");
sb.write(Error.safeToString(value));
- i++;
+ comma = ', ';
});
}
+ String memberName = _symbolToString(_memberName);
+ String receiverText = Error.safeToString(_receiver);
+ String actualParameters = '$sb';
if (_existingArgumentNames == null) {
- return "NoSuchMethodError : method not found: '$_memberName'\n"
- "Receiver: ${Error.safeToString(_receiver)}\n"
- "Arguments: [$sb]";
+ return "NoSuchMethodError: method not found: '$memberName'\n"
+ "Receiver: ${receiverText}\n"
+ "Arguments: [$actualParameters]";
} else {
- String actualParameters = sb.toString();
- sb = new StringBuffer();
- for (int i = 0; i < _existingArgumentNames.length; i++) {
- if (i > 0) {
- sb.write(", ");
- }
- sb.write(_existingArgumentNames[i]);
- }
- String formalParameters = sb.toString();
+ String formalParameters = _existingArgumentNames.join(', ');
return "NoSuchMethodError: incorrect number of arguments passed to "
- "method named '$_memberName'\n"
- "Receiver: ${Error.safeToString(_receiver)}\n"
- "Tried calling: $_memberName($actualParameters)\n"
- "Found: $_memberName($formalParameters)";
+ "method named '$memberName'\n"
+ "Receiver: ${receiverText}\n"
+ "Tried calling: $memberName($actualParameters)\n"
+ "Found: $memberName($formalParameters)";
}
}
}

Powered by Google App Engine
This is Rietveld 408576698