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

Side by Side Diff: pkg/front_end/lib/src/base/processed_options.dart

Issue 2977703002: Refactorings for TranslateUri and its tests. (Closed)
Patch Set: Replace `file` with just word 'file' in documentation. 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/compilation_error.dart'; 7 import 'package:front_end/compilation_error.dart';
8 import 'package:front_end/compiler_options.dart'; 8 import 'package:front_end/compiler_options.dart';
9 import 'package:front_end/file_system.dart'; 9 import 'package:front_end/file_system.dart';
10 import 'package:front_end/src/base/performace_logger.dart'; 10 import 'package:front_end/src/base/performace_logger.dart';
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 /// Get the [TranslateUri] which resolves "package:" and "dart:" URIs. 215 /// Get the [TranslateUri] which resolves "package:" and "dart:" URIs.
216 /// 216 ///
217 /// This is an asynchronous method since file system operations may be 217 /// This is an asynchronous method since file system operations may be
218 /// required to locate/read the packages file as well as SDK metadata. 218 /// required to locate/read the packages file as well as SDK metadata.
219 Future<TranslateUri> getUriTranslator() async { 219 Future<TranslateUri> getUriTranslator() async {
220 if (_uriTranslator == null) { 220 if (_uriTranslator == null) {
221 await _getPackages(); 221 await _getPackages();
222 // TODO(scheglov) Load SDK libraries from whatever format we decide. 222 // TODO(scheglov) Load SDK libraries from whatever format we decide.
223 // TODO(scheglov) Remove the field "_raw.dartLibraries". 223 // TODO(scheglov) Remove the field "_raw.dartLibraries".
224 var libraries = _raw.dartLibraries ?? await _parseLibraries(); 224 var libraries = _raw.dartLibraries ?? await _parseDartLibraries();
225 _uriTranslator = 225 _uriTranslator =
226 new TranslateUri(_packages, libraries, const <String, List<Uri>>{}); 226 new TranslateUri(libraries, const <String, List<Uri>>{}, _packages);
227 ticker.logMs("Read packages file"); 227 ticker.logMs("Read packages file");
228 } 228 }
229 return _uriTranslator; 229 return _uriTranslator;
230 } 230 }
231 231
232 Future<Map<String, Uri>> _parseLibraries() async { 232 Future<Map<String, Uri>> _parseDartLibraries() async {
233 Uri librariesJson = _raw.sdkRoot?.resolve("lib/libraries.json"); 233 Uri librariesJson = _raw.sdkRoot?.resolve("lib/libraries.json");
234 return await computeLibraries(fileSystem, librariesJson); 234 return await computeDartLibraries(fileSystem, librariesJson);
235 } 235 }
236 236
237 /// Get the package map which maps package names to URIs. 237 /// Get the package map which maps package names to URIs.
238 /// 238 ///
239 /// This is an asynchronous getter since file system operations may be 239 /// This is an asynchronous getter since file system operations may be
240 /// required to locate/read the packages file. 240 /// required to locate/read the packages file.
241 Future<Map<String, Uri>> _getPackages() async { 241 Future<Map<String, Uri>> _getPackages() async {
242 if (_packages == null) { 242 if (_packages == null) {
243 if (_raw.packagesFileUri == null) { 243 if (_raw.packagesFileUri == null) {
244 // TODO(sigmund,paulberry): implement 244 // TODO(sigmund,paulberry): implement
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 /// An error that only contains a message and no error location. 346 /// An error that only contains a message and no error location.
347 class _CompilationError implements CompilationError { 347 class _CompilationError implements CompilationError {
348 String get correction => null; 348 String get correction => null;
349 SourceSpan get span => null; 349 SourceSpan get span => null;
350 final String message; 350 final String message;
351 _CompilationError(this.message); 351 _CompilationError(this.message);
352 352
353 String toString() => message; 353 String toString() => message;
354 } 354 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/target_implementation.dart » ('j') | pkg/front_end/lib/src/fasta/translate_uri.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698