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

Side by Side Diff: pkg/compiler/lib/src/source_file_provider.dart

Issue 2237543002: Improve error reporting: use colors and associate the appropiate file with (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 | « pkg/compiler/bin/resolver.dart ('k') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 class BazelInputProvider extends SourceFileProvider { 382 class BazelInputProvider extends SourceFileProvider {
383 final List<Uri> dirs; 383 final List<Uri> dirs;
384 384
385 BazelInputProvider(List<String> searchPaths) 385 BazelInputProvider(List<String> searchPaths)
386 : dirs = searchPaths.map(_resolve).toList(); 386 : dirs = searchPaths.map(_resolve).toList();
387 387
388 static _resolve(String path) => currentDirectory.resolve(path); 388 static _resolve(String path) => currentDirectory.resolve(path);
389 389
390 @override 390 @override
391 Future readFromUri(Uri uri) async { 391 Future readFromUri(Uri uri) async {
392 var resolvedUri = uri;
392 var path = uri.path; 393 var path = uri.path;
393 if (path.startsWith('/bazel-root')) { 394 if (path.startsWith('/bazel-root')) {
394 path = path.substring('/bazel-root/'.length); 395 path = path.substring('/bazel-root/'.length);
395 for (var dir in dirs) { 396 for (var dir in dirs) {
396 var file = dir.resolve(path); 397 var file = dir.resolve(path);
397 if (await new File.fromUri(file).exists()) { 398 if (await new File.fromUri(file).exists()) {
398 uri = file; 399 resolvedUri = file;
399 break; 400 break;
400 } 401 }
401 } 402 }
402 } 403 }
403 return readUtf8BytesFromUri(uri); 404 var result = await readUtf8BytesFromUri(resolvedUri);
405 sourceFiles[uri] = sourceFiles[resolvedUri];
406 return result;
404 } 407 }
405 } 408 }
OLDNEW
« no previous file with comments | « pkg/compiler/bin/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698