OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 * A table mapping name of the library to the export directive which export th
is library. | 328 * A table mapping name of the library to the export directive which export th
is library. |
329 */ | 329 */ |
330 private HashMap<String, LibraryElement> nameToExportElement = new HashMap<Stri
ng, LibraryElement>(); | 330 private HashMap<String, LibraryElement> nameToExportElement = new HashMap<Stri
ng, LibraryElement>(); |
331 | 331 |
332 /** | 332 /** |
333 * A table mapping name of the library to the import directive which import th
is library. | 333 * A table mapping name of the library to the import directive which import th
is library. |
334 */ | 334 */ |
335 private HashMap<String, LibraryElement> nameToImportElement = new HashMap<Stri
ng, LibraryElement>(); | 335 private HashMap<String, LibraryElement> nameToImportElement = new HashMap<Stri
ng, LibraryElement>(); |
336 | 336 |
337 /** | 337 /** |
338 * A table mapping names to the export elements exported them. | 338 * A table mapping names to the exported elements. |
339 */ | 339 */ |
340 private HashMap<String, ExportElement> exportedNames = new HashMap<String, Exp
ortElement>(); | 340 private HashMap<String, Element> exportedElements = new HashMap<String, Elemen
t>(); |
341 | 341 |
342 /** | 342 /** |
343 * A set of the names of the variable initializers we are visiting now. | 343 * A set of the names of the variable initializers we are visiting now. |
344 */ | 344 */ |
345 private HashSet<String> namesForReferenceToDeclaredVariableInInitializer = new
HashSet<String>(); | 345 private HashSet<String> namesForReferenceToDeclaredVariableInInitializer = new
HashSet<String>(); |
346 | 346 |
347 /** | 347 /** |
348 * A list of types used by the {@link CompileTimeErrorCode#EXTENDS_DISALLOWED_
CLASS} and | 348 * A list of types used by the {@link CompileTimeErrorCode#EXTENDS_DISALLOWED_
CLASS} and |
349 * {@link CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS} error codes. | 349 * {@link CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS} error codes. |
350 */ | 350 */ |
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 return false; | 1723 return false; |
1724 } | 1724 } |
1725 ExportElement exportElement = (ExportElement) node.getElement(); | 1725 ExportElement exportElement = (ExportElement) node.getElement(); |
1726 // prepare exported library | 1726 // prepare exported library |
1727 LibraryElement exportedLibrary = exportElement.getExportedLibrary(); | 1727 LibraryElement exportedLibrary = exportElement.getExportedLibrary(); |
1728 if (exportedLibrary == null) { | 1728 if (exportedLibrary == null) { |
1729 return false; | 1729 return false; |
1730 } | 1730 } |
1731 // check exported names | 1731 // check exported names |
1732 Namespace namespace = new NamespaceBuilder().createExportNamespace(exportEle
ment); | 1732 Namespace namespace = new NamespaceBuilder().createExportNamespace(exportEle
ment); |
1733 Set<String> newNames = namespace.getDefinedNames().keySet(); | 1733 Map<String, Element> definedNames = namespace.getDefinedNames(); |
1734 for (String name : newNames) { | 1734 for (Entry<String, Element> definedEntry : definedNames.entrySet()) { |
1735 ExportElement prevElement = exportedNames.get(name); | 1735 String name = definedEntry.getKey(); |
1736 if (prevElement != null && prevElement != exportElement) { | 1736 Element element = definedEntry.getValue(); |
| 1737 Element prevElement = exportedElements.get(name); |
| 1738 if (element != null && prevElement != null && !prevElement.equals(element)
) { |
1737 errorReporter.reportError( | 1739 errorReporter.reportError( |
1738 CompileTimeErrorCode.AMBIGUOUS_EXPORT, | 1740 CompileTimeErrorCode.AMBIGUOUS_EXPORT, |
1739 node, | 1741 node, |
1740 name, | 1742 name, |
1741 prevElement.getExportedLibrary().getDefiningCompilationUnit().getDis
playName(), | 1743 prevElement.getLibrary().getDefiningCompilationUnit().getDisplayName
(), |
1742 exportedLibrary.getDefiningCompilationUnit().getDisplayName()); | 1744 element.getLibrary().getDefiningCompilationUnit().getDisplayName()); |
1743 return true; | 1745 return true; |
1744 } else { | 1746 } else { |
1745 exportedNames.put(name, exportElement); | 1747 exportedElements.put(name, element); |
1746 } | 1748 } |
1747 } | 1749 } |
1748 return false; | 1750 return false; |
1749 } | 1751 } |
1750 | 1752 |
1751 /** | 1753 /** |
1752 * This verifies that the passed argument definition test identifier is a para
meter. | 1754 * This verifies that the passed argument definition test identifier is a para
meter. |
1753 * | 1755 * |
1754 * @param node the {@link ArgumentDefinitionTest} to evaluate | 1756 * @param node the {@link ArgumentDefinitionTest} to evaluate |
1755 * @return {@code true} if and only if an error code is generated on the passe
d node | 1757 * @return {@code true} if and only if an error code is generated on the passe
d node |
(...skipping 3643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5399 if (superClassElt != null) { | 5401 if (superClassElt != null) { |
5400 return memberHasConcreteMethodImplementationInSuperclassChain( | 5402 return memberHasConcreteMethodImplementationInSuperclassChain( |
5401 superClassElt, | 5403 superClassElt, |
5402 methodName, | 5404 methodName, |
5403 superclassChain); | 5405 superclassChain); |
5404 } | 5406 } |
5405 } | 5407 } |
5406 return false; | 5408 return false; |
5407 } | 5409 } |
5408 } | 5410 } |
OLD | NEW |