| 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 class Closure#main#function extends core::Object implements core::Function { | |
| 6 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
| 7 field Vector context; | |
| 8 constructor •(final Vector context) → dynamic | |
| 9 : self::Closure#main#function::context = context | |
| 10 ; | |
| 11 method call() → dynamic { | |
| 12 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
| 13 final Vector #contextParameter = this.{self::Closure#main#function::context}
; | |
| 14 core::print(#contextParameter[1]); | |
| 15 if(!(#contextParameter[2]).==(null)) | |
| 16 core::print(#contextParameter[2]); | |
| 17 } | |
| 18 } | |
| 19 static method main() → dynamic { | 5 static method main() → dynamic { |
| 20 dynamic c; | 6 dynamic c; |
| 21 try { | 7 try { |
| 22 throw "Fisk"; | 8 throw "Fisk"; |
| 23 } | 9 } |
| 24 on core::String catch(dynamic #t1, dynamic #t2) { | 10 on core::String catch(dynamic #t1, dynamic #t2) { |
| 25 final Vector #context = MakeVector(3); | 11 final Vector #context = MakeVector(3); |
| 26 #context[1] = #t1; | 12 #context[1] = #t1; |
| 27 #context[2] = #t2; | 13 #context[2] = #t2; |
| 28 c = new self::Closure#main#function::•(#context); | 14 c = MakeClosure<() → dynamic>(self::closure#main#function, #context); |
| 29 } | 15 } |
| 30 c.call(); | 16 c.call(); |
| 31 core::print("TEST PASSED"); | 17 core::print("TEST PASSED"); |
| 32 } | 18 } |
| 19 static method closure#main#function(Vector #contextParameter) → dynamic { |
| 20 core::print(#contextParameter[1]); |
| 21 if(!(#contextParameter[2]).==(null)) |
| 22 core::print(#contextParameter[2]); |
| 23 } |
| OLD | NEW |