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

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

Issue 10855174: Lazy implementation of final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove lazy bailout initializers. 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
(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();
6 var x2 = foo2();
7 var x3 = foo3();
8 var x4 = foo4();
9 var x5 = foo5();
10 final x6 = foo6();
11 var x7 = x7 + 1;
12
13 foo() { throw "interrupt initialization"; }
14 foo2() { x2 = 499; throw "interrupt initialization"; }
15 foo3() => x3 + 1;
16 foo4() {
17 x4 = 498;
18 x4 = x4 + 1;
19 return x4;
20 }
21 foo5() {
22 x5 = 498;
23 x5 = x5 + 1;
24 }
25 foo6() {
26 try {
27 return x5 + 1;
28 } catch(e) {
kasperl 2012/09/05 08:54:54 I prefer to put a space between catch and (.
floitsch 2012/09/05 09:31:07 Done.
29 return 499;
30 }
31 }
32
33 fib(x) {
34 if (x < 2) return x;
35 return fib(x - 1) + fib(x - 2);
36 }
37
38 main() {
39 Expect.throws(() => fib(x));
kasperl 2012/09/05 08:54:54 How about adding a check that verifies that you're
floitsch 2012/09/05 09:31:07 Done.
40 Expect.equals(null, x);
41
42 Expect.throws(() => fib(x2));
43 Expect.equals(499, x2);
44
45 Expect.throws(() => fib(x3));
46 Expect.equals(null, x3);
47
48 Expect.equals(499, x4);
49
50 Expect.equals(null, x5);
51
52 Expect.equals(499, x6);
53
54 Expect.throws(() => fib(x7));
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698