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

Side by Side Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2386363002: Don't use Source to compute absolute URI in _getLibraryByRelativeUri(). (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 summary_resynthesizer; 5 library summary_resynthesizer;
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';
11 import 'package:analyzer/dart/element/element.dart'; 11 import 'package:analyzer/dart/element/element.dart';
12 import 'package:analyzer/dart/element/type.dart'; 12 import 'package:analyzer/dart/element/type.dart';
13 import 'package:analyzer/src/dart/element/element.dart'; 13 import 'package:analyzer/src/dart/element/element.dart';
14 import 'package:analyzer/src/dart/element/handle.dart'; 14 import 'package:analyzer/src/dart/element/handle.dart';
15 import 'package:analyzer/src/dart/element/member.dart'; 15 import 'package:analyzer/src/dart/element/member.dart';
16 import 'package:analyzer/src/dart/element/type.dart'; 16 import 'package:analyzer/src/dart/element/type.dart';
17 import 'package:analyzer/src/generated/engine.dart'; 17 import 'package:analyzer/src/generated/engine.dart';
18 import 'package:analyzer/src/generated/resolver.dart'; 18 import 'package:analyzer/src/generated/resolver.dart';
19 import 'package:analyzer/src/generated/source_io.dart'; 19 import 'package:analyzer/src/generated/source_io.dart';
20 import 'package:analyzer/src/generated/testing/ast_factory.dart'; 20 import 'package:analyzer/src/generated/testing/ast_factory.dart';
21 import 'package:analyzer/src/generated/testing/token_factory.dart'; 21 import 'package:analyzer/src/generated/testing/token_factory.dart';
22 import 'package:analyzer/src/generated/utilities_dart.dart';
22 import 'package:analyzer/src/summary/format.dart'; 23 import 'package:analyzer/src/summary/format.dart';
23 import 'package:analyzer/src/summary/idl.dart'; 24 import 'package:analyzer/src/summary/idl.dart';
25 import 'package:analyzer/src/util/fast_uri.dart';
24 26
25 /** 27 /**
26 * Implementation of [ElementResynthesizer] used when resynthesizing an element 28 * Implementation of [ElementResynthesizer] used when resynthesizing an element
27 * model from summaries. 29 * model from summaries.
28 */ 30 */
29 abstract class SummaryResynthesizer extends ElementResynthesizer { 31 abstract class SummaryResynthesizer extends ElementResynthesizer {
30 /** 32 /**
31 * The parent [SummaryResynthesizer] which is asked to resynthesize elements 33 * The parent [SummaryResynthesizer] which is asked to resynthesize elements
32 * and get summaries before this resynthesizer attempts to do this. 34 * and get summaries before this resynthesizer attempts to do this.
33 * Can be `null`. 35 * Can be `null`.
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 return null; 1155 return null;
1154 } 1156 }
1155 1157
1156 @override 1158 @override
1157 void patchTopLevelAccessors() { 1159 void patchTopLevelAccessors() {
1158 LibraryElementImpl library = resynthesizer.library; 1160 LibraryElementImpl library = resynthesizer.library;
1159 BuildLibraryElementUtils.patchTopLevelAccessors(library); 1161 BuildLibraryElementUtils.patchTopLevelAccessors(library);
1160 } 1162 }
1161 1163
1162 LibraryElementHandle _getLibraryByRelativeUri(String depUri) { 1164 LibraryElementHandle _getLibraryByRelativeUri(String depUri) {
1163 String absoluteUri = resynthesizer.summaryResynthesizer.sourceFactory 1165 String absoluteUri = resolveRelativeUri(
1164 .resolveUri(resynthesizer.librarySource, depUri) 1166 resynthesizer.librarySource.uri, FastUri.parse(depUri))
1165 .uri
1166 .toString(); 1167 .toString();
1167 return new LibraryElementHandle(resynthesizer.summaryResynthesizer, 1168 return new LibraryElementHandle(resynthesizer.summaryResynthesizer,
1168 new ElementLocationImpl.con3(<String>[absoluteUri])); 1169 new ElementLocationImpl.con3(<String>[absoluteUri]));
1169 } 1170 }
1170 } 1171 }
1171 1172
1172 /** 1173 /**
1173 * Data structure used during resynthesis to record all the information that is 1174 * Data structure used during resynthesis to record all the information that is
1174 * known about how to resynthesize a single entry in [LinkedUnit.references] 1175 * known about how to resynthesize a single entry in [LinkedUnit.references]
1175 * (and its associated entry in [UnlinkedUnit.references], if it exists). 1176 * (and its associated entry in [UnlinkedUnit.references], if it exists).
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 static String _getElementIdentifier(String name, ReferenceKind kind) { 1858 static String _getElementIdentifier(String name, ReferenceKind kind) {
1858 if (kind == ReferenceKind.topLevelPropertyAccessor || 1859 if (kind == ReferenceKind.topLevelPropertyAccessor ||
1859 kind == ReferenceKind.propertyAccessor) { 1860 kind == ReferenceKind.propertyAccessor) {
1860 if (!name.endsWith('=')) { 1861 if (!name.endsWith('=')) {
1861 return name + '?'; 1862 return name + '?';
1862 } 1863 }
1863 } 1864 }
1864 return name; 1865 return name;
1865 } 1866 }
1866 } 1867 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698