CSharpTypeResolveContext MapToNestedCompilation(CSharpTypeResolveContext context, ICompilation nestedCompilation) { var nestedContext = new CSharpTypeResolveContext(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; }
public CSharpParameterCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, IParameterCompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext 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 CSharpCompletionEngineBase(IProjectContent content, ICompletionContextProvider completionContextProvider, CSharpTypeResolveContext ctx) { if (content == null) { throw new ArgumentNullException("content"); } if (ctx == null) { throw new ArgumentNullException("ctx"); } if (completionContextProvider == null) { throw new ArgumentNullException("completionContextProvider"); } this.ProjectContent = content; this.CompletionContextProvider = completionContextProvider; this.ctx = ctx; }
public static bool CanTransformToExtensionMethodCall(CSharpTypeResolveContext resolveContext, InvocationExpression invocationExpression) { return(CanTransformToExtensionMethodCall(new CSharpResolver(resolveContext), invocationExpression, out _, out _, out _)); }
internal IList <ControlFlowNode> BuildControlFlowGraph(Statement statement, Func <AstNode, CancellationToken, ResolveResult> resolver, CSharpTypeResolveContext 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 CSharpCompletionDataFactory(CSharpTypeResolveContext contextAtCaret, CSharpCompletionContext context) { Debug.Assert(contextAtCaret != null); this.contextAtCaret = contextAtCaret; this.context = context; }
public CSharpParameterCompletionEngine(IDocument document, IParameterCompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx, CompilationUnit unit, CSharpParsedFile 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, CSharpTypeResolveContext typeResolveContext, CancellationToken cancellationToken) { var cfgBuilder = new ControlFlowGraphBuilder(); var cfg = cfgBuilder.BuildControlFlowGraph(statement, resolver, typeResolveContext, cancellationToken); return(Create(cfg, null, cancellationToken)); }