Chromium Code Reviews| Index: pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| diff --git a/pkg/analyzer/lib/src/dart/sdk/sdk.dart b/pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| index bbde2ed279e5f28b4e410a17fb88f0ca2cb049cc..e98cb40c557e7f8ece0e8aca3d96b64f7f98e21a 100644 |
| --- a/pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| +++ b/pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| @@ -116,8 +116,8 @@ abstract class AbstractDartSdk implements DartSdk { |
| @override |
| Source fromFileUri(Uri uri) { |
| - File file = resourceProvider.getFile(uri.toFilePath(windows: false)); |
| - |
| + bool isWindows = resourceProvider.pathContext == pathos.windows; |
| + File file = resourceProvider.getFile(uri.toFilePath(windows: isWindows)); |
|
scheglov
2016/08/03 20:03:31
Maybe pathos.fromUri(uri) to avoid checking for Wi
Brian Wilkerson
2016/08/03 20:26:32
Done
|
| String path = _getPath(file); |
| if (path == null) { |
| return null; |
| @@ -166,7 +166,8 @@ abstract class AbstractDartSdk implements DartSdk { |
| srcPath = library.path; |
| } else { |
| String libraryPath = library.path; |
| - int index = libraryPath.lastIndexOf(resourceProvider.pathContext.separator); |
| + int index = |
| + libraryPath.lastIndexOf(resourceProvider.pathContext.separator); |
|
scheglov
2016/08/03 20:03:31
Maybe extract separator into a field or a getter t
Brian Wilkerson
2016/08/03 20:26:32
Done
|
| if (index == -1) { |
| index = libraryPath.lastIndexOf('/'); |
| if (index == -1) { |
| @@ -176,7 +177,8 @@ abstract class AbstractDartSdk implements DartSdk { |
| String prefix = libraryPath.substring(0, index + 1); |
| srcPath = '$prefix$relativePath'; |
| } |
| - String filePath = srcPath.replaceAll('/', resourceProvider.pathContext.separator); |
| + String filePath = |
| + srcPath.replaceAll('/', resourceProvider.pathContext.separator); |
| try { |
| File file = resourceProvider.getFile(filePath); |
| return file.createSource(parseUriWithException(dartUri)); |
| @@ -205,7 +207,8 @@ abstract class AbstractDartSdk implements DartSdk { |
| } |
| for (int i = 0; i < length; i++) { |
| SdkLibrary library = libraries[i]; |
| - String libraryPath = library.path.replaceAll('/', resourceProvider.pathContext.separator); |
| + String libraryPath = |
| + library.path.replaceAll('/', resourceProvider.pathContext.separator); |
| if (filePath == libraryPath) { |
| return library.shortName; |
| } |
| @@ -214,7 +217,8 @@ abstract class AbstractDartSdk implements DartSdk { |
| for (int i = 0; i < length; i++) { |
| SdkLibrary library = libraries[i]; |
| String libraryPath = paths[i]; |
| - int index = libraryPath.lastIndexOf(resourceProvider.pathContext.separator); |
| + int index = |
| + libraryPath.lastIndexOf(resourceProvider.pathContext.separator); |
| if (index >= 0) { |
| String prefix = libraryPath.substring(0, index + 1); |
| if (filePath.startsWith(prefix)) { |
| @@ -280,7 +284,8 @@ class EmbedderSdk extends AbstractDartSdk { |
| srcPath = library.path; |
| } else { |
| String libraryPath = library.path; |
| - int index = libraryPath.lastIndexOf(resourceProvider.pathContext.separator); |
| + int index = |
| + libraryPath.lastIndexOf(resourceProvider.pathContext.separator); |
| if (index == -1) { |
| index = libraryPath.lastIndexOf('/'); |
| if (index == -1) { |
| @@ -290,7 +295,8 @@ class EmbedderSdk extends AbstractDartSdk { |
| String prefix = libraryPath.substring(0, index + 1); |
| srcPath = '$prefix$relativePath'; |
| } |
| - String filePath = srcPath.replaceAll('/', resourceProvider.pathContext.separator); |
| + String filePath = |
| + srcPath.replaceAll('/', resourceProvider.pathContext.separator); |
| try { |
| File file = resourceProvider.getFile(filePath); |
| return file.createSource(parseUriWithException(dartUri)); |
| @@ -516,7 +522,8 @@ class FolderBasedDartSdk extends AbstractDartSdk { |
| String getRelativePathFromFile(File file) { |
| String filePath = file.path; |
| String libPath = libraryDirectory.path; |
| - if (!filePath.startsWith("$libPath${resourceProvider.pathContext.separator}")) { |
| + if (!filePath |
| + .startsWith("$libPath${resourceProvider.pathContext.separator}")) { |
| return null; |
| } |
| return filePath.substring(libPath.length + 1); |
| @@ -530,7 +537,8 @@ class FolderBasedDartSdk extends AbstractDartSdk { |
| PackageBundle getSummarySdkBundle(bool strongMode) { |
| String rootPath = directory.path; |
| String name = strongMode ? 'strong.sum' : 'spec.sum'; |
| - String path = resourceProvider.pathContext.join(rootPath, 'lib', '_internal', name); |
| + String path = |
| + resourceProvider.pathContext.join(rootPath, 'lib', '_internal', name); |
| try { |
| File file = resourceProvider.getFile(path); |
| if (file.exists) { |