OLD | NEW |
1 library; | 1 library; |
2 import self as self; | 2 import self as self; |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 | 4 |
5 static method range(core::int high) → dynamic { | 5 static method range(core::int high) → dynamic { |
6 final dynamic #context = MakeVector(3); | 6 final dynamic #context = MakeVector(3); |
7 #context[2] = high; | 7 #context[2] = high; |
| 8 high = null; |
8 final (core::int) → dynamic iter = MakeClosure<(core::int) → dynamic>(self::cl
osure#range#iter, #context); | 9 final (core::int) → dynamic iter = MakeClosure<(core::int) → dynamic>(self::cl
osure#range#iter, #context); |
9 return iter; | 10 return iter; |
10 } | 11 } |
11 static method main() → dynamic { | 12 static method main() → dynamic { |
12 dynamic sum = 0; | 13 dynamic sum = 0; |
13 for (dynamic x in self::range(10).call(2)) | 14 for (dynamic x in self::range(10).call(2)) |
14 sum = sum.+(x); | 15 sum = sum.+(x); |
15 if(!sum.==(44)) { | 16 if(!sum.==(44)) { |
16 throw core::Exception::•("Incorrect output."); | 17 throw core::Exception::•("Incorrect output."); |
17 } | 18 } |
18 } | 19 } |
19 static method closure#range#iter(dynamic #contextParameter, core::int low) → dyn
amic /* originally sync* */ { | 20 static method closure#range#iter(dynamic #contextParameter, core::int low) → dyn
amic /* originally sync* */ { |
20 final dynamic #context = MakeVector(3); | 21 final dynamic #context = MakeVector(3); |
21 #context[1] = #contextParameter; | 22 #context[1] = #contextParameter; |
22 #context[2] = low; | 23 #context[2] = low; |
| 24 low = null; |
23 dynamic :await_jump_var = 0; | 25 dynamic :await_jump_var = 0; |
24 dynamic :await_ctx_var; | 26 dynamic :await_ctx_var; |
25 dynamic :sync_op = (core::Iterator<dynamic> :iterator) → core::bool yielding { | 27 dynamic :sync_op = (core::Iterator<dynamic> :iterator) → core::bool yielding { |
26 { | 28 { |
27 while ((let final dynamic #t1 = #contextParameter[2] in let final dynamic
#t2 = #contextParameter[2] = #t1.-(1) in #t1).>(#context[2])) { | 29 while ((let final dynamic #t1 = #contextParameter[2] in let final dynamic
#t2 = #contextParameter[2] = #t1.-(1) in #t1).>(#context[2])) { |
28 :iterator._current = #context[1][2]; | 30 :iterator._current = #context[1][2]; |
29 [yield] true; | 31 [yield] true; |
30 } | 32 } |
31 } | 33 } |
32 return false; | 34 return false; |
33 }; | 35 }; |
34 return new core::_SyncIterable::•(:sync_op); | 36 return new core::_SyncIterable::•(:sync_op); |
35 } | 37 } |
OLD | NEW |