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

Side by Side Diff: packages/analyzer/lib/src/generated/source_io.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 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
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 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information.
7
8 library engine.source.io; 5 library engine.source.io;
9 6
10 import 'dart:collection'; 7 import 'dart:collection';
11 8
12 import 'engine.dart'; 9 import 'engine.dart';
13 import 'java_core.dart'; 10 import 'java_core.dart';
14 import 'java_engine.dart'; 11 import 'java_engine.dart';
15 import 'java_io.dart'; 12 import 'java_io.dart';
16 import 'source.dart'; 13 import 'source.dart';
17 14
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 /** 266 /**
270 * Instances of the class `FileUriResolver` resolve `file` URI's. 267 * Instances of the class `FileUriResolver` resolve `file` URI's.
271 */ 268 */
272 class FileUriResolver extends UriResolver { 269 class FileUriResolver extends UriResolver {
273 /** 270 /**
274 * The name of the `file` scheme. 271 * The name of the `file` scheme.
275 */ 272 */
276 static String FILE_SCHEME = "file"; 273 static String FILE_SCHEME = "file";
277 274
278 @override 275 @override
279 Source resolveAbsolute(Uri uri) { 276 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
280 if (!isFileUri(uri)) { 277 if (!isFileUri(uri)) {
281 return null; 278 return null;
282 } 279 }
283 return new FileBasedSource(new JavaFile.fromUri(uri), uri); 280 return new FileBasedSource(
281 new JavaFile.fromUri(uri), actualUri != null ? actualUri : uri);
284 } 282 }
285 283
286 @override 284 @override
287 Uri restoreAbsolute(Source source) { 285 Uri restoreAbsolute(Source source) {
288 if (source is FileBasedSource) { 286 return new Uri.file(source.fullName);
289 return new Uri.file(source.fullName);
290 }
291 return null;
292 } 287 }
293 288
294 /** 289 /**
295 * Return `true` if the given URI is a `file` URI. 290 * Return `true` if the given URI is a `file` URI.
296 * 291 *
297 * @param uri the URI being tested 292 * @param uri the URI being tested
298 * @return `true` if the given URI is a `file` URI 293 * @return `true` if the given URI is a `file` URI
299 */ 294 */
300 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; 295 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
301 } 296 }
302 297
303 /** 298 /**
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } on JavaIOException catch (exception, stackTrace) { 408 } on JavaIOException catch (exception, stackTrace) {
414 if (!exception.toString().contains("Required key not available")) { 409 if (!exception.toString().contains("Required key not available")) {
415 AnalysisEngine.instance.logger.logError("Canonical failed: $pkgDir", 410 AnalysisEngine.instance.logger.logError("Canonical failed: $pkgDir",
416 new CaughtException(exception, stackTrace)); 411 new CaughtException(exception, stackTrace));
417 } else if (_CanLogRequiredKeyIoException) { 412 } else if (_CanLogRequiredKeyIoException) {
418 _CanLogRequiredKeyIoException = false; 413 _CanLogRequiredKeyIoException = false;
419 AnalysisEngine.instance.logger.logError("Canonical failed: $pkgDir", 414 AnalysisEngine.instance.logger.logError("Canonical failed: $pkgDir",
420 new CaughtException(exception, stackTrace)); 415 new CaughtException(exception, stackTrace));
421 } 416 }
422 } 417 }
423 return new JavaFile.relative(pkgDir, relPath.replaceAll( 418 return new JavaFile.relative(
424 '/', new String.fromCharCode(JavaFile.separatorChar))); 419 pkgDir,
420 relPath.replaceAll(
421 '/', new String.fromCharCode(JavaFile.separatorChar)));
425 } 422 }
426 423
427 @override 424 @override
428 Source resolveAbsolute(Uri uri) { 425 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
429 if (!isPackageUri(uri)) { 426 if (!isPackageUri(uri)) {
430 return null; 427 return null;
431 } 428 }
432 String path = uri.path; 429 String path = uri.path;
433 if (path == null) { 430 if (path == null) {
434 path = uri.path; 431 path = uri.path;
435 if (path == null) { 432 if (path == null) {
436 return null; 433 return null;
437 } 434 }
438 } 435 }
(...skipping 13 matching lines...) Expand all
452 relPath = path.substring(index + 1); 449 relPath = path.substring(index + 1);
453 } 450 }
454 for (JavaFile packagesDirectory in _packagesDirectories) { 451 for (JavaFile packagesDirectory in _packagesDirectories) {
455 JavaFile resolvedFile = new JavaFile.relative(packagesDirectory, path); 452 JavaFile resolvedFile = new JavaFile.relative(packagesDirectory, path);
456 if (resolvedFile.exists()) { 453 if (resolvedFile.exists()) {
457 JavaFile canonicalFile = 454 JavaFile canonicalFile =
458 getCanonicalFile(packagesDirectory, pkgName, relPath); 455 getCanonicalFile(packagesDirectory, pkgName, relPath);
459 if (_isSelfReference(packagesDirectory, canonicalFile)) { 456 if (_isSelfReference(packagesDirectory, canonicalFile)) {
460 uri = canonicalFile.toURI(); 457 uri = canonicalFile.toURI();
461 } 458 }
462 return new FileBasedSource(canonicalFile, uri); 459 return new FileBasedSource(
460 canonicalFile, actualUri != null ? actualUri : uri);
463 } 461 }
464 } 462 }
465 return new FileBasedSource( 463 return new FileBasedSource(
466 getCanonicalFile(_packagesDirectories[0], pkgName, relPath), uri); 464 getCanonicalFile(_packagesDirectories[0], pkgName, relPath),
465 actualUri != null ? actualUri : uri);
467 } 466 }
468 467
469 @override 468 @override
470 Uri restoreAbsolute(Source source) { 469 Uri restoreAbsolute(Source source) {
471 String sourcePath = source.fullName; 470 String sourcePath = source.fullName;
472 for (JavaFile packagesDirectory in _packagesDirectories) { 471 for (JavaFile packagesDirectory in _packagesDirectories) {
473 List<JavaFile> pkgFolders = packagesDirectory.listFiles(); 472 List<JavaFile> pkgFolders = packagesDirectory.listFiles();
474 if (pkgFolders != null) { 473 if (pkgFolders != null) {
475 for (JavaFile pkgFolder in pkgFolders) { 474 for (JavaFile pkgFolder in pkgFolders) {
476 try { 475 try {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 final JavaFile _rootDirectory; 529 final JavaFile _rootDirectory;
531 530
532 /** 531 /**
533 * Initialize a newly created resolver to resolve `file` URI's relative to the given root 532 * Initialize a newly created resolver to resolve `file` URI's relative to the given root
534 * directory. 533 * directory.
535 */ 534 */
536 RelativeFileUriResolver(this._rootDirectory, this._relativeDirectories) 535 RelativeFileUriResolver(this._rootDirectory, this._relativeDirectories)
537 : super(); 536 : super();
538 537
539 @override 538 @override
540 Source resolveAbsolute(Uri uri) { 539 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
541 String rootPath = _rootDirectory.toURI().path; 540 String rootPath = _rootDirectory.toURI().path;
542 String uriPath = uri.path; 541 String uriPath = uri.path;
543 if (uriPath != null && uriPath.startsWith(rootPath)) { 542 if (uriPath != null && uriPath.startsWith(rootPath)) {
544 String filePath = uri.path.substring(rootPath.length); 543 String filePath = uri.path.substring(rootPath.length);
545 for (JavaFile dir in _relativeDirectories) { 544 for (JavaFile dir in _relativeDirectories) {
546 JavaFile file = new JavaFile.relative(dir, filePath); 545 JavaFile file = new JavaFile.relative(dir, filePath);
547 if (file.exists()) { 546 if (file.exists()) {
548 return new FileBasedSource(file, uri); 547 return new FileBasedSource(file, actualUri != null ? actualUri : uri);
549 } 548 }
550 } 549 }
551 } 550 }
552 return null; 551 return null;
553 } 552 }
554 553
555 /** 554 /**
556 * Return `true` if the given URI is a `file` URI. 555 * Return `true` if the given URI is a `file` URI.
557 * 556 *
558 * @param uri the URI being tested 557 * @param uri the URI being tested
559 * @return `true` if the given URI is a `file` URI 558 * @return `true` if the given URI is a `file` URI
560 */ 559 */
561 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; 560 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
562 } 561 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/src/generated/source.dart ('k') | packages/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698