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

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: Simplify nested loop and add TODO.p 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
« no previous file with comments | « tests/compiler/dart2js/closure_codegen_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..56ef41ec1398ff712b25b317c9d17913e5883fc9 100644
--- a/tests/language/call_operator_test.dart
+++ b/tests/language/call_operator_test.dart
@@ -5,39 +5,39 @@
// 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 result = "";
+ String call(String str, [int count=1]) {
+ StringBuffer buffer = new StringBuffer();
for (var i = 0; i < count; i++) {
- result += str;
- if (i < count -1) {
- result += ':';
+ buffer.add(str);
+ if (i < count - 1) {
+ buffer.add(":");
}
}
- return result;
+ return buffer.toString();
}
}
« no previous file with comments | « tests/compiler/dart2js/closure_codegen_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698