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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/source_io.dart

Issue 26293003: Check for null, when packages dir has no parent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/PackageUriResolver.java ('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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.source.io; 3 library engine.source.io;
4 import 'source.dart'; 4 import 'source.dart';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_io.dart'; 6 import 'java_io.dart';
7 import 'engine.dart' show AnalysisContext, AnalysisEngine; 7 import 'engine.dart' show AnalysisContext, AnalysisEngine;
8 export 'source.dart'; 8 export 'source.dart';
9 /** 9 /**
10 * Instances of the class `FileBasedSource` implement a source that represents a file. 10 * Instances of the class `FileBasedSource` implement a source that represents a file.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 return new JavaFile.relative(pkgDir, relPath.replaceAll('/', new String.from CharCode(JavaFile.separatorChar))); 255 return new JavaFile.relative(pkgDir, relPath.replaceAll('/', new String.from CharCode(JavaFile.separatorChar)));
256 } 256 }
257 257
258 /** 258 /**
259 * @return `true` if "file" was found in "packagesDir", and it is part of the "lib" folder 259 * @return `true` if "file" was found in "packagesDir", and it is part of the "lib" folder
260 * of the application that contains in this "packagesDir". 260 * of the application that contains in this "packagesDir".
261 */ 261 */
262 bool isSelfReference(JavaFile packagesDir, JavaFile file) { 262 bool isSelfReference(JavaFile packagesDir, JavaFile file) {
263 JavaFile rootDir = packagesDir.getParentFile(); 263 JavaFile rootDir = packagesDir.getParentFile();
264 if (rootDir == null) {
265 return false;
266 }
264 String rootPath = rootDir.getAbsolutePath(); 267 String rootPath = rootDir.getAbsolutePath();
265 String filePath = file.getAbsolutePath(); 268 String filePath = file.getAbsolutePath();
266 return filePath.startsWith("${rootPath}/lib"); 269 return filePath.startsWith("${rootPath}/lib");
267 } 270 }
268 } 271 }
269 /** 272 /**
270 * Instances of the class [DirectoryBasedSourceContainer] represent a source con tainer that 273 * Instances of the class [DirectoryBasedSourceContainer] represent a source con tainer that
271 * contains all sources within a given directory. 274 * contains all sources within a given directory.
272 * 275 *
273 * @coverage dart.engine.source 276 * @coverage dart.engine.source
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 345 }
343 return null; 346 return null;
344 } 347 }
345 Source resolveAbsolute(ContentCache contentCache, Uri uri) { 348 Source resolveAbsolute(ContentCache contentCache, Uri uri) {
346 if (!isFileUri(uri)) { 349 if (!isFileUri(uri)) {
347 return null; 350 return null;
348 } 351 }
349 return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri)); 352 return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri));
350 } 353 }
351 } 354 }
OLDNEW
« no previous file with comments | « editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/PackageUriResolver.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698