public GetModuleState ( VBComponent component ) : |
||
component | VBComponent | |
return |
private void ResolveReferences(DeclarationFinder finder, VBComponent component, IParseTree tree) { var state = _state.GetModuleState(component); if (_state.Status == ParserState.ResolverError || (state != ParserState.Parsed)) { return; } var qualifiedName = new QualifiedModuleName(component); Logger.Debug("Resolving identifier references in '{0}'... (thread {1})", qualifiedName.Name, Thread.CurrentThread.ManagedThreadId); var resolver = new IdentifierReferenceResolver(qualifiedName, finder); var listener = new IdentifierReferenceListener(resolver); if (!string.IsNullOrWhiteSpace(tree.GetText().Trim())) { var walker = new ParseTreeWalker(); try { Stopwatch watch = Stopwatch.StartNew(); walker.Walk(listener, tree); watch.Stop(); Logger.Debug("Binding Resolution done for component '{0}' in {1}ms (thread {2})", component.Name, watch.ElapsedMilliseconds, Thread.CurrentThread.ManagedThreadId); _state.RebuildSelectionCache(); state = ParserState.Ready; } catch (Exception exception) { Logger.Error(exception, "Exception thrown resolving '{0}' (thread {1}).", component.Name, Thread.CurrentThread.ManagedThreadId); state = ParserState.ResolverError; } } _state.SetModuleState(component, state); Logger.Debug("'{0}' is {1} (thread {2})", component.Name, _state.GetModuleState(component), Thread.CurrentThread.ManagedThreadId); }
protected void ResolveReferences(DeclarationFinder finder, QualifiedModuleName module, IParseTree tree, CancellationToken token) { Debug.Assert(_state.GetModuleState(module) == ParserState.ResolvingReferences || token.IsCancellationRequested); token.ThrowIfCancellationRequested(); Logger.Debug("Resolving identifier references in '{0}'... (thread {1})", module.Name, Thread.CurrentThread.ManagedThreadId); var resolver = new IdentifierReferenceResolver(module, finder); var listener = new IdentifierReferenceListener(resolver); if (!string.IsNullOrWhiteSpace(tree.GetText().Trim())) { var walker = new ParseTreeWalker(); try { var watch = Stopwatch.StartNew(); walker.Walk(listener, tree); watch.Stop(); Logger.Debug("Binding resolution done for component '{0}' in {1}ms (thread {2})", module.Name, watch.ElapsedMilliseconds, Thread.CurrentThread.ManagedThreadId); //Evaluation of the overall status has to be defered to allow processing of undeclared variables before setting the ready state. _parserStateManager.SetModuleState(module, ParserState.Ready, token, false); } catch (OperationCanceledException) { throw; //We do not want to set an error state if the exception was just caused by some cancellation. } catch (Exception exception) { Logger.Error(exception, "Exception thrown resolving '{0}' (thread {1}).", module.Name, Thread.CurrentThread.ManagedThreadId); _parserStateManager.SetModuleState(module, ParserState.ResolverError, token); } } }
public ParserState GetModuleState(QualifiedModuleName module) { return(_state.GetModuleState(module)); }