| 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 import "dart:mock" as mock; | |
| 5 | 4 |
| 6 class C extends core::Object { | 5 class C extends core::Object { |
| 7 field dynamic x = null; | 6 field dynamic x = null; |
| 8 constructor •() → void | 7 constructor •() → void |
| 9 : super core::Object::•() | 8 : super core::Object::•() |
| 10 ; | 9 ; |
| 11 method m() → dynamic { | 10 method m() → dynamic { |
| 12 final mock::Context #context = new mock::Context::•(1); | 11 final Vector #context = MakeVector(2); |
| 13 #context.[]=(0, this); | 12 #context[1] = this; |
| 14 return new self::Closure#C#m#function::•(#context); | 13 return new self::Closure#C#m#function::•(#context); |
| 15 } | 14 } |
| 16 method f() → dynamic { | 15 method f() → dynamic { |
| 17 final mock::Context #context = new mock::Context::•(1); | 16 final Vector #context = MakeVector(2); |
| 18 #context.[]=(0, this); | 17 #context[1] = this; |
| 19 return new self::Closure#C#f#function::•(#context); | 18 return new self::Closure#C#f#function::•(#context); |
| 20 } | 19 } |
| 21 } | 20 } |
| 22 class Closure#C#m#function extends core::Object implements core::Function { | 21 class Closure#C#m#function extends core::Object implements core::Function { |
| 23 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 22 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 24 field mock::Context context; | 23 field Vector context; |
| 25 constructor •(final mock::Context context) → dynamic | 24 constructor •(final Vector context) → dynamic |
| 26 : self::Closure#C#m#function::context = context | 25 : self::Closure#C#m#function::context = context |
| 27 ; | 26 ; |
| 28 method call(dynamic v) → dynamic { | 27 method call(dynamic v) → dynamic { |
| 29 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 28 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 30 final mock::Context #contextParameter = this.{self::Closure#C#m#function::co
ntext}; | 29 final Vector #contextParameter = this.{self::Closure#C#m#function::context}; |
| 31 return #contextParameter.[](0).x = v; | 30 return (#contextParameter[1]).x = v; |
| 32 } | 31 } |
| 33 } | 32 } |
| 34 class Closure#C#f#function#function extends core::Object implements core::Functi
on { | 33 class Closure#C#f#function#function extends core::Object implements core::Functi
on { |
| 35 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 34 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 36 field mock::Context context; | 35 field Vector context; |
| 37 constructor •(final mock::Context context) → dynamic | 36 constructor •(final Vector context) → dynamic |
| 38 : self::Closure#C#f#function#function::context = context | 37 : self::Closure#C#f#function#function::context = context |
| 39 ; | 38 ; |
| 40 method call() → dynamic { | 39 method call() → dynamic { |
| 41 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 40 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 42 final mock::Context #contextParameter = this.{self::Closure#C#f#function#fun
ction::context}; | 41 final Vector #contextParameter = this.{self::Closure#C#f#function#function::
context}; |
| 43 return #contextParameter.[](0).x; | 42 return (#contextParameter[1]).x; |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 class Closure#C#f#function extends core::Object implements core::Function { | 45 class Closure#C#f#function extends core::Object implements core::Function { |
| 47 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 46 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 48 field mock::Context context; | 47 field Vector context; |
| 49 constructor •(final mock::Context context) → dynamic | 48 constructor •(final Vector context) → dynamic |
| 50 : self::Closure#C#f#function::context = context | 49 : self::Closure#C#f#function::context = context |
| 51 ; | 50 ; |
| 52 method call() → dynamic { | 51 method call() → dynamic { |
| 53 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 52 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 54 final mock::Context #contextParameter = this.{self::Closure#C#f#function::co
ntext}; | 53 final Vector #contextParameter = this.{self::Closure#C#f#function::context}; |
| 55 return new self::Closure#C#f#function#function::•(#contextParameter); | 54 return new self::Closure#C#f#function#function::•(#contextParameter); |
| 56 } | 55 } |
| 57 } | 56 } |
| 58 static method main() → dynamic { | 57 static method main() → dynamic { |
| 59 self::C c = new self::C::•(); | 58 self::C c = new self::C::•(); |
| 60 c.x = 41; | 59 c.x = 41; |
| 61 c.m().call(42); | 60 c.m().call(42); |
| 62 if(!42.==(c.x)) | 61 if(!42.==(c.x)) |
| 63 throw "Unexpected value in c.x: ${c.x}"; | 62 throw "Unexpected value in c.x: ${c.x}"; |
| 64 dynamic result = c.f().call().call(); | 63 dynamic result = c.f().call().call(); |
| 65 if(!42.==(result)) | 64 if(!42.==(result)) |
| 66 throw "Unexpected value from c.f()()(): ${result}"; | 65 throw "Unexpected value from c.f()()(): ${result}"; |
| 67 } | 66 } |
| OLD | NEW |