private AlCompletionContext(ITextEditor editor, IList <string> conditionalSymbols, ICompilation compilation, IProjectContent projectContent, IDocument document, AlUnresolvedFile unresolvedFile, TextLocation caretLocation) { Debug.Assert(editor != null); Debug.Assert(unresolvedFile != null); Debug.Assert(compilation != null); Debug.Assert(projectContent != null); Debug.Assert(document != null); this.Editor = editor; this.Document = document; this.ConditionalSymbols = conditionalSymbols; this.Compilation = compilation; this.ProjectContent = projectContent; this.TypeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(compilation, caretLocation); this.CompletionContextProvider = new DefaultCompletionContextProvider(document, unresolvedFile); this.CompletionContextProvider.ConditionalSymbols.AddRange(conditionalSymbols); }
internal IList <ControlFlowNode> BuildControlFlowGraph(Statement statement, Func <AstNode, CancellationToken, ResolveResult> resolver, AlTypeResolveContext typeResolveContext, CancellationToken cancellationToken) { NodeCreationVisitor nodeCreationVisitor = new NodeCreationVisitor(); nodeCreationVisitor.builder = this; try { this.nodes = new List <ControlFlowNode>(); this.labels = new Dictionary <string, ControlFlowNode>(); this.gotoStatements = new List <ControlFlowNode>(); this.rootStatement = statement; this.resolver = resolver; this.typeResolveContext = typeResolveContext; this.cancellationToken = cancellationToken; ControlFlowNode entryPoint = CreateStartNode(statement); statement.AcceptVisitor(nodeCreationVisitor, entryPoint); // Resolve goto statements: foreach (ControlFlowNode gotoStmt in gotoStatements) { string label = ((GotoStatement)gotoStmt.NextStatement).Label; ControlFlowNode labelNode; if (labels.TryGetValue(label, out labelNode)) { nodeCreationVisitor.Connect(gotoStmt, labelNode, ControlFlowEdgeType.Jump); } } AnnotateLeaveEdgesWithTryFinallyBlocks(); return(nodes); } finally { this.nodes = null; this.labels = null; this.gotoStatements = null; this.rootStatement = null; this.resolver = null; this.typeResolveContext = null; this.cancellationToken = CancellationToken.None; } }
public AlParameterCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, IParameterCompletionDataFactory factory, IProjectContent content, AlTypeResolveContext ctx) : base(content, completionContextProvider, ctx) { if (document == null) { throw new ArgumentNullException("document"); } if (factory == null) { throw new ArgumentNullException("factory"); } this.document = document; this.factory = factory; }
protected AlCompletionEngineBase(IProjectContent content, ICompletionContextProvider completionContextProvider, AlTypeResolveContext ctx) { if (content == null) { throw new ArgumentNullException("content"); } if (ctx == null) { throw new ArgumentNullException("ctx"); } if (completionContextProvider == null) { throw new ArgumentNullException("completionContextProvider"); } AlCompletionEngine.LoadBaseType(content); this.ProjectContent = content; this.CompletionContextProvider = completionContextProvider; this.ctx = ctx; }
internal static ReachabilityAnalysis Create(Statement statement, Func <AstNode, CancellationToken, ResolveResult> resolver, AlTypeResolveContext typeResolveContext, CancellationToken cancellationToken) { var cfgBuilder = new ControlFlowGraphBuilder(); var cfg = cfgBuilder.BuildControlFlowGraph(statement, resolver, typeResolveContext, cancellationToken); return(Create(cfg, null, cancellationToken)); }