internal ImmutableArray <Diagnostic> FlowDiagnostics(CSharpCompilation compilation) { var flowDiagnostics = DiagnosticBag.GetInstance(); foreach (var method in AllMethods(compilation.SourceModule.GlobalNamespace)) { var sourceSymbol = method as SourceMemberMethodSymbol; if (sourceSymbol == null) { continue; } var boundBody = MethodCompiler.BindMethodBody( sourceSymbol, new TypeCompilationState(sourceSymbol.ContainingType, compilation, null), new BindingDiagnosticBag(new DiagnosticBag()) ); if (boundBody != null) { FlowAnalysisPass.Rewrite( sourceSymbol, boundBody, flowDiagnostics, hasTrailingExpression: false, originalBodyNested: false ); } } return(flowDiagnostics.ToReadOnlyAndFree <Diagnostic>()); }
internal static BoundStatement AnalyzeMethodBody(MethodBodyCompiler methodCompiler, MethodSymbol method, BoundBlock body, DiagnosticBag diagnostics) { Debug.Assert(diagnostics != null); body = FlowAnalysisPass.Rewrite(method, body, diagnostics); var analyzedBody = (BoundBlock)RewritePass.Rewrite(methodCompiler, method.ContainingType, body); return(RewritePass.InsertPrologueSequencePoint(analyzedBody, method)); }
internal BoundStatement AnalyzeMethodBody(MethodSymbol method, BoundBlock block, bool generateDebugInfo, DiagnosticBag diagnostics) { var diagnostics2 = DiagnosticBag.GetInstance(); var analyzed1 = FlowAnalysisPass.Rewrite(method, block, diagnostics2); if (diagnostics != null) { diagnostics.Add(diagnostics2); } diagnostics2.Free(); return(RewritePass.Rewrite(analyzed1, generateDebugInfo)); }
internal ImmutableArray <Diagnostic> FlowDiagnostics(CSharpCompilation compilation) { var flowDiagnostics = DiagnosticBag.GetInstance(); foreach (var method in AllMethods(compilation.SourceModule.GlobalNamespace)) { var sourceSymbol = method as SourceMethodSymbol; if (sourceSymbol == null) { continue; } var boundBody = Compiler.BindMethodBody(sourceSymbol, new DiagnosticBag()); if (boundBody != null) { FlowAnalysisPass.Rewrite(sourceSymbol, boundBody, flowDiagnostics); } } return(flowDiagnostics.ToReadOnlyAndFree <Diagnostic>()); }