Exemplo n.º 1
0
 protected override SyntaxNode OnVisitMethodDeclaration(MethodDeclarationSyntax node)
 {
     _retunTypeSyntax = !_methodResult.Symbol.ReturnsVoid ? node.ReturnType : null;
     if (!_methodResult.Faulted &&
         (
             (_methodResult.Symbol.ReturnsVoid && node.IsReturnStatementRequired()) ||
             _methodResult.WrapInTryCatch
         )
         )
     {
         node = node.ConvertExpressionBodyToBlock(_transformResult);
     }
     node = (MethodDeclarationSyntax)base.OnVisitMethodDeclaration(node);
     if (node.GetFunctionBody() is BlockSyntax blockBody)
     {
         if (_methodResult is IMethodOrAccessorAnalyzationResult analyzationResult)
         {
             return(node.WithBody(RewriteMethodBody(node, blockBody, analyzationResult)));
         }
         return(node.WithBody(RewriteFunctionBody(blockBody)));
     }
     return(node);
 }