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

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

Issue 2392133002: Fix BazelFileUriResolver tests (Closed)
Patch Set: clean-up Created 4 years, 2 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/bazel_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) 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.bazel; 5 library analyzer.src.generated.bazel;
6 6
7 import 'dart:core'; 7 import 'dart:core';
8 8
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 for (Folder buildDir in _buildDirectories) { 50 for (Folder buildDir in _buildDirectories) {
51 File file = buildDir.getChildAssumingFile(relativeFromWorkspaceDir); 51 File file = buildDir.getChildAssumingFile(relativeFromWorkspaceDir);
52 if (file.exists) { 52 if (file.exists) {
53 return file.createSource(actualUri ?? uri); 53 return file.createSource(actualUri ?? uri);
54 } 54 }
55 } 55 }
56 return null; 56 return null;
57 } 57 }
58 58
59 String _getPathFromWorkspaceDir(Uri uri) { 59 String _getPathFromWorkspaceDir(Uri uri) {
60 String uriPath = uri.path; 60 try {
61 String workspacePath = _workspaceDir.path; 61 return provider.pathContext.relative(provider.pathContext.fromUri(uri),
62 62 from: _workspaceDir.path);
63 if (uriPath.startsWith(workspacePath) && 63 } on Exception {
64 workspacePath.length < uriPath.length) { 64 return '';
65 return uriPath.substring(workspacePath.length + 1);
66 } 65 }
67 return '';
68 } 66 }
69 } 67 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698