Search in sources :

Example 11 with ZenType

use of stanhebben.zenscript.type.ZenType in project ZenScript by CraftTweaker.

the class TypeExpansion method compileAnyUnary.

public boolean compileAnyUnary(MethodOutput output, OperatorType type, IEnvironmentMethod environment) {
    for (ZenNativeOperator operator : unaryOperators) {
        if (operator.getOperator() == type) {
            ZenType returnType = operator.getMethod().getReturnType();
            output.loadObject(0);
            operator.getMethod().invokeStatic(output);
            output.invokeStatic(returnType.getAnyClassName(environment), "valueOf", "(" + returnType.getSignature() + ")" + ZenType.ANY.getSignature());
            output.returnObject();
            return true;
        }
    }
    return false;
}
Also used : ZenType(stanhebben.zenscript.type.ZenType)

Aggregations

ZenType (stanhebben.zenscript.type.ZenType)11 Expression (stanhebben.zenscript.expression.Expression)3 ParsedExpression (stanhebben.zenscript.parser.expression.ParsedExpression)3 IPartialExpression (stanhebben.zenscript.expression.partial.IPartialExpression)2 Token (stanhebben.zenscript.parser.Token)2 Annotation (java.lang.annotation.Annotation)1 Method (java.lang.reflect.Method)1 ClassWriter (org.objectweb.asm.ClassWriter)1 Label (org.objectweb.asm.Label)1 Type (org.objectweb.asm.Type)1 Statement (stanhebben.zenscript.statements.Statement)1 SymbolArgument (stanhebben.zenscript.symbols.SymbolArgument)1 CastingRuleDelegateStaticMethod (stanhebben.zenscript.type.casting.CastingRuleDelegateStaticMethod)1 CastingRuleStaticMethod (stanhebben.zenscript.type.casting.CastingRuleStaticMethod)1 CastingRuleVirtualMethod (stanhebben.zenscript.type.casting.CastingRuleVirtualMethod)1 MethodOutput (stanhebben.zenscript.util.MethodOutput)1 ZenPosition (stanhebben.zenscript.util.ZenPosition)1