Programming-Language-Design / src / ast / expression / classes / FunctionInvocation.java
FunctionInvocation.java
Raw
package ast.expression.classes;

import ast.expression.AbstractExpression;
import ast.expression.Expression;
import ast.statement.Statement;
import visitor.Visitor;

import java.util.ArrayList;
import java.util.List;

public class FunctionInvocation extends AbstractExpression implements Statement {

    List<Expression> arguments;
    Variable functionName;

    public FunctionInvocation(int line, int column, Variable functionName, List<Expression> arguments) {
        super(line, column);
        this.arguments = new ArrayList<>(arguments);
        this.functionName = functionName;
    }

    public List<Expression> getArguments() {
        return arguments;
    }

    public Variable getFunctionName() {
        return functionName;
    }

    @Override
    public String toString() {
        return getFunctionName() + "(" + getArguments() + ")";
    }

    @Override
    public <TP, TR> TR accept(Visitor<TP, TR> v, TP param) {
        return v.visit(this, param);
    }
}