blob: 0939dadaad9f2b973e286a1161facb2ad366ec62 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
import "dart:mock" as mock;
class C<T extends core::Object, S extends core::Object> extends core::Object {
constructor internal() void
: super core::Object::•()
;
method foo(self::C::S s) dynamic {
final mock::Context #context = new mock::Context::•(1);
#context.parent = null;
#context.[]=(0, this);
return new self::Closure#C#foo#function::•<self::C::T, self::C::S>(#context);
}
method baz() dynamic {
return new self::Closure#C#baz#function::•<self::C::T, self::C::S>(null);
}
static factory •<T extends core::Object, S extends core::Object>() self::C<self::C::•::T, self::C::•::S> {
final () dynamic local = new self::Closure#C#function#local::•<self::C::•::T, self::C::•::S>(null);
return local.call();
}
}
class Closure#C#foo#function<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
field core::String note = "This is temporary. The VM doesn't need closure classes.";
field mock::Context context;
constructor •(final mock::Context context) dynamic
: self::Closure#C#foo#function::context = context
;
method call(self::Closure#C#foo#function::T x) → dynamic {
"This is a temporary solution. In the VM, this will become an additional parameter.";
final mock::Context #contextParameter = this.{self::Closure#C#foo#function::context};
self::Closure#C#foo#function::T y = x;
core::Object z = y;
self::C<self::Closure#C#foo#function::T, self::Closure#C#foo#function::S> self = #contextParameter.[](0);
return z as self::Closure#C#foo#function::T;
}
}
class Closure#C#baz#function#function<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
field core::String note = "This is temporary. The VM doesn't need closure classes.";
field mock::Context context;
constructor •(final mock::Context context) dynamic
: self::Closure#C#baz#function#function::context = context
;
method call() dynamic {
"This is a temporary solution. In the VM, this will become an additional parameter.";
final mock::Context #contextParameter = this.{self::Closure#C#baz#function#function::context};
return self::C::•<self::Closure#C#baz#function#function::T, self::Closure#C#baz#function#function::S>();
}
}
class Closure#C#baz#function<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
field core::String note = "This is temporary. The VM doesn't need closure classes.";
field mock::Context context;
constructor •(final mock::Context context) dynamic
: self::Closure#C#baz#function::context = context
;
method call() dynamic {
"This is a temporary solution. In the VM, this will become an additional parameter.";
final mock::Context #contextParameter = this.{self::Closure#C#baz#function::context};
return new self::Closure#C#baz#function#function::•<self::Closure#C#baz#function::T, self::Closure#C#baz#function::S>(#contextParameter);
}
}
class Closure#C#function#local<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
field core::String note = "This is temporary. The VM doesn't need closure classes.";
field mock::Context context;
constructor •(final mock::Context context) dynamic
: self::Closure#C#function#local::context = context
;
method call() dynamic {
"This is a temporary solution. In the VM, this will become an additional parameter.";
final mock::Context #contextParameter = this.{self::Closure#C#function#local::context};
self::C<self::Closure#C#function#local::T, self::Closure#C#function#local::S> self = new self::C::internal<self::Closure#C#function#local::T, self::Closure#C#function#local::S>();
return self;
}
}
static method main(dynamic arguments) dynamic {
core::print(self::C::•<core::String, core::String>().foo(null).call(arguments.first));
dynamic c = self::C::•<core::int, core::int>().baz().call().call();
if(!(c is self::C<core::int, core::int>))
throw "${c} fails type test 'is C<int, int>'";
if(c is self::C<core::String, core::String>) {
throw "${c} passes type test 'is C<String, String>'";
}
core::print(c);
}