| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 package com.google.dart.compiler.resolver; | |
| 6 | |
| 7 import com.google.common.collect.ImmutableList; | |
| 8 import com.google.common.collect.Lists; | |
| 9 import com.google.dart.compiler.ast.DartObsoleteMetadata; | |
| 10 import com.google.dart.compiler.ast.Modifiers; | |
| 11 import com.google.dart.compiler.common.SourceInfo; | |
| 12 import com.google.dart.compiler.type.Type; | |
| 13 | |
| 14 import java.util.List; | |
| 15 | |
| 16 class DuplicateElementImplementation implements DuplicateElement { | |
| 17 private final String name; | |
| 18 private final List<String> locations = Lists.newArrayList(); | |
| 19 | |
| 20 public DuplicateElementImplementation(Element oldElement, Element newElement)
{ | |
| 21 name = oldElement.getName(); | |
| 22 locations.addAll(getLocations(oldElement)); | |
| 23 locations.addAll(getLocations(newElement)); | |
| 24 } | |
| 25 | |
| 26 @Override | |
| 27 public String getOriginalName() { | |
| 28 return name; | |
| 29 } | |
| 30 | |
| 31 @Override | |
| 32 public String getName() { | |
| 33 return name; | |
| 34 } | |
| 35 | |
| 36 @Override | |
| 37 public ElementKind getKind() { | |
| 38 return ElementKind.DUPLICATE; | |
| 39 } | |
| 40 | |
| 41 @Override | |
| 42 public Type getType() { | |
| 43 return null; | |
| 44 } | |
| 45 | |
| 46 @Override | |
| 47 public boolean isDynamic() { | |
| 48 return false; | |
| 49 } | |
| 50 | |
| 51 @Override | |
| 52 public Modifiers getModifiers() { | |
| 53 return Modifiers.NONE; | |
| 54 } | |
| 55 | |
| 56 @Override | |
| 57 public DartObsoleteMetadata getMetadata() { | |
| 58 return null; | |
| 59 } | |
| 60 | |
| 61 @Override | |
| 62 public EnclosingElement getEnclosingElement() { | |
| 63 return null; | |
| 64 } | |
| 65 | |
| 66 @Override | |
| 67 public SourceInfo getNameLocation() { | |
| 68 return null; | |
| 69 } | |
| 70 | |
| 71 @Override | |
| 72 public SourceInfo getSourceInfo() { | |
| 73 return null; | |
| 74 } | |
| 75 | |
| 76 @Override | |
| 77 public List<String> getLocations() { | |
| 78 return locations; | |
| 79 } | |
| 80 | |
| 81 private static List<String> getLocations(Element element) { | |
| 82 if (element instanceof DuplicateElement) { | |
| 83 return ((DuplicateElement) element).getLocations(); | |
| 84 } else { | |
| 85 return ImmutableList.of(Elements.getLibraryUnitLocation(element)); | |
| 86 } | |
| 87 } | |
| 88 } | |
| OLD | NEW |