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

Unified Diff: tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart

Issue 1067533003: cps-ir: Handle factories and redirecting constructors with JS backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix in test case Created 5 years, 8 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
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart
diff --git a/tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart
index 59a977761c96967d3ba0ab0a3230142616e9042a..4bae93fe07658bc2f792ad4ccdc2f21bd3ea7d70 100644
--- a/tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart
+++ b/tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart
@@ -205,6 +205,69 @@ main() {
function($T) {
return H.setRuntimeTypeInfo(new V.C(V.D$($T)), [$T]);
}"""),
+
+
+ const TestEntry.forMethod('generative_constructor(A#)', r"""
+class A {
+ var x;
+ A() : this.b(1);
+ A.b(this.x);
+}
+main() {
+ print(new A().x);
+}""", r"""
+function() {
+ return new V.A(1);
+}"""),
+
+
+const TestEntry.forMethod('function(Foo#make)', r"""
+class Foo {
+ factory Foo.make(x) {
+ print('Foo');
+ return new Foo.create(x);
+ }
+ var x;
+ Foo.create(this.x);
+}
+main() {
+ print(new Foo.make(5));
+}""", r"""
+function(x) {
+ P.print("Foo");
+ return V.Foo$create(x);
+}"""),
+const TestEntry(r"""
+class Foo {
+ factory Foo.make(x) = Foo.create;
+ var x;
+ Foo.create(this.x);
+}
+main() {
+ print(new Foo.make(5));
+}""", r"""
+function() {
+ P.print(V.Foo$create(5));
+ return null;
+}"""),
+const TestEntry(r"""
+class A {
+ factory A(x) = B<int>;
+ get typevar;
+}
+class B<T> implements A {
+ var x;
+ B(this.x);
+
+ get typevar => T;
+}
+main() {
+ new A(5).typevar;
+}""", r"""
+function() {
+ V.B$(5, P.$int).get$typevar();
+ return null;
+}"""),
];
void main() {
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698