예제 #1
0
        internal static string Rewrite(string contextName, string rawFunction, Func <string, bool> isStaticMethod)
        {
            var csu = ParseCompilationUnit(
                $"class __Temp {{ private Func<object> __prop => {rawFunction}; }}");

            var csuRewritten = new Rewriter(contextName, isStaticMethod).Visit(csu);

            return(csuRewritten
                   .DescendantNodes()
                   .OfType <ArrowExpressionClauseSyntax>()
                   .First()
                   .Expression
                   .ToFullString());
        }