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

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

Issue 692073004: Issue 21506. Fix for adding back previously excluded resources in sub-folders. (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
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 context.directory.manager; 5 library context.directory.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 * Resursively adds all Dart and HTML files to the [changeSet]. 232 * Resursively adds all Dart and HTML files to the [changeSet].
233 */ 233 */
234 void _addPreviouslyExcludedSources(_ContextInfo info, ChangeSet changeSet, 234 void _addPreviouslyExcludedSources(_ContextInfo info, ChangeSet changeSet,
235 Folder folder, List<String> oldExcludedPaths) { 235 Folder folder, List<String> oldExcludedPaths) {
236 if (info.excludesResource(folder)) { 236 if (info.excludesResource(folder)) {
237 return; 237 return;
238 } 238 }
239 List<Resource> children = folder.getChildren(); 239 List<Resource> children = folder.getChildren();
240 for (Resource child in children) { 240 for (Resource child in children) {
241 String path = child.path; 241 String path = child.path;
242 // ignore if wasn't previously excluded
243 bool wasExcluded =
244 _isExcludedBy(oldExcludedPaths, path) &&
245 !_isExcludedBy(excludedPaths, path);
246 if (!wasExcluded) {
247 continue;
248 }
249 // add files, recurse into folders 242 // add files, recurse into folders
250 if (child is File) { 243 if (child is File) {
251 if (_shouldFileBeAnalyzed(child)) { 244 // ignore if should not be analyzed at all
252 Source source = child.createSource(); 245 if (!_shouldFileBeAnalyzed(child)) {
253 changeSet.addedSource(source); 246 continue;
254 info.sources[path] = source;
255 } 247 }
248 // ignore if was not excluded
249 bool wasExcluded =
250 _isExcludedBy(oldExcludedPaths, path) &&
251 !_isExcludedBy(excludedPaths, path);
252 if (!wasExcluded) {
253 continue;
254 }
255 // do add the file
256 Source source = child.createSource();
257 changeSet.addedSource(source);
258 info.sources[path] = source;
256 } else if (child is Folder) { 259 } else if (child is Folder) {
257 if (child.shortName == PACKAGES_NAME) { 260 if (child.shortName == PACKAGES_NAME) {
258 continue; 261 continue;
259 } 262 }
260 _addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths); 263 _addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths);
261 } 264 }
262 } 265 }
263 } 266 }
264 267
265 /** 268 /**
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 return excludes(resource.path); 650 return excludes(resource.path);
648 } 651 }
649 652
650 /** 653 /**
651 * Returns `true` if [path] is the pubspec file of this context. 654 * Returns `true` if [path] is the pubspec file of this context.
652 */ 655 */
653 bool isPubspec(String path) { 656 bool isPubspec(String path) {
654 return path == pubspecPath; 657 return path == pubspecPath;
655 } 658 }
656 } 659 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698