public void SetModuleState(QualifiedModuleName module, ParserState state, SyntaxErrorException parserError = null, bool evaluateOverallState = true) { if (AllUserDeclarations.Any()) { var projectId = module.ProjectId; IVBProject project = GetProject(projectId); if (project == null) { // ghost component shouldn't even exist ClearStateCache(module); EvaluateParserState(); return; } } var oldState = GetModuleState(module); _moduleStates.AddOrUpdate(module, new ModuleState(state), (c, e) => e.SetState(state)); _moduleStates.AddOrUpdate(module, new ModuleState(parserError), (c, e) => e.SetModuleException(parserError)); Logger.Debug("Module '{0}' state is changing to '{1}' (thread {2})", module.ComponentName, state, Thread.CurrentThread.ManagedThreadId); OnModuleStateChanged(module, state, oldState); if (evaluateOverallState) { EvaluateParserState(); } }
public void SetModuleState(VBComponent component, ParserState state, SyntaxErrorException parserError = null) { if (AllUserDeclarations.Any()) { var projectId = component.Collection.Parent.HelpFile; var project = AllUserDeclarations.SingleOrDefault(item => item.DeclarationType == DeclarationType.Project && item.ProjectId == projectId); if (project == null) { // ghost component shouldn't even exist ClearStateCache(component); Status = EvaluateParserState(); return; } } var key = new QualifiedModuleName(component); _moduleStates.AddOrUpdate(key, state, (c, s) => state); _moduleExceptions.AddOrUpdate(key, parserError, (c, e) => parserError); Debug.WriteLine("Module '{0}' state is changing to '{1}' (thread {2})", key.ComponentName, state, Thread.CurrentThread.ManagedThreadId); OnModuleStateChanged(component, state); Status = EvaluateParserState(); }