Search in sources :

Example 1 with IntValue

use of dyvilx.tools.compiler.ast.expression.constant.IntValue in project Dyvil by Dyvil.

the class EnumConstant method resolve.

@Override
public void resolve(MarkerList markers, IContext context) {
    final ArgumentList arguments = new ArgumentList(new StringValue(this.name.unqualified), new IntValue(this.index));
    if (this.value != null) {
        if (this.value.valueTag() == IValue.TUPLE) {
            arguments.addAll(((TupleExpr) this.value).getValues());
        } else {
            arguments.add(this.value);
        }
    }
    this.value = new ConstructorCall(this.position, this.enclosingClass.getClassType(), arguments);
    super.resolve(markers, context);
}
Also used : ArgumentList(dyvilx.tools.compiler.ast.parameter.ArgumentList) StringValue(dyvilx.tools.compiler.ast.expression.constant.StringValue) ConstructorCall(dyvilx.tools.compiler.ast.expression.access.ConstructorCall) IntValue(dyvilx.tools.compiler.ast.expression.constant.IntValue)

Aggregations

ConstructorCall (dyvilx.tools.compiler.ast.expression.access.ConstructorCall)1 IntValue (dyvilx.tools.compiler.ast.expression.constant.IntValue)1 StringValue (dyvilx.tools.compiler.ast.expression.constant.StringValue)1 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)1