Chromium Code Reviews| Index: editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/SemanticTest.java |
| diff --git a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/SemanticTest.java b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/SemanticTest.java |
| index f4b9ae885943d2a576f95147d72b36046badb335..520451a4e9d4e846493874f8ef4a2b043200e710 100644 |
| --- a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/SemanticTest.java |
| +++ b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/SemanticTest.java |
| @@ -49,8 +49,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| assertEquals( |
| toString( |
| "class Test {", |
| - " Test(int i, double f) {", |
| - " }", |
| + " Test(int i, double f);", |
| " static main() {", |
| " int myValue = 5;", |
| " Test v = new Test_0(1, 2.3, myValue);", |
| @@ -279,8 +278,6 @@ public class SemanticTest extends AbstractSemanticTest { |
| " }", |
| "}", |
| "class A_B {", |
| - " A_B() {", |
| - " }", |
| "}"), |
| getFormattedSource(unit)); |
| } |
| @@ -441,7 +438,6 @@ public class SemanticTest extends AbstractSemanticTest { |
| "class A_B {", |
| "}", |
| "class A_B_0 extends A_B {", |
| - " A_B_0() : super();", |
| "}"), |
| getFormattedSource(unit)); |
| } |
| @@ -566,21 +562,12 @@ public class SemanticTest extends AbstractSemanticTest { |
| toString( |
| "class Test {", |
| " Test() {", |
| - " _jtd_constructor_0_impl();", |
| - " }", |
| - " _jtd_constructor_0_impl() {", |
| " print(0);", |
| " }", |
| " Test.forInt(int p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(int p) {", |
| " print(1);", |
| " }", |
| " Test.forDouble(double p) {", |
| - " _jtd_constructor_2_impl(p);", |
| - " }", |
| - " _jtd_constructor_2_impl(double p) {", |
| " print(2);", |
| " }", |
| " static void main() {", |
| @@ -623,21 +610,12 @@ public class SemanticTest extends AbstractSemanticTest { |
| toString( |
| "class Test {", |
| " Test() {", |
| - " _jtd_constructor_0_impl();", |
| - " }", |
| - " _jtd_constructor_0_impl() {", |
| " print(0);", |
| " }", |
| " Test.con1(int p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(int p) {", |
| " print(1);", |
| " }", |
| " Test.con2(double p) {", |
| - " _jtd_constructor_2_impl(p);", |
| - " }", |
| - " _jtd_constructor_2_impl(double p) {", |
| " print(2);", |
| " }", |
| " static void main() {", |
| @@ -721,16 +699,8 @@ public class SemanticTest extends AbstractSemanticTest { |
| " ", |
| " /// The position in the enum declaration.", |
| " final int ordinal;", |
| - " Test.con1(this.name, this.ordinal) {", |
| - " _jtd_constructor_0_impl();", |
| - " }", |
| - " _jtd_constructor_0_impl() {", |
| - " }", |
| - " Test.con2(this.name, this.ordinal, int p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(int p) {", |
| - " }", |
| + " Test.con1(this.name, this.ordinal);", |
| + " Test.con2(this.name, this.ordinal, int p);", |
| " void foo() {", |
| " print(1);", |
| " }", |
| @@ -776,8 +746,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| " ", |
| " /// The position in the enum declaration.", |
| " final int ordinal;", |
| - " MyEnum(this.name, this.ordinal) {", |
| - " }", |
| + " MyEnum(this.name, this.ordinal);", |
| " int compareTo(MyEnum other) => ordinal - other.ordinal;", |
| " int hashCode => ordinal;", |
| " String toString() => name;", |
| @@ -810,8 +779,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| " ", |
| " /// The position in the enum declaration.", |
| " final int ordinal;", |
| - " Test(this.name, this.ordinal) {", |
| - " }", |
| + " Test(this.name, this.ordinal);", |
| " int compareTo(Test other) => ordinal - other.ordinal;", |
| " int hashCode => ordinal;", |
| " String toString() => name;", |
| @@ -819,6 +787,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| getFormattedSource(unit)); |
| } |
| + // TODO(scheglov) |
|
Brian Wilkerson
2013/07/02 14:21:46
Is there still something to be done here?
|
| public void test_enum_twoConstructors() throws Exception { |
| setFileLines( |
| "test/Test.java", |
| @@ -831,6 +800,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| " this(0);", |
| " }", |
| " private Test(int p) {", |
| + " print(p);", |
| " }", |
| "}")); |
| Context context = new Context(); |
| @@ -850,16 +820,9 @@ public class SemanticTest extends AbstractSemanticTest { |
| " ", |
| " /// The position in the enum declaration.", |
| " final int ordinal;", |
| - " Test.con1(this.name, this.ordinal) {", |
| - " _jtd_constructor_0_impl();", |
| - " }", |
| - " _jtd_constructor_0_impl() {", |
| - " _jtd_constructor_1_impl(0);", |
| - " }", |
| + " Test.con1(String name, int ordinal) : this.withPriority(name, ordinal, 0);", |
| " Test.withPriority(this.name, this.ordinal, int p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(int p) {", |
| + " print(p);", |
| " }", |
| " int compareTo(Test other) => ordinal - other.ordinal;", |
| " int hashCode => ordinal;", |
| @@ -1692,22 +1655,11 @@ public class SemanticTest extends AbstractSemanticTest { |
| context.addSourceFolder(tmpFolder); |
| context.addSourceFiles(tmpFolder); |
| CompilationUnit unit = context.translate(); |
| - assertEquals( |
| - toString( |
| - "class Test {", |
| - " Test() {", |
| - " _jtd_constructor_0_impl();", |
| - " }", |
| - " _jtd_constructor_0_impl() {", |
| - " _jtd_constructor_1_impl(42);", |
| - " }", |
| - " Test.con1(int p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(int p) {", |
| - " }", |
| - "}"), |
| - getFormattedSource(unit)); |
| + assertEquals(toString(// |
| + "class Test {", |
| + " Test() : this.con1(42);", |
| + " Test.con1(int p);", |
| + "}"), getFormattedSource(unit)); |
| } |
| public void test_statementSwitch_enum() throws Exception { |
| @@ -1754,8 +1706,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| " ", |
| " /// The position in the enum declaration.", |
| " final int ordinal;", |
| - " A(this.name, this.ordinal) {", |
| - " }", |
| + " A(this.name, this.ordinal);", |
| " int compareTo(A other) => ordinal - other.ordinal;", |
| " int hashCode => ordinal;", |
| " String toString() => name;", |
| @@ -1805,16 +1756,8 @@ public class SemanticTest extends AbstractSemanticTest { |
| assertEquals( |
| toString( |
| "class A {", |
| - " A.con1(int p) {", |
| - " _jtd_constructor_0_impl(p);", |
| - " }", |
| - " _jtd_constructor_0_impl(int p) {", |
| - " }", |
| - " A.con2(double p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(double p) {", |
| - " }", |
| + " A.con1(int p);", |
| + " A.con2(double p);", |
| "}", |
| "class B extends A {", |
| " B() : super.con2(1.0) {", |
| @@ -1920,8 +1863,7 @@ public class SemanticTest extends AbstractSemanticTest { |
| assertEquals( |
| toString( |
| "class Super {", |
| - " Super(int p) {", |
| - " }", |
| + " Super(int p);", |
| "}", |
| "class Test {", |
| " Object foo;", |
| @@ -1959,17 +1901,11 @@ public class SemanticTest extends AbstractSemanticTest { |
| " Object foo;", |
| " Object bar;", |
| " Test() {", |
| - " _jtd_constructor_0_impl();", |
| - " }", |
| - " _jtd_constructor_0_impl() {", |
| " this.foo = this;", |
| " this.bar = this;", |
| " print(1);", |
| " }", |
| " Test.con1(int p) {", |
| - " _jtd_constructor_1_impl(p);", |
| - " }", |
| - " _jtd_constructor_1_impl(int p) {", |
| " this.foo = this;", |
| " this.bar = this;", |
| " print(2);", |
| @@ -2127,17 +2063,8 @@ public class SemanticTest extends AbstractSemanticTest { |
| assertEquals( |
| toString( |
| "class Test {", |
| - " Test.con1(String o, List<int> args) {", |
| - " _jtd_constructor_0_impl(o, args);", |
| - " }", |
| - " _jtd_constructor_0_impl(String o, List<int> args) {", |
| - " }", |
| - " Test.con2(List<int> args) {", |
| - " _jtd_constructor_1_impl(args);", |
| - " }", |
| - " _jtd_constructor_1_impl(List<int> args) {", |
| - " _jtd_constructor_0_impl(null, args);", |
| - " }", |
| + " Test.con1(String o, List<int> args);", |
| + " Test.con2(List<int> args) : this.con1(null, args);", |
| " void main(List<int> args) {", |
| " new Test.con1(null, [1, 2, 3]);", |
| " new Test.con2([1, 2, 3]);", |
| @@ -2174,12 +2101,10 @@ public class SemanticTest extends AbstractSemanticTest { |
| "class Test {", |
| "}", |
| "class Test_A {", |
| - " Test_A(List<int> args) {", |
| - " }", |
| + " Test_A(List<int> args);", |
| "}", |
| "class Test_B extends Test_A {", |
| - " Test_B(List<int> args) : super(args) {", |
| - " }", |
| + " Test_B(List<int> args) : super(args);", |
| "}"), |
| getFormattedSource(unit)); |
| } |