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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java

Issue 41243002: Issue 14328. Propagate type arguments into super type when looking up super constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Try to upload. Created 7 years, 2 months 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
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
index 0609419200e92cf0b35da7c9306d929d57072fea..d0066ad58f094663aa8a9b5a2334ca636f859877 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
@@ -1326,30 +1326,28 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
// TODO(brianwilkerson) Report this error.
return null;
}
- ClassElement superclass = getSuperclass(enclosingClass);
- if (superclass == null) {
+ InterfaceType superType = enclosingClass.getSupertype();
+ if (superType == null) {
// TODO(brianwilkerson) Report this error.
return null;
}
SimpleIdentifier name = node.getConstructorName();
- ConstructorElement element;
- if (name == null) {
- element = superclass.getUnnamedConstructor();
- } else {
- element = superclass.getNamedConstructor(name.getName());
- }
+ String superName = name != null ? name.getName() : null;
+ ConstructorElement element = superType.lookUpConstructor(
+ superName,
+ resolver.getDefiningLibrary());
if (element == null) {
if (name != null) {
resolver.reportError(
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER,
node,
- superclass.getName(),
+ superType.getDisplayName(),
name);
} else {
resolver.reportError(
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT,
node,
- superclass.getName());
+ superType.getDisplayName());
}
return null;
} else {
@@ -1738,20 +1736,6 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
}
/**
- * Return the element representing the superclass of the given class.
- *
- * @param targetClass the class whose superclass is to be returned
- * @return the element representing the superclass of the given class
- */
- private ClassElement getSuperclass(ClassElement targetClass) {
- InterfaceType superType = targetClass.getSupertype();
- if (superType == null) {
- return null;
- }
- return superType.getElement();
- }
-
- /**
* Return {@code true} if the given type represents an object that could be invoked using the call
* operator '()'.
*
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698