| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..047f7461ac5818ece2d44e5e7459f11e43d96fe5
|
| --- /dev/null
|
| +++ b/tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart
|
| @@ -0,0 +1,114 @@
|
| +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +// VMOptions=-DUSE_CPS_IR=true
|
| +
|
| +// Tests of interceptors.
|
| +
|
| +library constructor_test;
|
| +
|
| +import 'js_backend_cps_ir.dart';
|
| +
|
| +const List<TestEntry> tests = const [
|
| + const TestEntry.forMethod('generative_constructor(Sub#)', """
|
| +class Base {
|
| + var x;
|
| + Base(this.x);
|
| +}
|
| +class Sub extends Base {
|
| + var y;
|
| + Sub(x, this.y) : super(x);
|
| +}
|
| +main() {
|
| + print(new Sub(1, 2).x);
|
| +}""",
|
| +r"""
|
| +function(x, y) {
|
| + return new V.Sub(y, x);
|
| +}"""),
|
| +
|
| + const TestEntry.forMethod('generative_constructor_body(Sub#)', """
|
| +class Base {
|
| + var x;
|
| + Base(this.x);
|
| +}
|
| +class Sub extends Base {
|
| + var y;
|
| + Sub(x, this.y) : super(x) {
|
| + print(x);
|
| + }
|
| +}
|
| +main() {
|
| + print(new Sub(1, 2).x);
|
| +}""",
|
| +r"""
|
| +function(x, y) {
|
| + P.print(x);
|
| + return null;
|
| +}"""),
|
| +
|
| + const TestEntry.forMethod('generative_constructor(Sub#)', """
|
| +class Base0 {
|
| + Base0() {
|
| + print('Base0');
|
| + }
|
| +}
|
| +class Base extends Base0 {
|
| + var x;
|
| + Base(this.x);
|
| +}
|
| +class Sub extends Base {
|
| + var y;
|
| + Sub(x, this.y) : super(x) {
|
| + print(x);
|
| + }
|
| +}
|
| +main() {
|
| + print(new Sub(1, 2).x);
|
| +}""",
|
| +r"""
|
| +function(x, y) {
|
| + var v0;
|
| + v0 = new V.Sub(y, x);
|
| + v0.Base0$0();
|
| + v0.Sub$2(x, y);
|
| + return v0;
|
| +}"""),
|
| +
|
| + const TestEntry.forMethod('generative_constructor(Sub#)', """
|
| +class Base0 {
|
| + Base0() {
|
| + print('Base0');
|
| + }
|
| +}
|
| +class Base extends Base0 {
|
| + var x;
|
| + Base(x1) : x = (() => ++x1) {
|
| + print(x1); // use boxed x1
|
| + }
|
| +}
|
| +class Sub extends Base {
|
| + var y;
|
| + Sub(x, this.y) : super(x) {
|
| + print(x);
|
| + }
|
| +}
|
| +main() {
|
| + print(new Sub(1, 2).x);
|
| +}""",
|
| +r"""
|
| +function(x, y) {
|
| + var box_0, v0;
|
| + box_0 = {};
|
| + box_0.x1_0 = x;
|
| + v0 = new V.Sub(y, new V.Base_closure(box_0));
|
| + v0.Base0$0();
|
| + v0.Base$1(box_0);
|
| + v0.Sub$2(x, y);
|
| + return v0;
|
| +}"""),
|
| +];
|
| +
|
| +void main() {
|
| + runTests(tests);
|
| +}
|
|
|