ai.timefold.jpyinterpreter.opcodes.collection.ContainsOpcode Maven / Gradle / Ivy
package ai.timefold.jpyinterpreter.opcodes.collection;
import ai.timefold.jpyinterpreter.FunctionMetadata;
import ai.timefold.jpyinterpreter.PythonBytecodeInstruction;
import ai.timefold.jpyinterpreter.StackMetadata;
import ai.timefold.jpyinterpreter.ValueSourceInfo;
import ai.timefold.jpyinterpreter.implementors.CollectionImplementor;
import ai.timefold.jpyinterpreter.opcodes.AbstractOpcode;
import ai.timefold.jpyinterpreter.types.BuiltinTypes;
public class ContainsOpcode extends AbstractOpcode {
public ContainsOpcode(PythonBytecodeInstruction instruction) {
super(instruction);
}
@Override
protected StackMetadata getStackMetadataAfterInstruction(FunctionMetadata functionMetadata, StackMetadata stackMetadata) {
return stackMetadata.pop(2).push(ValueSourceInfo.of(this, BuiltinTypes.BOOLEAN_TYPE,
stackMetadata.getValueSourcesUpToStackIndex(2)));
}
@Override
public void implement(FunctionMetadata functionMetadata, StackMetadata stackMetadata) {
CollectionImplementor.containsOperator(functionMetadata.methodVisitor, stackMetadata, instruction);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy