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

Side by Side Diff: packages/analyzer/lib/src/string_source.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.string_source; 5 library analyzer.src.string_source;
6 6
7 import 'generated/engine.dart' show TimestampedData; 7 import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
8 import 'generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 9
10 /// An implementation of [Source] that's based on an in-memory Dart string. 10 /**
11 * An implementation of [Source] that's based on an in-memory Dart string.
12 */
11 class StringSource extends Source { 13 class StringSource extends Source {
14 /**
15 * The content of the source.
16 */
12 final String _contents; 17 final String _contents;
18
19 @override
13 final String fullName; 20 final String fullName;
21
22 @override
23 final Uri uri;
24
25 @override
14 final int modificationStamp; 26 final int modificationStamp;
15 27
16 StringSource(this._contents, this.fullName) 28 StringSource(this._contents, String fullName)
17 : modificationStamp = new DateTime.now().millisecondsSinceEpoch; 29 : this.fullName = fullName,
30 uri = fullName == null ? null : new Uri.file(fullName),
31 modificationStamp = new DateTime.now().millisecondsSinceEpoch;
18 32
33 @override
19 TimestampedData<String> get contents => 34 TimestampedData<String> get contents =>
20 new TimestampedData(modificationStamp, _contents); 35 new TimestampedData(modificationStamp, _contents);
21 36
22 String get encoding => 37 @override
23 throw new UnsupportedError("StringSource doesn't support " "encoding."); 38 String get encoding => uri.toString();
24 39
40 @override
25 int get hashCode => _contents.hashCode ^ fullName.hashCode; 41 int get hashCode => _contents.hashCode ^ fullName.hashCode;
26 42
43 @override
27 bool get isInSystemLibrary => false; 44 bool get isInSystemLibrary => false;
28 45
46 @override
29 String get shortName => fullName; 47 String get shortName => fullName;
30 48
31 @override 49 @override
32 Uri get uri => 50 UriKind get uriKind => UriKind.FILE_URI;
33 throw new UnsupportedError("StringSource doesn't support uri.");
34 51
35 UriKind get uriKind => 52 /**
36 throw new UnsupportedError("StringSource doesn't support " "uriKind."); 53 * Return `true` if the given [object] is a string source that is equal to
37 54 * this source.
55 */
56 @override
38 bool operator ==(Object object) { 57 bool operator ==(Object object) {
39 if (object is StringSource) { 58 return object is StringSource &&
40 StringSource ssObject = object; 59 object._contents == _contents &&
41 return ssObject._contents == _contents && ssObject.fullName == fullName; 60 object.fullName == fullName;
42 }
43 return false;
44 } 61 }
45 62
63 @override
46 bool exists() => true; 64 bool exists() => true;
47 65
48 Uri resolveRelativeUri(Uri relativeUri) => throw new UnsupportedError( 66 @override
49 "StringSource doesn't support resolveRelative."); 67 String toString() => 'StringSource ($fullName)';
50 } 68 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/src/source/source_resource.dart ('k') | packages/analyzer/lib/src/summary/api_signature.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698