OLD | NEW |
| (Empty) |
1 library; | |
2 import self as self; | |
3 import "dart:core" as core; | |
4 | |
5 static method foo() → dynamic { | |
6 try { | |
7 return; | |
8 } | |
9 finally { | |
10 core::print("Hello from finally block!"); | |
11 } | |
12 } | |
13 static method bar() → dynamic async { | |
14 await for (dynamic x in <dynamic>[]) { | |
15 yield x; | |
16 yield* x; | |
17 } | |
18 } | |
19 static method main() → dynamic { | |
20 do { | |
21 core::print("Hello from do-while!"); | |
22 } | |
23 while (false) | |
24 do | |
25 dynamic x = core::print("Hello from do-while!"); | |
26 while (false) | |
27 for (core::String s in <dynamic>["Hello from for-in!"]) { | |
28 core::print(s); | |
29 } | |
30 for (core::String s in <dynamic>["Hello from for-in without block!"]) | |
31 core::print(s); | |
32 dynamic s; | |
33 for (final dynamic #t1 in <dynamic>["Hello from for-in without decl!"]) { | |
34 s = #t1; | |
35 core::print(s); | |
36 } | |
37 for (final dynamic #t2 in <dynamic>["Hello from for-in without decl and block!
"]) { | |
38 s = #t2; | |
39 core::print(s); | |
40 } | |
41 core::print("Hello from labeled statement!"); | |
42 try { | |
43 try { | |
44 throw "Hello from rethrow!"; | |
45 } | |
46 on dynamic catch(dynamic e) { | |
47 rethrow; | |
48 } | |
49 } | |
50 on dynamic catch(dynamic e) { | |
51 core::print(e); | |
52 } | |
53 self::foo(); | |
54 core::bool done = false; | |
55 while (!done) { | |
56 done = true; | |
57 core::print("Hello from while!"); | |
58 } | |
59 ; | |
60 assert(true); | |
61 assert(true, "Hello from assert!"); | |
62 try { | |
63 assert(false, "Hello from assert!"); | |
64 } | |
65 on dynamic catch(dynamic e) { | |
66 core::print(e); | |
67 } | |
68 #L1: | |
69 switch(1) { | |
70 #L2: | |
71 case 1: | |
72 case 2: | |
73 { | |
74 core::print("Hello from switch case!"); | |
75 break #L1; | |
76 } | |
77 #L3: | |
78 default: | |
79 { | |
80 break #L1; | |
81 } | |
82 } | |
83 #L4: | |
84 switch(4) { | |
85 #L5: | |
86 case 2: | |
87 { | |
88 core::print("Hello from case 2!"); | |
89 break #L4; | |
90 } | |
91 #L6: | |
92 case 1: | |
93 { | |
94 core::print("Hello from case 1!"); | |
95 continue #L5; | |
96 } | |
97 #L7: | |
98 case 0: | |
99 { | |
100 core::print("Hello from case 0!"); | |
101 continue #L6; | |
102 } | |
103 #L8: | |
104 case 4: | |
105 { | |
106 core::print("Hello from case 4!"); | |
107 continue #L9; | |
108 } | |
109 #L9: | |
110 default: | |
111 { | |
112 continue #L7; | |
113 } | |
114 } | |
115 #L10: | |
116 switch(4) { | |
117 #L11: | |
118 case 1: | |
119 { | |
120 core::print("Hello from next case 1"); | |
121 break #L10; | |
122 } | |
123 #L12: | |
124 default: | |
125 { | |
126 continue #L11; | |
127 } | |
128 } | |
129 core::int i = 0; | |
130 #L13: | |
131 do | |
132 #L14: | |
133 { | |
134 core::print("Hello from do-while!"); | |
135 if((i = i.+(1)).<(3)) | |
136 break #L14; | |
137 break #L13; | |
138 } | |
139 while (true) | |
140 i = 0; | |
141 #L15: | |
142 while (true) | |
143 #L16: | |
144 { | |
145 core::print("Hello from while!"); | |
146 if((i = i.+(1)).<(3)) | |
147 break #L16; | |
148 break #L15; | |
149 } | |
150 } | |
OLD | NEW |