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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 11665018: Fix for renaming named constructor reference in 'super' invocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index 886e205061d4a79a1771409b1c39eb3b09e284b4..adfb755be4b4a7e47a7fe66efaa76e8276ae462c 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -31,12 +31,15 @@ import com.google.dart.compiler.ast.DartMethodInvocation;
import com.google.dart.compiler.ast.DartNewExpression;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartPropertyAccess;
+import com.google.dart.compiler.ast.DartSuperConstructorInvocation;
import com.google.dart.compiler.ast.DartTypeNode;
import com.google.dart.compiler.ast.DartUnaryExpression;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
import com.google.dart.compiler.parser.ParserErrorCode;
import com.google.dart.compiler.resolver.ClassElement;
+import com.google.dart.compiler.resolver.ConstructorElement;
+import com.google.dart.compiler.resolver.ConstructorNodeElement;
import com.google.dart.compiler.resolver.Element;
import com.google.dart.compiler.resolver.ElementKind;
import com.google.dart.compiler.resolver.EnclosingElement;
@@ -6133,4 +6136,24 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertEquals(3, error.getColumnNumber());
}
}
+
+ /**
+ * Test that we set {@link ConstructorElement} for {@link DartSuperConstructorInvocation}.
+ */
+ public void test_superConstructorInvocation_resolveElement() throws Exception {
+ analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "abstract class A {",
+ " A.named() {}",
+ "}",
+ "abstract class B extends A {",
+ " B() : super.named();",
+ "}",
+ "");
+ DartIdentifier nameInInvocation = findNode(DartIdentifier.class, "named();");
+ DartSuperConstructorInvocation invocation = (DartSuperConstructorInvocation) nameInInvocation.getParent();
+ ConstructorNodeElement expectedElement = invocation.getElement();
+ assertNotNull(expectedElement);
+ assertSame(nameInInvocation.getElement(), expectedElement);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698