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

Unified Diff: tests/language/call_operator_test.dart

Issue 10834270: Implement call operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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: tests/language/call_operator_test.dart
diff --git a/tests/language/call_operator_test.dart b/tests/language/call_operator_test.dart
index b89c8bcf8a234c4485d9c32a78b67b29704a885c..d03ece0bfdca44a93f05ac42ac9fc990ef92e4f2 100644
--- a/tests/language/call_operator_test.dart
+++ b/tests/language/call_operator_test.dart
@@ -5,36 +5,36 @@
// simple test with no types in signature
class A1 {
- operator call() => 42;
+ call() => 42;
}
// same test, include return type
class A2 {
- int operator call() => 35;
+ int call() => 35;
}
class B {
- call() => 28; // expect warning, should use 'operator call'
+ call() => 28;
}
// A call() operator can have any arity
class C {
- operator call(arg) => 7 * arg;
+ call(arg) => 7 * arg;
}
// Test named arguments
class D {
- operator call([arg=6]) => 7 * arg;
+ call([arg=6]) => 7 * arg;
}
-// non-trvial method body combination of positional and named
+// non-trivial method body combination of positional and named
class E {
- String operator call(String str, [int count=1]) {
+ String call(String str, [int count=1]) {
String result = "";
kasperl 2012/08/10 10:16:28 How about using a StringBuffer here? Seems cleaner
floitsch 2012/08/10 12:19:16 Done.
for (var i = 0; i < count; i++) {
- result += str;
+ result = "$result$str";
if (i < count -1) {
kasperl 2012/08/10 10:16:28 -1 => - 1
floitsch 2012/08/10 12:19:16 Done.
- result += ':';
+ result = '$result:';
}
}
return result;

Powered by Google App Engine
This is Rietveld 408576698