| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.dart.element.builder; | 5 library analyzer.src.dart.element.builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 node.element = null; | 883 node.element = null; |
| 884 Source exportedSource = node.selectedSource; | 884 Source exportedSource = node.selectedSource; |
| 885 int exportedTime = sourceModificationTimeMap[exportedSource] ?? -1; | 885 int exportedTime = sourceModificationTimeMap[exportedSource] ?? -1; |
| 886 // The exported source will be null if the URI in the export | 886 // The exported source will be null if the URI in the export |
| 887 // directive was invalid. | 887 // directive was invalid. |
| 888 LibraryElement exportedLibrary = exportLibraryMap[exportedSource]; | 888 LibraryElement exportedLibrary = exportLibraryMap[exportedSource]; |
| 889 if (exportedLibrary != null) { | 889 if (exportedLibrary != null) { |
| 890 ExportElementImpl exportElement = new ExportElementImpl(node.offset); | 890 ExportElementImpl exportElement = new ExportElementImpl(node.offset); |
| 891 exportElement.metadata = _getElementAnnotations(node.metadata); | 891 exportElement.metadata = _getElementAnnotations(node.metadata); |
| 892 StringLiteral uriLiteral = node.uri; | 892 StringLiteral uriLiteral = node.uri; |
| 893 if (uriLiteral != null) { | |
| 894 exportElement.uriOffset = uriLiteral.offset; | |
| 895 exportElement.uriEnd = uriLiteral.end; | |
| 896 } | |
| 897 exportElement.uri = node.selectedUriContent; | |
| 898 exportElement.combinators = _buildCombinators(node); | 893 exportElement.combinators = _buildCombinators(node); |
| 899 exportElement.exportedLibrary = exportedLibrary; | 894 exportElement.exportedLibrary = exportedLibrary; |
| 900 setElementDocumentationComment(exportElement, node); | 895 setElementDocumentationComment(exportElement, node); |
| 901 node.element = exportElement; | 896 node.element = exportElement; |
| 902 exports.add(exportElement); | 897 exports.add(exportElement); |
| 903 if (exportedTime >= 0 && | 898 if (exportedTime >= 0 && |
| 904 exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { | 899 exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { |
| 905 int offset = node.offset; | 900 int offset = node.offset; |
| 906 int length = node.length; | 901 int length = node.length; |
| 907 if (uriLiteral != null) { | 902 if (uriLiteral != null) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 928 // The imported source will be null if the URI in the import | 923 // The imported source will be null if the URI in the import |
| 929 // directive was invalid. | 924 // directive was invalid. |
| 930 LibraryElement importedLibrary = importLibraryMap[importedSource]; | 925 LibraryElement importedLibrary = importLibraryMap[importedSource]; |
| 931 if (importedLibrary != null) { | 926 if (importedLibrary != null) { |
| 932 if (importedLibrary.isDartCore) { | 927 if (importedLibrary.isDartCore) { |
| 933 explicitlyImportsCore = true; | 928 explicitlyImportsCore = true; |
| 934 } | 929 } |
| 935 ImportElementImpl importElement = new ImportElementImpl(node.offset); | 930 ImportElementImpl importElement = new ImportElementImpl(node.offset); |
| 936 importElement.metadata = _getElementAnnotations(node.metadata); | 931 importElement.metadata = _getElementAnnotations(node.metadata); |
| 937 StringLiteral uriLiteral = node.uri; | 932 StringLiteral uriLiteral = node.uri; |
| 938 if (uriLiteral != null) { | |
| 939 importElement.uriOffset = uriLiteral.offset; | |
| 940 importElement.uriEnd = uriLiteral.end; | |
| 941 } | |
| 942 importElement.uri = node.selectedUriContent; | |
| 943 importElement.deferred = node.deferredKeyword != null; | 933 importElement.deferred = node.deferredKeyword != null; |
| 944 importElement.combinators = _buildCombinators(node); | 934 importElement.combinators = _buildCombinators(node); |
| 945 importElement.importedLibrary = importedLibrary; | 935 importElement.importedLibrary = importedLibrary; |
| 946 setElementDocumentationComment(importElement, node); | 936 setElementDocumentationComment(importElement, node); |
| 947 SimpleIdentifier prefixNode = node.prefix; | 937 SimpleIdentifier prefixNode = node.prefix; |
| 948 if (prefixNode != null) { | 938 if (prefixNode != null) { |
| 949 importElement.prefixOffset = prefixNode.offset; | 939 importElement.prefixOffset = prefixNode.offset; |
| 950 String prefixName = prefixNode.name; | 940 String prefixName = prefixNode.name; |
| 951 PrefixElementImpl prefix = nameToPrefixMap[prefixName]; | 941 PrefixElementImpl prefix = nameToPrefixMap[prefixName]; |
| 952 if (prefix == null) { | 942 if (prefix == null) { |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 return null; | 1658 return null; |
| 1669 } | 1659 } |
| 1670 | 1660 |
| 1671 /** | 1661 /** |
| 1672 * Return the lexical identifiers associated with the given [identifiers]. | 1662 * Return the lexical identifiers associated with the given [identifiers]. |
| 1673 */ | 1663 */ |
| 1674 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { | 1664 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { |
| 1675 return identifiers.map((identifier) => identifier.name).toList(); | 1665 return identifiers.map((identifier) => identifier.name).toList(); |
| 1676 } | 1666 } |
| 1677 } | 1667 } |
| OLD | NEW |