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

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

Issue 10979013: Issue 5292. Unreferenced imported identifiers should not be an error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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: compiler/java/com/google/dart/compiler/resolver/DuplicateElementImplementation.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/DuplicateElementImplementation.java b/compiler/java/com/google/dart/compiler/resolver/DuplicateElementImplementation.java
new file mode 100644
index 0000000000000000000000000000000000000000..3faaff36b5b3b84ede277fd7d3140fc04ef85b5e
--- /dev/null
+++ b/compiler/java/com/google/dart/compiler/resolver/DuplicateElementImplementation.java
@@ -0,0 +1,88 @@
+// Copyright (c) 2012, 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.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.dart.compiler.ast.DartObsoleteMetadata;
+import com.google.dart.compiler.ast.Modifiers;
+import com.google.dart.compiler.common.SourceInfo;
+import com.google.dart.compiler.type.Type;
+
+import java.util.List;
+
+class DuplicateElementImplementation implements DuplicateElement {
+ private final String name;
+ private final List<String> locations = Lists.newArrayList();
+
+ public DuplicateElementImplementation(Element oldElement, Element newElement) {
+ name = oldElement.getName();
+ locations.addAll(getLocations(oldElement));
+ locations.addAll(getLocations(newElement));
+ }
+
+ @Override
+ public String getOriginalName() {
+ return name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public ElementKind getKind() {
+ return ElementKind.DUPLICATE;
+ }
+
+ @Override
+ public Type getType() {
+ return null;
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return false;
+ }
+
+ @Override
+ public Modifiers getModifiers() {
+ return Modifiers.NONE;
+ }
+
+ @Override
+ public DartObsoleteMetadata getMetadata() {
+ return null;
+ }
+
+ @Override
+ public EnclosingElement getEnclosingElement() {
+ return null;
+ }
+
+ @Override
+ public SourceInfo getNameLocation() {
+ return null;
+ }
+
+ @Override
+ public SourceInfo getSourceInfo() {
+ return null;
+ }
+
+ @Override
+ public List<String> getLocations() {
+ return locations;
+ }
+
+ private static List<String> getLocations(Element element) {
+ if (element instanceof DuplicateElement) {
+ return ((DuplicateElement) element).getLocations();
+ } else {
+ return ImmutableList.of(Elements.getLibraryUnitLocation(element));
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698