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

Side by Side Diff: pkg/analyzer/lib/src/generated/sdk_io.dart

Issue 1710393002: First try to find the exact library for the given file URI. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | 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) 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.generated.sdk_io; 5 library analyzer.src.generated.sdk_io;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 String path = library.shortName; 463 String path = library.shortName;
464 try { 464 try {
465 return new FileBasedSource(file, parseUriWithException(path)); 465 return new FileBasedSource(file, parseUriWithException(path));
466 } on URISyntaxException catch (exception, stackTrace) { 466 } on URISyntaxException catch (exception, stackTrace) {
467 AnalysisEngine.instance.logger.logInformation( 467 AnalysisEngine.instance.logger.logInformation(
468 "Failed to create URI: $path", 468 "Failed to create URI: $path",
469 new CaughtException(exception, stackTrace)); 469 new CaughtException(exception, stackTrace));
470 return null; 470 return null;
471 } 471 }
472 } 472 }
473 libraryPath = new JavaFile(libraryPath).getParent(); 473 }
474 for (SdkLibrary library in _libraryMap.sdkLibraries) {
475 String libraryPath = new JavaFile(library.path).getParent();
474 if (filePath.startsWith("$libraryPath${JavaFile.separator}")) { 476 if (filePath.startsWith("$libraryPath${JavaFile.separator}")) {
475 String path = 477 String path =
476 "${library.shortName}/${filePath.substring(libraryPath.length + 1)}" ; 478 "${library.shortName}/${filePath.substring(libraryPath.length + 1)}" ;
477 try { 479 try {
478 return new FileBasedSource(file, parseUriWithException(path)); 480 return new FileBasedSource(file, parseUriWithException(path));
479 } on URISyntaxException catch (exception, stackTrace) { 481 } on URISyntaxException catch (exception, stackTrace) {
480 AnalysisEngine.instance.logger.logInformation( 482 AnalysisEngine.instance.logger.logInformation(
481 "Failed to create URI: $path", 483 "Failed to create URI: $path",
482 new CaughtException(exception, stackTrace)); 484 new CaughtException(exception, stackTrace));
483 return null; 485 return null;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 SdkLibrariesReader_LibraryBuilder libraryBuilder = 665 SdkLibrariesReader_LibraryBuilder libraryBuilder =
664 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); 666 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths);
665 // If any syntactic errors were found then don't try to visit the AST 667 // If any syntactic errors were found then don't try to visit the AST
666 // structure. 668 // structure.
667 if (!errorListener.errorReported) { 669 if (!errorListener.errorReported) {
668 unit.accept(libraryBuilder); 670 unit.accept(libraryBuilder);
669 } 671 }
670 return libraryBuilder.librariesMap; 672 return libraryBuilder.librariesMap;
671 } 673 }
672 } 674 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698