| Index: compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java b/compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java
|
| index a2e8ac58c4ce5d7d3b63be6c2f84a36bf03d1ced..04c0458070c83cf8a766a186b116d951f5386b3f 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java
|
| @@ -1,7 +1,6 @@
|
| // Copyright (c) 2011, 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.
|
| -
|
| package com.google.dart.compiler.backend.js;
|
|
|
| import java.io.IOException;
|
| @@ -11,76 +10,96 @@ import java.io.IOException;
|
| */
|
| public class RttTest extends SnippetTestCase {
|
| private static final String DELIMETERS = "[\\n,;]";
|
| - // private static final String FIELD_DELIMETERS = "[\\n,;.]";
|
| +
|
| + /**
|
| + * We should be able to generate RTT information for nested function parameters.
|
| + * <p>
|
| + * http://code.google.com/p/dart/issues/detail?id=962
|
| + */
|
| + public void test_nestedFunctionParameters() throws Exception {
|
| + String js =
|
| + compileSingleUnitSource(
|
| + makeCode(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "class Main {",
|
| + " foo() {",
|
| + " f1(f2(f3())) {}",
|
| + " }",
|
| + "}",
|
| + ""),
|
| + "Main");
|
| + {
|
| + String f3 = "RTT.createFunction(null, RTT.dynamicType.$lookupRTT())";
|
| + String f2 = "RTT.createFunction([" + f3 + "], RTT.dynamicType.$lookupRTT())";
|
| + String f1 = "RTT.createFunction([" + f2 + "], RTT.dynamicType.$lookupRTT())";
|
| + assertTrue(js.contains(f1 + ";"));
|
| + }
|
| + }
|
|
|
| public void testRuntimeTypes() throws IOException {
|
| String js = compileSingleUnit(getName());
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_B1", DELIMETERS, 1);
|
| assertEquals("var _marker_B1 = $intern(Test_app4a54ba$B$Dart.B$$Factory())", init);
|
| -
|
| String expr = findMarkerAtOccurrence(js, "_marker_B1", "[\\n;]", 2);
|
| - assertEquals("a = !!(tmp$0 = _marker_B1 , tmp$0 != null && tmp$0.$implements$Test_app4a54ba$B$Dart)", expr);
|
| + assertEquals(
|
| + "a = !!(tmp$0 = _marker_B1 , tmp$0 != null && tmp$0.$implements$Test_app4a54ba$B$Dart)",
|
| + expr);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_B2", DELIMETERS, 1);
|
| assertEquals("var _marker_B2 = Test_app4a54ba$B$Dart.B$$Factory()", init);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_C1", DELIMETERS, 1);
|
| assertEquals("var _marker_C1 = $intern("
|
| + "Test_app4a54ba$C$Dart.C$$Factory("
|
| - + "Test_app4a54ba$C$Dart.$lookupRTT())", init);
|
| -
|
| + + "Test_app4a54ba$C$Dart.$lookupRTT())", init);
|
| String expr = findMarkerAtOccurrence(js, "_marker_C1", "[\\n;]", 2);
|
| - assertEquals("a = !!(tmp$1 = _marker_C1 , tmp$1 != null && tmp$1.$implements$Test_app4a54ba$C$Dart)", expr);
|
| + assertEquals(
|
| + "a = !!(tmp$1 = _marker_C1 , tmp$1 != null && tmp$1.$implements$Test_app4a54ba$C$Dart)",
|
| + expr);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_C2", DELIMETERS, 1);
|
| assertEquals("var _marker_C2 = $intern(Test_app4a54ba$C$Dart.C$$Factory("
|
| + "Test_app4a54ba$C$Dart.$lookupRTT([String$Dart.$lookupRTT()]))", init);
|
| -
|
| String expr = findMarkerAtOccurrence(js, "_marker_C2", DELIMETERS, 2);
|
| assertEquals("a = Test_app4a54ba$C$Dart.$lookupRTT([String$Dart.$lookupRTT()])"
|
| + ".implementedBy(_marker_C2)", expr);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_C3", DELIMETERS, 1);
|
| assertEquals("var _marker_C3 = "
|
| + "Test_app4a54ba$C$Dart.C$$Factory("
|
| - + "Test_app4a54ba$C$Dart.$lookupRTT())", init);
|
| + + "Test_app4a54ba$C$Dart.$lookupRTT())", init);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_C4", DELIMETERS, 1);
|
| assertEquals("var _marker_C4 = "
|
| + "Test_app4a54ba$C$Dart.C$$Factory("
|
| - + "Test_app4a54ba$C$Dart.$lookupRTT([Object.$lookupRTT()]))", init);
|
| -
|
| + + "Test_app4a54ba$C$Dart.$lookupRTT([Object.$lookupRTT()]))", init);
|
| String expr = findMarkerAtOccurrence(js, "_marker_C4", DELIMETERS, 2);
|
| assertEquals("a = Test_app4a54ba$C$Dart.$lookupRTT([Object.$lookupRTT()])"
|
| + ".implementedBy(_marker_C4)", expr);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_D1", DELIMETERS, 1);
|
| assertEquals("var _marker_D1 = Test_app4a54ba$D$Dart.D$$Factory(null)", init);
|
| -
|
| String expr = findMarkerAtOccurrence(js, "_marker_D1", "[\\n;]", 2);
|
| - assertEquals("a = !!(tmp$2 = _marker_D1 , tmp$2 != null && tmp$2.$implements$Test_app4a54ba$D$Dart)", expr);
|
| + assertEquals(
|
| + "a = !!(tmp$2 = _marker_D1 , tmp$2 != null && tmp$2.$implements$Test_app4a54ba$D$Dart)",
|
| + expr);
|
| }
|
| -
|
| {
|
| String init = findMarkerAtOccurrence(js, "_marker_D2", DELIMETERS, 1);
|
| - assertEquals("var _marker_D2 = Test_app4a54ba$D$Dart.D$$Factory([String$Dart.$lookupRTT()])", init);
|
| -
|
| + assertEquals(
|
| + "var _marker_D2 = Test_app4a54ba$D$Dart.D$$Factory([String$Dart.$lookupRTT()])",
|
| + init);
|
| String expr = findMarkerAtOccurrence(js, "_marker_D2", "[\\n;]", 2);
|
| - assertEquals("a = Test_app4a54ba$D$Dart.$lookupRTT([String$Dart.$lookupRTT()]).implementedBy(_marker_D2)", expr);
|
| - }
|
| + assertEquals(
|
| + "a = Test_app4a54ba$D$Dart.$lookupRTT([String$Dart.$lookupRTT()]).implementedBy(_marker_D2)",
|
| + expr);
|
| + }
|
| }
|
| }
|
|
|