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

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

Issue 303413003: Don't add files inside "packages" subdir to context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | 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:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 /** 74 /**
75 * Instances of the class [ResourceProvider] convert [String] paths into 75 * Instances of the class [ResourceProvider] convert [String] paths into
76 * [Resource]s. 76 * [Resource]s.
77 */ 77 */
78 abstract class ResourceProvider { 78 abstract class ResourceProvider {
79 /** 79 /**
80 * Return the [Resource] that corresponds to the given [path]. 80 * Return the [Resource] that corresponds to the given [path].
81 */ 81 */
82 Resource getResource(String path); 82 Resource getResource(String path);
83
84 /**
85 * Get the path context used by this resource provider.
86 */
87 Context get pathContext;
83 } 88 }
84 89
85 90
86 /** 91 /**
87 * An in-memory implementation of [Resource]. 92 * An in-memory implementation of [Resource].
88 */ 93 */
89 abstract class _MemoryResource implements Resource { 94 abstract class _MemoryResource implements Resource {
90 final MemoryResourceProvider _provider; 95 final MemoryResourceProvider _provider;
91 final String path; 96 final String path;
92 97
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 345 }
341 } 346 }
342 347
343 void deleteFile(String path) { 348 void deleteFile(String path) {
344 _checkFileAtPath(path); 349 _checkFileAtPath(path);
345 _pathToResource.remove(path); 350 _pathToResource.remove(path);
346 _pathToContent.remove(path); 351 _pathToContent.remove(path);
347 _pathToTimestamp.remove(path); 352 _pathToTimestamp.remove(path);
348 _notifyWatchers(path, ChangeType.REMOVE); 353 _notifyWatchers(path, ChangeType.REMOVE);
349 } 354 }
355
356 @override
357 Context get pathContext => posix;
350 } 358 }
351 359
352 360
353 /** 361 /**
354 * A `dart:io` based implementation of [File]. 362 * A `dart:io` based implementation of [File].
355 */ 363 */
356 class _PhysicalFile extends _PhysicalResource implements File { 364 class _PhysicalFile extends _PhysicalResource implements File {
357 _PhysicalFile(io.File file) : super(file); 365 _PhysicalFile(io.File file) : super(file);
358 366
359 @override 367 @override
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 @override 443 @override
436 Resource getResource(String path) { 444 Resource getResource(String path) {
437 if (io.FileSystemEntity.isDirectorySync(path)) { 445 if (io.FileSystemEntity.isDirectorySync(path)) {
438 io.Directory directory = new io.Directory(path); 446 io.Directory directory = new io.Directory(path);
439 return new _PhysicalFolder(directory); 447 return new _PhysicalFolder(directory);
440 } else { 448 } else {
441 io.File file = new io.File(path); 449 io.File file = new io.File(path);
442 return new _PhysicalFile(file); 450 return new _PhysicalFile(file);
443 } 451 }
444 } 452 }
453
454 @override
455 Context get pathContext => io.Platform.isWindows ? windows : posix;
445 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698