SUnitTranslator.TranslateMethodCall C# (CSharp) Method

TranslateMethodCall() public static method

public static TranslateMethodCall ( Statement, statement ) : SUnit
statement Statement,
return Swummary.SUnit
    public static SUnit TranslateMethodCall(Statement statement)
    {
        var expressions = statement.GetExpressions();

        // Give an empty SUnit if statement has no expressions.
        if (expressions.Count() == 0)
        {
            return new SUnit(SUnitType.SingleMethodCall, "", "", "", new List<string>(), "void");
        }

        // Build a minimal method context and declaration node required by SWUM.
        var exp = expressions.First();
        string type = exp.ResolveType().ToString();
        MethodContext mc = new MethodContext(type);
        MethodDeclarationNode mdn = new MethodDeclarationNode(exp.ToString(), mc);

        // Apply the SWUM to our statement
        var swumRule = SetupBaseVerbRule();
        swumRule.InClass(mdn);
        swumRule.ConstructSwum(mdn);

        // Build and return SUnit from the SWUM
        SUnit sunit = new SUnit();
        sunit.action = GetAction(mdn);
        sunit.theme = GetTheme(mdn);
        sunit.args = GetArgs(mdn);

        return sunit;
    }