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

Side by Side Diff: pkg/analysis_server/lib/src/resource.dart

Issue 300023004: Partial implementation of the 'setAnalysisRoots' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 6 years, 7 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 | Annotate | Revision Log
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 resource; 5 library resource;
6 6
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
10 import 'package:analyzer/src/generated/java_io.dart'; 10 import 'package:analyzer/src/generated/java_io.dart';
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 * An in-memory implementation of [Source]. 151 * An in-memory implementation of [Source].
152 */ 152 */
153 class _MemoryFileSource implements Source { 153 class _MemoryFileSource implements Source {
154 final _MemoryFile _file; 154 final _MemoryFile _file;
155 155
156 final UriKind uriKind; 156 final UriKind uriKind;
157 157
158 _MemoryFileSource(this._file, this.uriKind); 158 _MemoryFileSource(this._file, this.uriKind);
159 159
160 @override 160 @override
161 bool operator ==(other) {
162 if (other is _MemoryFileSource) {
163 return other._file == _file;
164 }
165 return false;
166 }
167
168 @override
161 TimestampedData<String> get contents { 169 TimestampedData<String> get contents {
162 return new TimestampedData<String>(modificationStamp, _file._content); 170 return new TimestampedData<String>(modificationStamp, _file._content);
163 } 171 }
164 172
165 @override 173 @override
166 String get encoding { 174 String get encoding {
167 return '${new String.fromCharCode(uriKind.encoding)}${_file.fullName}'; 175 return '${new String.fromCharCode(uriKind.encoding)}${_file.fullName}';
168 } 176 }
169 177
170 @override 178 @override
171 bool exists() => _file.exists; 179 bool exists() => _file.exists;
172 180
173 @override 181 @override
174 String get fullName => _file.fullName; 182 String get fullName => _file.fullName;
175 183
176 @override 184 @override
185 int get hashCode => _file.hashCode;
186
187 @override
177 bool get isInSystemLibrary => false; 188 bool get isInSystemLibrary => false;
178 189
179 @override 190 @override
180 int get modificationStamp => _file._timestamp; 191 int get modificationStamp => _file._timestamp;
181 192
182 @override 193 @override
183 Source resolveRelative(Uri relativeUri) { 194 Source resolveRelative(Uri relativeUri) {
184 String relativePath = fromUri(relativeUri); 195 String relativePath = fromUri(relativeUri);
185 String folderPath = dirname(_file._path); 196 String folderPath = dirname(_file._path);
186 String path = join(folderPath, relativePath); 197 String path = join(folderPath, relativePath);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 Resource getResource(String path) { 383 Resource getResource(String path) {
373 if (io.FileSystemEntity.isDirectorySync(path)) { 384 if (io.FileSystemEntity.isDirectorySync(path)) {
374 io.Directory directory = new io.Directory(path); 385 io.Directory directory = new io.Directory(path);
375 return new _PhysicalFolder(directory); 386 return new _PhysicalFolder(directory);
376 } else { 387 } else {
377 io.File file = new io.File(path); 388 io.File file = new io.File(path);
378 return new _PhysicalFile(file); 389 return new _PhysicalFile(file);
379 } 390 }
380 } 391 }
381 } 392 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/lib/src/socket_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698