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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java

Issue 8662019: Support for parsing returning qualified type. Issue 513. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak write spaces Created 9 years, 1 month 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: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
index 8fdd6700d3f120413f7cde82b6319f9615814350..f24dc9cf407c961ab807372d83e3d6ebe03173b3 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
@@ -4,6 +4,7 @@
package com.google.dart.compiler.parser;
+import com.google.common.base.Joiner;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.DartSourceTest;
@@ -19,9 +20,11 @@ import com.google.dart.compiler.ast.DartIntegerLiteral;
import com.google.dart.compiler.ast.DartMapLiteral;
import com.google.dart.compiler.ast.DartMethodDefinition;
import com.google.dart.compiler.ast.DartNode;
+import com.google.dart.compiler.ast.DartPropertyAccess;
import com.google.dart.compiler.ast.DartStatement;
import com.google.dart.compiler.ast.DartStringLiteral;
import com.google.dart.compiler.ast.DartTryStatement;
+import com.google.dart.compiler.ast.DartTypeNode;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.DartVariableStatement;
@@ -29,6 +32,30 @@ import java.util.List;
public class SyntaxTest extends AbstractParserTest {
+ /**
+ * There was bug when "identA.identB" always considered as constructor declaration. But it can be
+ * constructor only if "identA" is name of enclosing class.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=513
+ */
+ public void testQualifiedReturnType() {
+ DartUnit unit = parseUnit("QualifiedReturnTypeB.dart");
+ assertEquals(
+ Joiner.on("\n").join(
+ "// unit QualifiedReturnTypeB.dart",
+ "class A {",
+ "",
+ " pref.A foo() {",
+ " return new pref.A();",
+ " }",
+ "}"),
+ unit.toSource().trim());
+ DartClass classB = (DartClass) unit.getTopLevelNodes().get(0);
+ DartMethodDefinition fooMethod = (DartMethodDefinition) classB.getMembers().get(0);
+ DartTypeNode fooReturnType = fooMethod.getFunction().getReturnTypeNode();
+ assertEquals(true, fooReturnType.getIdentifier() instanceof DartPropertyAccess);
+ }
+
@Override
public void testStrings() {
DartUnit unit = parseUnit("Strings.dart");

Powered by Google App Engine
This is Rietveld 408576698