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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/ElementBuilder.java

Issue 14856021: Report UNDEFINED_CONSTRUCTOR_IN_INITIALIZER and others (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/ElementBuilder.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/ElementBuilder.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/ElementBuilder.java
index 80ef5d094eb6b84f1fd9b17c77c25320cddf541d..0a1b06a1c7405c613b91ce5c92509fffa6450465 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/ElementBuilder.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/ElementBuilder.java
@@ -162,12 +162,7 @@ public class ElementBuilder extends RecursiveASTVisitor<Void> {
//
// Create the default constructor.
//
- ConstructorElementImpl constructor = new ConstructorElementImpl(null);
- constructor.setSynthetic(true);
- FunctionTypeImpl type = new FunctionTypeImpl(constructor);
- type.setReturnType(interfaceType);
- constructor.setType(type);
- constructors = new ConstructorElement[] {constructor};
+ constructors = createDefaulsConstructors(interfaceType);
}
element.setAbstract(node.getAbstractKeyword() != null);
element.setAccessors(holder.getAccessors());
@@ -198,6 +193,9 @@ public class ElementBuilder extends RecursiveASTVisitor<Void> {
interfaceType.setTypeArguments(createTypeVariableTypes(typeVariables));
element.setType(interfaceType);
+ // set default constructor
+ element.setConstructors(createDefaulsConstructors(interfaceType));
+
currentHolder.addType(element);
className.setElement(element);
return null;
@@ -701,6 +699,21 @@ public class ElementBuilder extends RecursiveASTVisitor<Void> {
return null;
}
+ /**
+ * Creates the {@link ConstructorElement}s array with the single default constructor element.
+ *
+ * @param interfaceType the interface type to create default constructor for
Brian Wilkerson 2013/05/17 14:10:25 Perhaps: the interface type for which to create a
scheglov 2013/05/17 16:09:46 Done.
+ * @return the {@link ConstructorElement}s array with the single default constructor element.
Brian Wilkerson 2013/05/17 14:10:25 nit: delete period
scheglov 2013/05/17 16:09:46 Done.
+ */
+ private ConstructorElement[] createDefaulsConstructors(InterfaceTypeImpl interfaceType) {
Brian Wilkerson 2013/05/17 14:10:25 "Defauls" --> "Default"
scheglov 2013/05/17 16:09:46 Done.
+ ConstructorElementImpl constructor = new ConstructorElementImpl(null);
+ constructor.setSynthetic(true);
+ FunctionTypeImpl type = new FunctionTypeImpl(constructor);
+ type.setReturnType(interfaceType);
+ constructor.setType(type);
+ return new ConstructorElement[] {constructor};
+ }
+
private Type[] createTypeVariableTypes(TypeVariableElement[] typeVariables) {
int typeVariableCount = typeVariables.length;
Type[] typeArguments = new Type[typeVariableCount];

Powered by Google App Engine
This is Rietveld 408576698