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

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

Issue 10855174: Lazy implementation of final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase wrt CL 10832351. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 final x = foo();
kasperl 2012/08/17 09:30:04 I guess we still need tests for the exceptional ca
floitsch 2012/09/04 17:32:21 Done.
6 final y = y2(y3);
7 final y2 = incrementCreator();
8 final y3 = fib(5);
9
10 foo() => 499;
11
12 incrementCreator() => (x) => x + 1;
13 fib(x) {
14 if (x < 2) return x;
15 return fib(x - 1) + fib(x - 2);
16 }
17
18 class A {
19 static final a = toto();
20 static final b = b2(b3);
21 static final b2 = decrementCreator();
22 static final b3 = fact(5);
23
24 static toto() => 666;
25
26 static decrementCreator() => (x) => x - 1;
27 static fact(x) {
28 if (x <= 1) return x;
29 return x * fact(x - 1);
30 }
31 }
32
33 main() {
34 Expect.equals(499, x);
35 Expect.equals(6, y);
36 Expect.equals(666, A.a);
37 Expect.equals(119, A.b);
38 }
OLDNEW
« tests/language/language_dart2js.status ('K') | « tests/language/lazy_final2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698