org.qbicc.graph.VaArg Maven / Gradle / Ivy
package org.qbicc.graph;
import java.util.Objects;
import org.qbicc.type.ValueType;
import org.qbicc.type.definition.element.ExecutableElement;
/**
* A fetch of a variable argument from an argument list.
*/
public final class VaArg extends AbstractValue implements OrderedNode {
private final Node dependency;
private final ValueType type;
private final Value vaList;
VaArg(Node callSite, ExecutableElement element, int line, int bci, Node dependency, Value vaList, ValueType type) {
super(callSite, element, line, bci);
this.dependency = dependency;
this.type = type;
this.vaList = vaList;
}
@Override
int calcHashCode() {
return Objects.hash(dependency, type, vaList);
}
@Override
String getNodeName() {
return "VaArg";
}
@Override
public boolean equals(final Object other) {
return other instanceof VaArg va && equals(va);
}
public boolean equals(final VaArg other) {
return this == other || other != null
&& dependency.equals(other.dependency)
&& type.equals(other.type)
&& vaList.equals(other.vaList);
}
@Override
public Node getDependency() {
return dependency;
}
@Override
public ValueType getType() {
return type;
}
public Value getVaList() {
return vaList;
}
@Override
public int getValueDependencyCount() {
return 1;
}
@Override
public Value getValueDependency(int index) throws IndexOutOfBoundsException {
return index == 0 ? vaList : Util.throwIndexOutOfBounds(index);
}
@Override
public StringBuilder toString(StringBuilder b) {
super.toString(b);
b.append('(');
vaList.toReferenceString(b);
b.append(',');
type.toString(b);
b.append(')');
return b;
}
@Override
public R accept(final ValueVisitor visitor, final T param) {
return visitor.visit(param, this);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy