Exemple #1
0
    private void AddModifyingCall(ApiCall apiCall, MethodCall methodCall)
    {
        if (RemoveRedundantModifyingCalls)
        {
            var before = Evaluate(apiCall, UseDefaultFormatting);
            apiCall.Add(methodCall);
            var after = Evaluate(apiCall, UseDefaultFormatting);
            if (before == after)
            {
                apiCall.Remove(methodCall);
            }

            return;
        }

        apiCall.Add(methodCall);
    }
Exemple #2
0
    /// <summary>
    /// Given the input C# syntax node <paramref name="node"/> returns the C# source code of
    /// Roslyn API calls that recreate the syntax node.
    /// </summary>
    /// <param name="sourceText">A C# syntax node</param>
    /// <returns>A C# expression that describes calls to the Roslyn syntax API necessary to recreate
    /// the input syntax node.</returns>
    internal string Quote(SyntaxNode node)
    {
        ApiCall rootApiCall = Quote(node, name: null);

        if (UseDefaultFormatting)
        {
            rootApiCall.Add(new MethodCall {
                Name = ".NormalizeWhitespace"
            });
        }

        string generatedCode = Print(rootApiCall);

        return(generatedCode);
    }
Exemple #3
0
    private void AddModifyingCall(ApiCall apiCall, MethodCall methodCall)
    {
        // TODO: this needs scripting
        ////if (RemoveRedundantModifyingCalls)
        ////{
        ////    var before = Evaluate(apiCall, UseDefaultFormatting);
        ////    apiCall.Add(methodCall);
        ////    var after = Evaluate(apiCall, UseDefaultFormatting);
        ////    if (before == after)
        ////    {
        ////        apiCall.Remove(methodCall);
        ////    }
        ////}

        apiCall.Add(methodCall);
        return;
    }
Exemple #4
0
    private void AddModifyingCall(ApiCall apiCall, MethodCall methodCall)
    {
        // TODO: this needs scripting
        ////if (RemoveRedundantModifyingCalls)
        ////{
        ////    var before = Evaluate(apiCall, UseDefaultFormatting);
        ////    apiCall.Add(methodCall);
        ////    var after = Evaluate(apiCall, UseDefaultFormatting);
        ////    if (before == after)
        ////    {
        ////        apiCall.Remove(methodCall);
        ////    }
        ////}

        apiCall.Add(methodCall);
        return;
    }
Exemple #5
0
    private void AddModifyingCall(ApiCall apiCall, MethodCall methodCall)
    {
        if (RemoveRedundantModifyingCalls)
        {
            var before = Evaluate(apiCall, UseDefaultFormatting);
            apiCall.Add(methodCall);
            var after = Evaluate(apiCall, UseDefaultFormatting);
            if (before == after)
            {
                apiCall.Remove(methodCall);
            }

            return;
        }

        apiCall.Add(methodCall);
    }