Don't pass rewritten body to the method compiler.

上级 d4195ec5
......@@ -1651,15 +1651,16 @@ internal static BoundBlock BindMethodBody(MethodSymbol method, TypeCompilationSt
bodyBinder.ValidateIteratorMethods(diagnostics);
BoundNode methodBody = bodyBinder.BindMethodBody(syntaxNode, diagnostics);
BoundNode methodBodyForSemanticModel = methodBody;
if (bodyBinder.Compilation.NullableSemanticAnalysisEnabled)
{
// Currently, we're passing an empty DiagnosticBag here because the flow analysis pass later will
// also run the nullable walker, and issue duplicate warnings. We should try to only run the pass
// once.
// https://github.com/dotnet/roslyn/issues/35041
methodBody = NullableWalker.AnalyzeAndRewrite(bodyBinder.Compilation, method, methodBody, bodyBinder, new DiagnosticBag(), createSnapshots: true, out snapshotManager);
methodBodyForSemanticModel = NullableWalker.AnalyzeAndRewrite(bodyBinder.Compilation, method, methodBody, bodyBinder, new DiagnosticBag(), createSnapshots: true, out snapshotManager);
}
forSemanticModel = (syntaxNode, methodBody, bodyBinder, snapshotManager);
forSemanticModel = (syntaxNode, methodBodyForSemanticModel, bodyBinder, snapshotManager);
switch (methodBody.Kind)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册