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

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

Issue 2778223002: Add primitive to create closures and use it for closure conversion (Closed)
Patch Set: Follow common pattern for AST nodes with References in ClosureCreation Created 3 years, 9 months 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/type_variables.dart.expect
diff --git a/pkg/kernel/testcases/closures/type_variables.dart.expect b/pkg/kernel/testcases/closures/type_variables.dart.expect
index 3b1f3295007464e4cd1015a15ad748ba99b6ee29..c9993e0fa6d75f150c69fa1d1c8d2c0462ad4bd5 100644
--- a/pkg/kernel/testcases/closures/type_variables.dart.expect
+++ b/pkg/kernel/testcases/closures/type_variables.dart.expect
@@ -9,71 +9,19 @@ class C<T extends core::Object, S extends core::Object> extends core::Object {
method foo(self::C::S s) → dynamic {
final Vector #context = MakeVector(2);
#context[1] = this;
- return new self::Closure#C#foo#function::•<self::C::T, self::C::S>(#context);
+ return MakeClosure<(dynamic) → dynamic>(self::closure#C#foo#function, #context);
}
method bar() → dynamic {
self::C<self::C::T, self::C::S> self = this;
}
method baz() → dynamic {
- return new self::Closure#C#baz#function::•<self::C::T, self::C::S>(null);
+ return MakeClosure<() → dynamic>(self::closure#C#baz#function, 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);
+ final () → dynamic local = MakeClosure<() → dynamic>(self::closure#C#function#local, 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 Vector context;
- constructor •(final Vector 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 Vector #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[1];
- 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 Vector context;
- constructor •(final Vector 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 Vector #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 Vector context;
- constructor •(final Vector 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 Vector #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 Vector context;
- constructor •(final Vector 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 Vector #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();
@@ -84,3 +32,19 @@ static method main(dynamic arguments) → dynamic {
}
core::print(c);
}
+static method closure#C#foo#function(Vector #contextParameter, dynamic x) → dynamic {
+ dynamic y = x;
+ core::Object z = y;
+ self::C<dynamic, dynamic> self = #contextParameter[1];
+ return z as dynamic;
+}
+static method closure#C#baz#function#function(Vector #contextParameter) → dynamic {
+ return self::C::•<dynamic, dynamic>();
+}
+static method closure#C#baz#function(Vector #contextParameter) → dynamic {
+ return MakeClosure<() → dynamic>(self::closure#C#baz#function#function, #contextParameter);
+}
+static method closure#C#function#local(Vector #contextParameter) → dynamic {
+ self::C<dynamic, dynamic> self = new self::C::internal<dynamic, dynamic>();
+ return self;
+}

Powered by Google App Engine
This is Rietveld 408576698