CppTypeResolveContext MapToNestedCompilation(CppTypeResolveContext context, ICompilation nestedCompilation) { var nestedContext = new CppTypeResolveContext(nestedCompilation.MainAssembly); if (context.CurrentUsingScope != null) { nestedContext = nestedContext.WithUsingScope(context.CurrentUsingScope.UnresolvedUsingScope.Resolve(nestedCompilation)); } if (context.CurrentTypeDefinition != null) { nestedContext = nestedContext.WithCurrentTypeDefinition(nestedCompilation.Import(context.CurrentTypeDefinition)); } return nestedContext; }
CppTypeResolveContext MapToNestedCompilation(CppTypeResolveContext context, ICompilation nestedCompilation) { var nestedContext = new CppTypeResolveContext(nestedCompilation.MainAssembly); if (context.CurrentUsingScope != null) { nestedContext = nestedContext.WithUsingScope(context.CurrentUsingScope.UnresolvedUsingScope.Resolve(nestedCompilation)); } if (context.CurrentTypeDefinition != null) { nestedContext = nestedContext.WithCurrentTypeDefinition(nestedCompilation.Import(context.CurrentTypeDefinition)); } return(nestedContext); }
internal IList <ControlFlowNode> BuildControlFlowGraph(Statement statement, Func <AstNode, CancellationToken, ResolveResult> resolver, CppTypeResolveContext 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; } }
protected CppCompletionEngineBase(IProjectContent content, CppTypeResolveContext ctx, CompilationUnit unit, CppParsedFile parsedFile) { if (content == null) { throw new ArgumentNullException("content"); } if (ctx == null) { throw new ArgumentNullException("ctx"); } if (unit == null) { throw new ArgumentNullException("unit"); } if (parsedFile == null) { throw new ArgumentNullException("parsedFile"); } this.ProjectContent = content; this.ctx = ctx; this.Unit = unit; this.CSharpParsedFile = parsedFile; }
public CppParameterCompletionEngine(IDocument document, IParameterCompletionDataFactory factory, IProjectContent content, CppTypeResolveContext ctx, CompilationUnit unit, CppParsedFile parsedFile) : base(content, ctx, unit, parsedFile) { if (document == null) { throw new ArgumentNullException("document"); } if (factory == null) { throw new ArgumentNullException("factory"); } this.document = document; this.factory = factory; }
internal static ReachabilityAnalysis Create(Statement statement, Func <AstNode, CancellationToken, ResolveResult> resolver, CppTypeResolveContext typeResolveContext, CancellationToken cancellationToken) { var cfgBuilder = new ControlFlowGraphBuilder(); var cfg = cfgBuilder.BuildControlFlowGraph(statement, resolver, typeResolveContext, cancellationToken); return(Create(cfg, cancellationToken)); }