anchor.diff:    }
   
     Future disposeProjectAnalyzer(Project project) {
  -    ProjectAnalyzer context = _contextMap.remove(project);
  -
  -    Completer completer = _contextCompleters.remove(project);
  -    if (!completer.isCompleted) {
  -      completer.completeError('context deleted before construction finished');
  -    }
  -
  -    if (context != null) {
  +    Completer completer = _contextCompleters[project];
  +
  +    return completer.future.then((ProjectAnalyzer context) {
         _logger.info('disposed analysis context [${project.name}]');
   
  -      _recentContexts.remove(context);
  -      return _sendAction('disposeContext', {'contextId': project.uuid});
  -    } else {
  -      return new Future.value();
  -    }
  +      if (_recentContexts.indexOf(context) >= MAX_CONTEXTS) {
  +        _recentContexts.remove(context);
  +        _contextCompleters.remove(completer);
  +
  +        return _sendAction('disposeContext', {'contextId': project.uuid});
  +      }
  +    });
     }
   
     PackageManager getPackageManager() => services._packageManager;
  
positive.code:       _contextCompleters.containsKey(project);
  
    Future<ProjectAnalyzer> getCreateProjectAnalyzer(Project project) {
      ProjectAnalyzer context = _contextMap[project];
      Completer completer = _contextCompleters[project];
  
      if (completer == null) {
  
negative.code:   }
  
    Future<ProjectAnalyzer> _createProjectAnalyzer(Project project) {
      _logger.info('creating analysis context [${project.name}]');
      Stopwatch timer = new Stopwatch()..start();
  
      ProjectAnalyzer context = new ProjectAnalyzer._(this, project);
      _recentContexts.insert(0, context);
  
      if (_recentContexts.length > MAX_CONTEXTS) {
  