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

Unified Diff: pkg/analyzer/test/src/summary/element_text.dart

Issue 2982993003: Remove UriReferencedElement with its uri/uriOffset/uriEnd properties. (Closed)
Patch Set: Merge. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/element_text.dart
diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart
index d005d3b7debfd551f7c474e66b32f4e2668878d1..65d7c8064161bfe5b6039e38ab40e35e10829025 100644
--- a/pkg/analyzer/test/src/summary/element_text.dart
+++ b/pkg/analyzer/test/src/summary/element_text.dart
@@ -262,7 +262,7 @@ class _ElementWriter {
void writeExportElement(ExportElement e) {
writeMetadata(e, '', '\n');
buffer.write('export ');
- writeUri(e, e.exportedLibrary?.source);
+ writeUri(e.exportedLibrary?.source);
e.combinators.forEach(writeNamespaceCombinator);
@@ -479,7 +479,7 @@ class _ElementWriter {
if (!e.isSynthetic) {
writeMetadata(e, '', '\n');
buffer.write('import ');
- writeUri(e, e.importedLibrary?.source);
+ writeUri(e.importedLibrary?.source);
writeIf(e.isDeferred, ' deferred');
@@ -637,7 +637,7 @@ class _ElementWriter {
void writePartElement(CompilationUnitElement e) {
writeMetadata(e, '', '\n');
buffer.write('part ');
- writeUri(e, e.source);
+ writeUri(e.source);
buffer.writeln(';');
}
@@ -806,14 +806,16 @@ class _ElementWriter {
e.functions.forEach(writeFunctionElement);
}
- void writeUri(UriReferencedElement e, Source source) {
- String uri = e.uri ?? source.uri.toString();
- buffer.write('\'$uri\'');
- if (withOffsets) {
- buffer.write('(');
- buffer.write('${e.uriOffset}, ');
- buffer.write('${e.uriEnd})');
- buffer.write(')');
+ void writeUri(Source source) {
+ if (source != null) {
+ Uri uri = source.uri;
+ String uriStr = uri.toString();
+ if (uri.isScheme('file')) {
+ uriStr = uri.pathSegments.last;
+ }
+ buffer.write('\'$uriStr\'');
+ } else {
+ buffer.write('\'<unresolved>\'');
}
}
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698