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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/builder.dart

Issue 2991453002: Restore UriReferencedElement and its uri/uriOffset/uriEnd properties. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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
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;
893 exportElement.combinators = _buildCombinators(node); 898 exportElement.combinators = _buildCombinators(node);
894 exportElement.exportedLibrary = exportedLibrary; 899 exportElement.exportedLibrary = exportedLibrary;
895 setElementDocumentationComment(exportElement, node); 900 setElementDocumentationComment(exportElement, node);
896 node.element = exportElement; 901 node.element = exportElement;
897 exports.add(exportElement); 902 exports.add(exportElement);
898 if (exportedTime >= 0 && 903 if (exportedTime >= 0 &&
899 exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { 904 exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) {
900 int offset = node.offset; 905 int offset = node.offset;
901 int length = node.length; 906 int length = node.length;
902 if (uriLiteral != null) { 907 if (uriLiteral != null) {
(...skipping 20 matching lines...) Expand all
923 // The imported source will be null if the URI in the import 928 // The imported source will be null if the URI in the import
924 // directive was invalid. 929 // directive was invalid.
925 LibraryElement importedLibrary = importLibraryMap[importedSource]; 930 LibraryElement importedLibrary = importLibraryMap[importedSource];
926 if (importedLibrary != null) { 931 if (importedLibrary != null) {
927 if (importedLibrary.isDartCore) { 932 if (importedLibrary.isDartCore) {
928 explicitlyImportsCore = true; 933 explicitlyImportsCore = true;
929 } 934 }
930 ImportElementImpl importElement = new ImportElementImpl(node.offset); 935 ImportElementImpl importElement = new ImportElementImpl(node.offset);
931 importElement.metadata = _getElementAnnotations(node.metadata); 936 importElement.metadata = _getElementAnnotations(node.metadata);
932 StringLiteral uriLiteral = node.uri; 937 StringLiteral uriLiteral = node.uri;
938 if (uriLiteral != null) {
939 importElement.uriOffset = uriLiteral.offset;
940 importElement.uriEnd = uriLiteral.end;
941 }
942 importElement.uri = node.selectedUriContent;
933 importElement.deferred = node.deferredKeyword != null; 943 importElement.deferred = node.deferredKeyword != null;
934 importElement.combinators = _buildCombinators(node); 944 importElement.combinators = _buildCombinators(node);
935 importElement.importedLibrary = importedLibrary; 945 importElement.importedLibrary = importedLibrary;
936 setElementDocumentationComment(importElement, node); 946 setElementDocumentationComment(importElement, node);
937 SimpleIdentifier prefixNode = node.prefix; 947 SimpleIdentifier prefixNode = node.prefix;
938 if (prefixNode != null) { 948 if (prefixNode != null) {
939 importElement.prefixOffset = prefixNode.offset; 949 importElement.prefixOffset = prefixNode.offset;
940 String prefixName = prefixNode.name; 950 String prefixName = prefixNode.name;
941 PrefixElementImpl prefix = nameToPrefixMap[prefixName]; 951 PrefixElementImpl prefix = nameToPrefixMap[prefixName];
942 if (prefix == null) { 952 if (prefix == null) {
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 return null; 1668 return null;
1659 } 1669 }
1660 1670
1661 /** 1671 /**
1662 * Return the lexical identifiers associated with the given [identifiers]. 1672 * Return the lexical identifiers associated with the given [identifiers].
1663 */ 1673 */
1664 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { 1674 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) {
1665 return identifiers.map((identifier) => identifier.name).toList(); 1675 return identifiers.map((identifier) => identifier.name).toList();
1666 } 1676 }
1667 } 1677 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/dart/element/element.dart ('k') | pkg/analyzer/lib/src/dart/element/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698