All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.llamalad7.mixinextras.expression.impl.ast.expressions.ThisExpression Maven / Gradle / Ivy

package com.llamalad7.mixinextras.expression.impl.ast.expressions;

import com.llamalad7.mixinextras.expression.impl.ExpressionSource;
import com.llamalad7.mixinextras.expression.impl.flow.FlowValue;
import com.llamalad7.mixinextras.expression.impl.point.ExpressionContext;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.VarInsnNode;

public class ThisExpression extends SimpleExpression {
    public ThisExpression(ExpressionSource src) {
        super(src);
    }

    @Override
    public boolean matches(FlowValue node, ExpressionContext ctx) {
        if (ctx.isStatic) {
            return false;
        }
        return node.getInsn().getOpcode() == Opcodes.ALOAD && ((VarInsnNode) node.getInsn()).var == 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy