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

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

Issue 2343103003: ImportElement/ExportElement 'uri' should be the selected URI. (Closed)
Patch Set: Created 4 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 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // directive was invalid. 175 // directive was invalid.
176 LibraryElement exportedLibrary = exportLibraryMap[exportedSource]; 176 LibraryElement exportedLibrary = exportLibraryMap[exportedSource];
177 if (exportedLibrary != null) { 177 if (exportedLibrary != null) {
178 ExportElementImpl exportElement = new ExportElementImpl(node.offset); 178 ExportElementImpl exportElement = new ExportElementImpl(node.offset);
179 exportElement.metadata = _getElementAnnotations(node.metadata); 179 exportElement.metadata = _getElementAnnotations(node.metadata);
180 StringLiteral uriLiteral = node.uri; 180 StringLiteral uriLiteral = node.uri;
181 if (uriLiteral != null) { 181 if (uriLiteral != null) {
182 exportElement.uriOffset = uriLiteral.offset; 182 exportElement.uriOffset = uriLiteral.offset;
183 exportElement.uriEnd = uriLiteral.end; 183 exportElement.uriEnd = uriLiteral.end;
184 } 184 }
185 exportElement.uri = node.uriContent; 185 exportElement.uri = node.selectedUri;
186 exportElement.combinators = _buildCombinators(node); 186 exportElement.combinators = _buildCombinators(node);
187 exportElement.exportedLibrary = exportedLibrary; 187 exportElement.exportedLibrary = exportedLibrary;
188 setElementDocumentationComment(exportElement, node); 188 setElementDocumentationComment(exportElement, node);
189 node.element = exportElement; 189 node.element = exportElement;
190 exports.add(exportElement); 190 exports.add(exportElement);
191 if (exportedTime >= 0 && 191 if (exportedTime >= 0 &&
192 exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { 192 exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) {
193 int offset = node.offset; 193 int offset = node.offset;
194 int length = node.length; 194 int length = node.length;
195 if (uriLiteral != null) { 195 if (uriLiteral != null) {
(...skipping 24 matching lines...) Expand all
220 if (importedLibrary.isDartCore) { 220 if (importedLibrary.isDartCore) {
221 explicitlyImportsCore = true; 221 explicitlyImportsCore = true;
222 } 222 }
223 ImportElementImpl importElement = new ImportElementImpl(node.offset); 223 ImportElementImpl importElement = new ImportElementImpl(node.offset);
224 importElement.metadata = _getElementAnnotations(node.metadata); 224 importElement.metadata = _getElementAnnotations(node.metadata);
225 StringLiteral uriLiteral = node.uri; 225 StringLiteral uriLiteral = node.uri;
226 if (uriLiteral != null) { 226 if (uriLiteral != null) {
227 importElement.uriOffset = uriLiteral.offset; 227 importElement.uriOffset = uriLiteral.offset;
228 importElement.uriEnd = uriLiteral.end; 228 importElement.uriEnd = uriLiteral.end;
229 } 229 }
230 importElement.uri = node.uriContent; 230 importElement.uri = node.selectedUri;
231 importElement.deferred = node.deferredKeyword != null; 231 importElement.deferred = node.deferredKeyword != null;
232 importElement.combinators = _buildCombinators(node); 232 importElement.combinators = _buildCombinators(node);
233 importElement.importedLibrary = importedLibrary; 233 importElement.importedLibrary = importedLibrary;
234 setElementDocumentationComment(importElement, node); 234 setElementDocumentationComment(importElement, node);
235 SimpleIdentifier prefixNode = node.prefix; 235 SimpleIdentifier prefixNode = node.prefix;
236 if (prefixNode != null) { 236 if (prefixNode != null) {
237 importElement.prefixOffset = prefixNode.offset; 237 importElement.prefixOffset = prefixNode.offset;
238 String prefixName = prefixNode.name; 238 String prefixName = prefixNode.name;
239 PrefixElementImpl prefix = nameToPrefixMap[prefixName]; 239 PrefixElementImpl prefix = nameToPrefixMap[prefixName];
240 if (prefix == null) { 240 if (prefix == null) {
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 return null; 1456 return null;
1457 } 1457 }
1458 1458
1459 /** 1459 /**
1460 * Return the lexical identifiers associated with the given [identifiers]. 1460 * Return the lexical identifiers associated with the given [identifiers].
1461 */ 1461 */
1462 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { 1462 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) {
1463 return identifiers.map((identifier) => identifier.name).toList(); 1463 return identifiers.map((identifier) => identifier.name).toList();
1464 } 1464 }
1465 } 1465 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698