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

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

Issue 1831133005: Consolidate duplicate code for resloving URIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Sort Created 4 years, 9 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 library analyzer.src.generated.source; 5 library analyzer.src.generated.source;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 @override 397 @override
398 bool operator ==(Object other) { 398 bool operator ==(Object other) {
399 if (other is NonExistingSource) { 399 if (other is NonExistingSource) {
400 return other.uriKind == uriKind && other.fullName == fullName; 400 return other.uriKind == uriKind && other.fullName == fullName;
401 } 401 }
402 return false; 402 return false;
403 } 403 }
404 404
405 @override 405 @override
406 bool exists() => false; 406 bool exists() => false;
407
408 @override
409 Uri resolveRelativeUri(Uri relativeUri) {
410 throw new UnsupportedOperationException('$fullName does not exist.');
411 }
412 } 407 }
413 408
414 /** 409 /**
415 * The interface `Source` defines the behavior of objects representing source co de that can be 410 * The interface `Source` defines the behavior of objects representing source co de that can be
416 * analyzed by the analysis engine. 411 * analyzed by the analysis engine.
417 * 412 *
418 * Implementations of this interface need to be aware of some assumptions made b y the analysis 413 * Implementations of this interface need to be aware of some assumptions made b y the analysis
419 * engine concerning sources: 414 * engine concerning sources:
420 * * Sources are not required to be unique. That is, there can be multiple insta nces representing 415 * * Sources are not required to be unique. That is, there can be multiple insta nces representing
421 * the same source. 416 * the same source.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 /** 535 /**
541 * Return `true` if this source exists. 536 * Return `true` if this source exists.
542 * 537 *
543 * Clients should consider using the the method [AnalysisContext.exists] becau se 538 * Clients should consider using the the method [AnalysisContext.exists] becau se
544 * contexts can have local overrides of the content of a source that the sourc e is not aware of 539 * contexts can have local overrides of the content of a source that the sourc e is not aware of
545 * and a source with local content is considered to exist even if there is no file on disk. 540 * and a source with local content is considered to exist even if there is no file on disk.
546 * 541 *
547 * @return `true` if this source exists 542 * @return `true` if this source exists
548 */ 543 */
549 bool exists(); 544 bool exists();
550
551 /**
552 * Resolve the relative URI against the URI associated with this source object .
553 *
554 * Note: This method is not intended for public use, it is only visible out of necessity. It is
555 * only intended to be invoked by a [SourceFactory]. Source factories will
556 * only invoke this method if the URI is relative, so implementations of this method are not
557 * required to, and generally do not, verify the argument. The result of invok ing this method with
558 * an absolute URI is intentionally left unspecified.
559 *
560 * @param relativeUri the relative URI to be resolved against this source
561 * @return the URI to which given URI was resolved
562 * @throws AnalysisException if the relative URI could not be resolved
563 */
564 Uri resolveRelativeUri(Uri relativeUri);
565 } 545 }
566 546
567 /** 547 /**
568 * The interface `ContentReceiver` defines the behavior of objects that can rece ive the 548 * The interface `ContentReceiver` defines the behavior of objects that can rece ive the
569 * content of a source. 549 * content of a source.
570 */ 550 */
571 abstract class Source_ContentReceiver { 551 abstract class Source_ContentReceiver {
572 /** 552 /**
573 * Accept the contents of a source. 553 * Accept the contents of a source.
574 * 554 *
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 Source resolveAbsolute(Uri uri, [Uri actualUri]); 912 Source resolveAbsolute(Uri uri, [Uri actualUri]);
933 913
934 /** 914 /**
935 * Return an absolute URI that represents the given [source], or `null` if a 915 * Return an absolute URI that represents the given [source], or `null` if a
936 * valid URI cannot be computed. 916 * valid URI cannot be computed.
937 * 917 *
938 * The computation should be based solely on [source.fullName]. 918 * The computation should be based solely on [source.fullName].
939 */ 919 */
940 Uri restoreAbsolute(Source source) => null; 920 Uri restoreAbsolute(Source source) => null;
941 } 921 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698