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

Side by Side Diff: tests/language/local_function_test.dart

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Dart test program testing closures. 4 // Dart test program testing closures.
5 5
6 class LocalFunctionTest { 6 class LocalFunctionTest {
7 LocalFunctionTest() : field1 = 100, field2_ = 200 { } 7 LocalFunctionTest() : field1 = 100, field2_ = 200 { }
8 static int f(int n) { 8 static int f(int n) {
9 int a = 0; 9 int a = 0;
10 g(int m) { 10 g(int m) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 for (int i = 0; i < n; i++) { 48 for (int i = 0; i < n; i++) {
49 a_sum += a[i](); 49 a_sum += a[i]();
50 b_sum += b[i](); 50 b_sum += b[i]();
51 } 51 }
52 return a_sum + b_sum; 52 return a_sum + b_sum;
53 } 53 }
54 return k(n); 54 return k(n);
55 } 55 }
56 int field1; 56 int field1;
57 int field2_; 57 int field2_;
58 int get field2() { return field2_; } 58 int get field2 { return field2_; }
59 void set field2(int value) { field2_ = value; } 59 void set field2(int value) { field2_ = value; }
60 60
61 int method(int n) { 61 int method(int n) {
62 incField1() { field1++; } 62 incField1() { field1++; }
63 incField2() { field2++; } 63 incField2() { field2++; }
64 for (int i = 0; i < n; i++) { 64 for (int i = 0; i < n; i++) {
65 incField1(); 65 incField1();
66 incField2(); 66 incField2();
67 } 67 }
68 return field1 + field2; 68 return field1 + field2;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 Expect.equals(99, doThis(10, int f(n) => n * n - 1)); 195 Expect.equals(99, doThis(10, int f(n) => n * n - 1));
196 Expect.equals(99, doThis(10, (n) => n * n - 1)); 196 Expect.equals(99, doThis(10, (n) => n * n - 1));
197 Expect.equals(99, doThis(10, f(n) => n * n - 1)); 197 Expect.equals(99, doThis(10, f(n) => n * n - 1));
198 testExceptions(); 198 testExceptions();
199 } 199 }
200 } 200 }
201 201
202 main() { 202 main() {
203 LocalFunctionTest.testMain(); 203 LocalFunctionTest.testMain();
204 } 204 }
OLDNEW
« no previous file with comments | « tests/language/field6a_negative_test.dart ('k') | tests/language/override_field_method2_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698