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

Side by Side Diff: pkg/analyzer/lib/src/dart/sdk/sdk.dart

Issue 2967503002: Fix the resolution of uri-based part-of directives in the SDK (issue 29598) (Closed)
Patch Set: moved test 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.sdk2; 5 library analyzer.src.generated.sdk2;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 libraryName = dartUri; 644 libraryName = dartUri;
645 relativePath = ""; 645 relativePath = "";
646 } 646 }
647 SdkLibrary library = getSdkLibrary(libraryName); 647 SdkLibrary library = getSdkLibrary(libraryName);
648 if (library == null) { 648 if (library == null) {
649 return null; 649 return null;
650 } 650 }
651 try { 651 try {
652 File file = libraryDirectory.getChildAssumingFile(library.path); 652 File file = libraryDirectory.getChildAssumingFile(library.path);
653 if (!relativePath.isEmpty) { 653 if (!relativePath.isEmpty) {
654 file = file.parent.getChildAssumingFile(relativePath); 654 File relativeFile = file.parent.getChildAssumingFile(relativePath);
655 if (relativeFile.path == file.path) {
656 // The relative file is the library, so return a Source for the
657 // library rather than the part format.
658 return file.createSource(Uri.parse(library.shortName));
659 }
660 file = relativeFile;
655 } 661 }
656 return file.createSource(Uri.parse(dartUri)); 662 return file.createSource(Uri.parse(dartUri));
657 } on FormatException { 663 } on FormatException {
658 return null; 664 return null;
659 } 665 }
660 } 666 }
661 667
662 /** 668 /**
663 * Return the default directory for the Dart SDK, or `null` if the directory 669 * Return the default directory for the Dart SDK, or `null` if the directory
664 * cannot be determined (or does not exist). The default directory is provided 670 * cannot be determined (or does not exist). The default directory is provided
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 SdkLibrariesReader_LibraryBuilder libraryBuilder = 898 SdkLibrariesReader_LibraryBuilder libraryBuilder =
893 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); 899 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths);
894 // If any syntactic errors were found then don't try to visit the AST 900 // If any syntactic errors were found then don't try to visit the AST
895 // structure. 901 // structure.
896 if (!errorListener.errorReported) { 902 if (!errorListener.errorReported) {
897 unit.accept(libraryBuilder); 903 unit.accept(libraryBuilder);
898 } 904 }
899 return libraryBuilder.librariesMap; 905 return libraryBuilder.librariesMap;
900 } 906 }
901 } 907 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698