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

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

Issue 996773002: Fix NPE in ContextManager (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analyzer/file_system/file_system.dart'; 11 import 'package:analyzer/file_system/file_system.dart';
12 import 'package:analyzer/instrumentation/instrumentation.dart'; 12 import 'package:analyzer/instrumentation/instrumentation.dart';
13 import 'package:analyzer/source/package_map_provider.dart'; 13 import 'package:analyzer/source/package_map_provider.dart';
14 import 'package:analyzer/source/package_map_resolver.dart'; 14 import 'package:analyzer/source/package_map_resolver.dart';
15 import 'package:analyzer/src/generated/engine.dart'; 15 import 'package:analyzer/src/generated/engine.dart';
16 import 'package:analyzer/src/generated/java_io.dart'; 16 import 'package:analyzer/src/generated/java_io.dart';
17 import 'package:analyzer/src/generated/source.dart'; 17 import 'package:analyzer/src/generated/source.dart';
18 import 'package:analyzer/src/generated/source_io.dart'; 18 import 'package:analyzer/src/generated/source_io.dart';
19 import 'package:path/path.dart' as pathos; 19 import 'package:path/path.dart' as pathos;
20 import 'package:watcher/watcher.dart'; 20 import 'package:watcher/watcher.dart';
21 import 'package:analyzer/src/generated/java_engine.dart';
21 22
22 /** 23 /**
23 * The name of `packages` folders. 24 * The name of `packages` folders.
24 */ 25 */
25 const String PACKAGES_NAME = 'packages'; 26 const String PACKAGES_NAME = 'packages';
26 27
27 /** 28 /**
28 * File name of pubspec files. 29 * File name of pubspec files.
29 */ 30 */
30 const String PUBSPEC_NAME = 'pubspec.yaml'; 31 const String PUBSPEC_NAME = 'pubspec.yaml';
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 _addSourceFiles(changeSet, folder, info); 451 _addSourceFiles(changeSet, folder, info);
451 applyChangesToContext(folder, changeSet); 452 applyChangesToContext(folder, changeSet);
452 return info; 453 return info;
453 } 454 }
454 455
455 /** 456 /**
456 * Clean up and destroy the context associated with the given folder. 457 * Clean up and destroy the context associated with the given folder.
457 */ 458 */
458 void _destroyContext(Folder folder) { 459 void _destroyContext(Folder folder) {
459 _contexts[folder].changeSubscription.cancel(); 460 _contexts[folder].changeSubscription.cancel();
461 removeContext(folder);
460 _contexts.remove(folder); 462 _contexts.remove(folder);
461 removeContext(folder);
462 } 463 }
463 464
464 /** 465 /**
465 * Extract a new [pubspecFile]-based context from [oldInfo]. 466 * Extract a new [pubspecFile]-based context from [oldInfo].
466 */ 467 */
467 void _extractContext(_ContextInfo oldInfo, File pubspecFile) { 468 void _extractContext(_ContextInfo oldInfo, File pubspecFile) {
468 Folder newFolder = pubspecFile.parent; 469 Folder newFolder = pubspecFile.parent;
469 _ContextInfo newInfo = _createContext(newFolder, pubspecFile, []); 470 _ContextInfo newInfo = _createContext(newFolder, pubspecFile, []);
470 newInfo.parent = oldInfo; 471 newInfo.parent = oldInfo;
471 // prepare sources to extract 472 // prepare sources to extract
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 return excludes(resource.path); 749 return excludes(resource.path);
749 } 750 }
750 751
751 /** 752 /**
752 * Returns `true` if [path] is the pubspec file of this context. 753 * Returns `true` if [path] is the pubspec file of this context.
753 */ 754 */
754 bool isPubspec(String path) { 755 bool isPubspec(String path) {
755 return path == pubspecPath; 756 return path == pubspecPath;
756 } 757 }
757 } 758 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698