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

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

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
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.string_source;
6 6
7 import 'generated/engine.dart' show TimestampedData;
7 import 'generated/source.dart'; 8 import 'generated/source.dart';
8 import 'generated/engine.dart' show TimestampedData;
9 9
10 /// An implementation of [Source] that's based on an in-memory Dart string. 10 /// An implementation of [Source] that's based on an in-memory Dart string.
11 class StringSource implements Source { 11 class StringSource implements Source {
12 final String _contents; 12 final String _contents;
13 final String fullName; 13 final String fullName;
14 final int modificationStamp; 14 final int modificationStamp;
15 15
16 StringSource(this._contents, this.fullName) 16 StringSource(this._contents, this.fullName)
17 : modificationStamp = new DateTime.now().millisecondsSinceEpoch; 17 : modificationStamp = new DateTime.now().millisecondsSinceEpoch;
18 18
19 bool operator==(Object object) { 19 TimestampedData<String> get contents =>
20 new TimestampedData(modificationStamp, _contents);
21
22 String get encoding =>
23 throw new UnsupportedError("StringSource doesn't support " "encoding.");
24
25 int get hashCode => _contents.hashCode ^ fullName.hashCode;
26
27 bool get isInSystemLibrary => false;
28
29 String get shortName => fullName;
30
31 @override
32 Uri get uri =>
33 throw new UnsupportedError("StringSource doesn't support uri.");
34
35 UriKind get uriKind =>
36 throw new UnsupportedError("StringSource doesn't support " "uriKind.");
37
38 bool operator ==(Object object) {
20 if (object is StringSource) { 39 if (object is StringSource) {
21 StringSource ssObject = object; 40 StringSource ssObject = object;
22 return ssObject._contents == _contents && ssObject.fullName == fullName; 41 return ssObject._contents == _contents && ssObject.fullName == fullName;
23 } 42 }
24 return false; 43 return false;
25 } 44 }
26 45
27 bool exists() => true; 46 bool exists() => true;
28 47
29 TimestampedData<String> get contents => new TimestampedData(modificationStamp, _contents); 48 Uri resolveRelativeUri(Uri relativeUri) =>
30 49 throw new UnsupportedError("StringSource doesn't support resolveRelative." );
31 String get encoding => throw new UnsupportedError("StringSource doesn't suppor t "
32 "encoding.");
33
34 String get shortName => fullName;
35
36 UriKind get uriKind => throw new UnsupportedError("StringSource doesn't suppor t "
37 "uriKind.");
38
39 int get hashCode => _contents.hashCode ^ fullName.hashCode;
40
41 bool get isInSystemLibrary => false;
42
43 @override
44 Uri get uri => throw new UnsupportedError(
45 "StringSource doesn't support uri.");
46
47 Uri resolveRelativeUri(Uri relativeUri) => throw new UnsupportedError(
48 "StringSource doesn't support resolveRelative.");
49 } 50 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_general.dart ('k') | pkg/analyzer/lib/src/task/task_dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698