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