Search in sources :

Example 36 with ArgumentList

use of dyvilx.tools.compiler.ast.parameter.ArgumentList 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)

Example 37 with ArgumentList

use of dyvilx.tools.compiler.ast.parameter.ArgumentList in project Dyvil by Dyvil.

the class StatementList method resolveApplyStatement.

private static IValue resolveApplyStatement(MarkerList markers, IContext context, IValue resolvedValue) {
    final ArgumentList arguments = new ArgumentList(resolvedValue);
    final IValue implicitValue = context.resolveImplicit(null);
    if (implicitValue != null) {
        final IValue call = resolveApplyStatement(markers, context, arguments, implicitValue);
        if (call != null) {
            return call;
        }
    }
    return resolveApplyStatement(markers, context, arguments, null);
}
Also used : IValue(dyvilx.tools.compiler.ast.expression.IValue) ArgumentList(dyvilx.tools.compiler.ast.parameter.ArgumentList)

Aggregations

ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)37 IValue (dyvilx.tools.compiler.ast.expression.IValue)17 IType (dyvilx.tools.compiler.ast.type.IType)10 SourcePosition (dyvil.source.position.SourcePosition)8 CodeParameter (dyvilx.tools.compiler.ast.parameter.CodeParameter)7 AttributeList (dyvilx.tools.compiler.ast.attribute.AttributeList)5 ArrayExpr (dyvilx.tools.compiler.ast.expression.ArrayExpr)5 FieldAccess (dyvilx.tools.compiler.ast.expression.access.FieldAccess)5 CodeMethod (dyvilx.tools.compiler.ast.method.CodeMethod)5 IParameter (dyvilx.tools.compiler.ast.parameter.IParameter)5 Annotation (dyvilx.tools.compiler.ast.attribute.annotation.Annotation)4 ConstructorCall (dyvilx.tools.compiler.ast.expression.access.ConstructorCall)4 MarkerLevel (dyvil.util.MarkerLevel)3 MethodCall (dyvilx.tools.compiler.ast.expression.access.MethodCall)3 StringValue (dyvilx.tools.compiler.ast.expression.constant.StringValue)3 ParameterList (dyvilx.tools.compiler.ast.parameter.ParameterList)3 Marker (dyvilx.tools.parsing.marker.Marker)3 Reason (dyvil.annotation.Deprecated.Reason)2 Name (dyvil.lang.Name)2 IClass (dyvilx.tools.compiler.ast.classes.IClass)2