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

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

Issue 2050083002: Fix equality between subclasses of Source (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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_io; 5 library analyzer.src.generated.source_io;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/java_core.dart'; 10 import 'package:analyzer/src/generated/java_core.dart';
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 @override 232 @override
233 String get shortName => file.getName(); 233 String get shortName => file.getName();
234 234
235 @override 235 @override
236 UriKind get uriKind { 236 UriKind get uriKind {
237 String scheme = uri.scheme; 237 String scheme = uri.scheme;
238 return UriKind.fromScheme(scheme); 238 return UriKind.fromScheme(scheme);
239 } 239 }
240 240
241 @override 241 @override
242 bool operator ==(Object object) => 242 bool operator ==(Object object) {
243 object is FileBasedSource && id == object.id; 243 if (object is FileBasedSource) {
244 return id == object.id;
245 } else if (object is Source) {
246 return uri == object.uri;
247 }
248 return false;
249 }
244 250
245 @override 251 @override
246 bool exists() => file.isFile(); 252 bool exists() => file.isFile();
247 253
248 @override 254 @override
249 String toString() { 255 String toString() {
250 if (file == null) { 256 if (file == null) {
251 return "<unknown source>"; 257 return "<unknown source>";
252 } 258 }
253 return file.getAbsolutePath(); 259 return file.getAbsolutePath();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 557 }
552 558
553 /** 559 /**
554 * Return `true` if the given URI is a `file` URI. 560 * Return `true` if the given URI is a `file` URI.
555 * 561 *
556 * @param uri the URI being tested 562 * @param uri the URI being tested
557 * @return `true` if the given URI is a `file` URI 563 * @return `true` if the given URI is a `file` URI
558 */ 564 */
559 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; 565 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
560 } 566 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/memory_file_system.dart ('k') | pkg/analyzer/lib/src/summary/package_bundle_reader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698