Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Unified Diff: pkg/kernel/testcases/closures/instance_tear_off.dart.expect

Issue 2561723003: Merge kernel closure conversion into the Dart SDK (Closed)
Patch Set: Remove path constraint Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/kernel/testcases/closures/instance_tear_off.dart.expect
diff --git a/pkg/kernel/testcases/closures/instance_tear_off.dart.expect b/pkg/kernel/testcases/closures/instance_tear_off.dart.expect
new file mode 100644
index 0000000000000000000000000000000000000000..a67a1fd4ac2da77a28ec8db757685def7c8e02d1
--- /dev/null
+++ b/pkg/kernel/testcases/closures/instance_tear_off.dart.expect
@@ -0,0 +1,302 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class C extends core::Object {
+ field dynamic f = new self::Closure#C#f#function::•(null);
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ get g() → dynamic {
+ return new self::Closure#C#g#function::•(null);
+ }
+ method a() → dynamic {
+ return "a";
+ }
+ method b(dynamic x) → dynamic {
+ return x;
+ }
+ method c(dynamic x, [dynamic y = 2]) → dynamic {
+ return x.+(y);
+ }
+ method d(dynamic x, {dynamic y = 2}) → dynamic {
+ return x.+(y);
+ }
+ get a#get() → dynamic
+ return new self::Closure#C#a::•(this);
+ get b#get() → dynamic
+ return new self::Closure#C#b::•(this);
+ get c#get() → dynamic
+ return new self::Closure#C#c::•(this);
+ get d#get() → dynamic
+ return new self::Closure#C#d::•(this);
+}
+class D<T extends core::Object> extends core::Object {
+ field dynamic f = new self::Closure#D#f#function::•(null);
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ get g() → dynamic {
+ return new self::Closure#D#g#function::•(null);
+ }
+ method a() → dynamic {
+ return "a";
+ }
+ method b(dynamic x) → dynamic {
+ return x;
+ }
+ method c(dynamic x, [dynamic y = 2]) → dynamic {
+ return x.+(y);
+ }
+ method d(dynamic x, {dynamic y = 2}) → dynamic {
+ return x.+(y);
+ }
+ get a#get() → dynamic
+ return new self::Closure#D#a::•<self::D::T>(this);
+ get b#get() → dynamic
+ return new self::Closure#D#b::•<self::D::T>(this);
+ get c#get() → dynamic
+ return new self::Closure#D#c::•<self::D::T>(this);
+ get d#get() → dynamic
+ return new self::Closure#D#d::•<self::D::T>(this);
+}
+class E<T extends core::Object> extends core::Object {
+ field dynamic f = new self::Closure#E#f#function::•(null);
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ get g() → dynamic {
+ return new self::Closure#E#g#function::•<self::E::T>(null);
+ }
+ method a() → dynamic {
+ return "a";
+ }
+ method b(self::E::T x) → dynamic {
+ return x;
+ }
+ method c(self::E::T x, [self::E::T y = 2]) → dynamic {
+ return x.+(y);
+ }
+ method d(self::E::T x, {self::E::T y = 2}) → dynamic {
+ return x.+(y);
+ }
+ get a#get() → dynamic
+ return new self::Closure#E#a::•<self::E::T>(this);
+ get b#get() → dynamic
+ return new self::Closure#E#b::•<self::E::T>(this);
+ get c#get() → dynamic
+ return new self::Closure#E#c::•<self::E::T>(this);
+ get d#get() → dynamic
+ return new self::Closure#E#d::•<self::E::T>(this);
+}
+class Closure#C#g#function 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#g#function::context = context
+ ;
+ method call(dynamic x) → dynamic {
+ "This is a temporary solution. In the VM, this will become an additional parameter.";
+ final mock::Context #contextParameter = this.{self::Closure#C#g#function::context};
+ return "g(${x})";
+ }
+}
+class Closure#C#a extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::C self;
+ constructor •(final self::C self) → dynamic
+ : self::Closure#C#a::self = self
+ ;
+ method call() → dynamic
+ return this.{self::Closure#C#a::self}.{self::C::a}();
+}
+class Closure#C#b extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::C self;
+ constructor •(final self::C self) → dynamic
+ : self::Closure#C#b::self = self
+ ;
+ method call(dynamic x) → dynamic
+ return this.{self::Closure#C#b::self}.{self::C::b}(x);
+}
+class Closure#C#c extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::C self;
+ constructor •(final self::C self) → dynamic
+ : self::Closure#C#c::self = self
+ ;
+ method call(dynamic x, [dynamic y = 2]) → dynamic
+ return this.{self::Closure#C#c::self}.{self::C::c}(x, y);
+}
+class Closure#C#d extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::C self;
+ constructor •(final self::C self) → dynamic
+ : self::Closure#C#d::self = self
+ ;
+ method call(dynamic x, {dynamic y = 2}) → dynamic
+ return this.{self::Closure#C#d::self}.{self::C::d}(x, y: y);
+}
+class Closure#C#f#function 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#f#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#f#function::context};
+ return "f";
+ }
+}
+class Closure#D#g#function 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#D#g#function::context = context
+ ;
+ method call(dynamic x) → dynamic {
+ "This is a temporary solution. In the VM, this will become an additional parameter.";
+ final mock::Context #contextParameter = this.{self::Closure#D#g#function::context};
+ return "g(${x})";
+ }
+}
+class Closure#D#a<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::D<self::Closure#D#a::T> self;
+ constructor •(final self::D<self::Closure#D#a::T> self) → dynamic
+ : self::Closure#D#a::self = self
+ ;
+ method call() → dynamic
+ return this.{self::Closure#D#a::self}.{self::D::a}();
+}
+class Closure#D#b<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::D<self::Closure#D#b::T> self;
+ constructor •(final self::D<self::Closure#D#b::T> self) → dynamic
+ : self::Closure#D#b::self = self
+ ;
+ method call(dynamic x) → dynamic
+ return this.{self::Closure#D#b::self}.{self::D::b}(x);
+}
+class Closure#D#c<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::D<self::Closure#D#c::T> self;
+ constructor •(final self::D<self::Closure#D#c::T> self) → dynamic
+ : self::Closure#D#c::self = self
+ ;
+ method call(dynamic x, [dynamic y = 2]) → dynamic
+ return this.{self::Closure#D#c::self}.{self::D::c}(x, y);
+}
+class Closure#D#d<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::D<self::Closure#D#d::T> self;
+ constructor •(final self::D<self::Closure#D#d::T> self) → dynamic
+ : self::Closure#D#d::self = self
+ ;
+ method call(dynamic x, {dynamic y = 2}) → dynamic
+ return this.{self::Closure#D#d::self}.{self::D::d}(x, y: y);
+}
+class Closure#D#f#function 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#D#f#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#D#f#function::context};
+ return "f";
+ }
+}
+class Closure#E#g#function<T 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#E#g#function::context = context
+ ;
+ method call(self::Closure#E#g#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#E#g#function::context};
+ return "g(${x})";
+ }
+}
+class Closure#E#a<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::E<self::Closure#E#a::T> self;
+ constructor •(final self::E<self::Closure#E#a::T> self) → dynamic
+ : self::Closure#E#a::self = self
+ ;
+ method call() → dynamic
+ return this.{self::Closure#E#a::self}.{self::E::a}();
+}
+class Closure#E#b<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::E<self::Closure#E#b::T> self;
+ constructor •(final self::E<self::Closure#E#b::T> self) → dynamic
+ : self::Closure#E#b::self = self
+ ;
+ method call(self::Closure#E#b::T x) → dynamic
+ return this.{self::Closure#E#b::self}.{self::E::b}(x);
+}
+class Closure#E#c<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::E<self::Closure#E#c::T> self;
+ constructor •(final self::E<self::Closure#E#c::T> self) → dynamic
+ : self::Closure#E#c::self = self
+ ;
+ method call(self::Closure#E#c::T x, [self::Closure#E#c::T y = 2]) → dynamic
+ return this.{self::Closure#E#c::self}.{self::E::c}(x, y);
+}
+class Closure#E#d<T extends core::Object> extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field self::E<self::Closure#E#d::T> self;
+ constructor •(final self::E<self::Closure#E#d::T> self) → dynamic
+ : self::Closure#E#d::self = self
+ ;
+ method call(self::Closure#E#d::T x, {self::Closure#E#d::T y = 2}) → dynamic
+ return this.{self::Closure#E#d::self}.{self::E::d}(x, y: y);
+}
+class Closure#E#f#function 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#E#f#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#E#f#function::context};
+ return "f";
+ }
+}
+static method expect(dynamic expected, dynamic actual) → dynamic {
+ core::print("Expecting '${expected}' and got '${actual}'");
+ if(!expected.==(actual)) {
+ core::print("Expected '${expected}' but got '${actual}'");
+ throw "Expected '${expected}' but got '${actual}'";
+ }
+}
+static method test(dynamic o) → dynamic {
+ self::expect("f", o.f());
+ self::expect("f", o.f.call());
+ self::expect("g(42)", o.g(42));
+ self::expect("g(42)", o.g.call(42));
+ self::expect("a", o.a());
+ self::expect("a", o.a#get.call());
+ self::expect(42, o.b(42));
+ self::expect(42, o.b#get.call(42));
+ self::expect(42, o.c(40));
+ self::expect(42, o.c#get.call(40));
+ self::expect(87, o.c(80, 7));
+ self::expect(87, o.c#get.call(80, 7));
+ self::expect(42, o.d(40));
+ self::expect(42, o.d#get.call(40));
+ self::expect(87, o.d(80, y: 7));
+ self::expect(87, o.d#get.call(80, y: 7));
+}
+static method main(dynamic arguments) → dynamic {
+ self::test(new self::C::•());
+ self::test(new self::D::•<core::int>());
+ self::test(new self::E::•<core::int>());
+}
« no previous file with comments | « pkg/kernel/testcases/closures/instance_tear_off.dart ('k') | pkg/kernel/testcases/closures/named_closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698