Search in sources :

Example 6 with StringValue

use of dyvilx.tools.compiler.ast.expression.constant.StringValue 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

StringValue (dyvilx.tools.compiler.ast.expression.constant.StringValue)6 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)3 SourcePosition (dyvil.source.position.SourcePosition)1 StringInterpolationExpr (dyvilx.tools.compiler.ast.expression.StringInterpolationExpr)1 ConstructorCall (dyvilx.tools.compiler.ast.expression.access.ConstructorCall)1 FieldAccess (dyvilx.tools.compiler.ast.expression.access.FieldAccess)1 IntValue (dyvilx.tools.compiler.ast.expression.constant.IntValue)1 IDataMember (dyvilx.tools.compiler.ast.field.IDataMember)1 PackageDeclaration (dyvilx.tools.compiler.ast.header.PackageDeclaration)1