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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java

Issue 8747016: Fix for resolving interface constructors in factory, issue 521. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for error messages. 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/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java b/compiler/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java
new file mode 100644
index 0000000000000000000000000000000000000000..ee0d77581c045eeca3a0027da754490091d324cb
--- /dev/null
+++ b/compiler/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java
@@ -0,0 +1,129 @@
+// 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.resolver;
+
+import com.google.dart.compiler.ast.DartLabel;
+import com.google.dart.compiler.ast.DartMethodDefinition;
+import com.google.dart.compiler.ast.DartNode;
+import com.google.dart.compiler.ast.Modifiers;
+import com.google.dart.compiler.type.DynamicType;
+import com.google.dart.compiler.type.FunctionType;
+import com.google.dart.compiler.type.Type;
+import com.google.dart.compiler.type.TypeVariable;
+import com.google.dart.compiler.type.Types;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * {@link ConstructorElement} for implicit default constructor.
+ */
+public class SyntheticDefaultConstructorElement implements ConstructorElement {
+ private final DartMethodDefinition method;
+ private final ClassElement enclosingClass;
+ private final FunctionType functionType;
+
+ public SyntheticDefaultConstructorElement(DartMethodDefinition method,
+ ClassElement enclosingClass,
+ CoreTypeProvider typeProvider) {
+ this.method = method;
+ this.enclosingClass = enclosingClass;
+ this.functionType =
+ Types.makeFunctionType(
+ null,
+ typeProvider.getFunctionType().getElement(),
+ getParameters(),
+ typeProvider.getDynamicType(),
+ Collections.<TypeVariable>emptyList());
+ }
+
+ @Override
+ public String getOriginalSymbolName() {
+ return getName();
+ }
+
+ @Override
+ public DartNode getNode() {
+ return method;
+ }
+
+ @Override
+ public void setNode(DartLabel node) {
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return false;
+ }
+
+ @Override
+ public Type getType() {
+ return functionType;
+ }
+
+ @Override
+ public String getName() {
+ return "";
+ }
+
+ @Override
+ public Modifiers getModifiers() {
+ return Modifiers.NONE;
+ }
+
+ @Override
+ public ElementKind getKind() {
+ return ElementKind.CONSTRUCTOR;
+ }
+
+ @Override
+ public EnclosingElement getEnclosingElement() {
+ return enclosingClass;
+ }
+
+ @Override
+ public boolean isStatic() {
+ return false;
+ }
+
+ @Override
+ public boolean isConstructor() {
+ return true;
+ }
+
+ @Override
+ public Type getReturnType() {
+ return functionType.getReturnType();
+ }
+
+ @Override
+ public List<VariableElement> getParameters() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public FunctionType getFunctionType() {
+ return functionType;
+ }
+
+ @Override
+ public ClassElement getConstructorType() {
+ return enclosingClass;
+ }
+
+ @Override
+ public boolean isInterface() {
+ return false;
+ }
+
+ @Override
+ public Iterable<Element> getMembers() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Element lookupLocalElement(String name) {
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698