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

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

public class FieldAccess extends AbstractExpression {

    Expression value;
    String field;

    public FieldAccess(int line, int column, Expression value, String field) {
        super(line, column);
        this.value = value;
        this.field = field;
    }

    public Expression getValue() {
        return value;
    }

    public void setValue(Expression value) {
        this.value = value;
    }

    public String getField() {
        return field;
    }

    @Override
    public String toString() {
        return getValue() + "." + getField();
    }

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