Class DunderOperatorImplementor
java.lang.Object
ai.timefold.jpyinterpreter.implementors.DunderOperatorImplementor
Implementations of opcodes that delegate to dunder/magic methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbinaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, PythonBinaryOperator operator) Performs a binary dunder operation on TOS and TOS1.static voidbinaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, StackMetadata stackMetadata, PythonBinaryOperator operator) static voidbinaryOperatorOnlyRight(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, PythonBinaryOperator operator) static voidcompareValues(org.objectweb.asm.MethodVisitor methodVisitor, StackMetadata stackMetadata, CompareOp op) Compares TOS and TOS1 via their dunder methods.static voidgetSlice(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidstoreSlice(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidternaryOperator(FunctionMetadata functionMetadata, StackMetadata stackMetadata, PythonTernaryOperator operator) Performs a ternary dunder operation on TOS, TOS1 and TOS2.static voidunaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, PythonUnaryOperator operator) Performs a unary dunder operation on TOS.static voidunaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, StackMetadata stackMetadata, PythonUnaryOperator operator)
-
Constructor Details
-
DunderOperatorImplementor
public DunderOperatorImplementor()
-
-
Method Details
-
unaryOperator
public static void unaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, StackMetadata stackMetadata, PythonUnaryOperator operator) -
unaryOperator
public static void unaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, PythonUnaryOperator operator) Performs a unary dunder operation on TOS. Generate codes that look like this:BiFunction[List, Map, Result] operand_method = TOS.$getType().$getAttributeOrError(operator.getDunderMethod()); List args = new ArrayList(1); args.set(0) = TOS pop TOS TOS' = operand_method.apply(args, null) -
binaryOperator
public static void binaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, StackMetadata stackMetadata, PythonBinaryOperator operator) -
binaryOperator
public static void binaryOperator(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, PythonBinaryOperator operator) Performs a binary dunder operation on TOS and TOS1. Generate codes that look like this:BiFunction[List, Map, Result] operand_method = TOS1.$getType().$getAttributeOrError(operator.getDunderMethod()); List args = new ArrayList(2); args.set(0) = TOS1 args.set(1) = TOS pop TOS, TOS1 TOS' = operand_method.apply(args, null) -
binaryOperatorOnlyRight
public static void binaryOperatorOnlyRight(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, PythonBinaryOperator operator) -
ternaryOperator
public static void ternaryOperator(FunctionMetadata functionMetadata, StackMetadata stackMetadata, PythonTernaryOperator operator) Performs a ternary dunder operation on TOS, TOS1 and TOS2. Generate codes that look like this:BiFunction[List, Map, Result] operand_method = TOS2.$getType().$getAttributeOrError(operator.getDunderMethod()); List args = new ArrayList(2); args.set(0) = TOS2 args.set(1) = TOS1 args.set(2) = TOS pop TOS, TOS1, TOS2 TOS' = operand_method.apply(args, null) -
compareValues
public static void compareValues(org.objectweb.asm.MethodVisitor methodVisitor, StackMetadata stackMetadata, CompareOp op) Compares TOS and TOS1 via their dunder methods.CompareOpindicates the operation to perform. -
getSlice
-
storeSlice
-