Class ArgumentCaptureContext
- java.lang.Object
-
- org.stianloader.micromixin.transform.internal.util.locals.ArgumentCaptureContext
-
public class ArgumentCaptureContext extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArgumentCaptureContext.ArgumentType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendCaptures(org.objectweb.asm.tree.ClassNode targetNode, org.objectweb.asm.tree.MethodNode targetMethod, MixinMethodStub sourceStub, org.objectweb.asm.tree.AbstractInsnNode selectedInjectionPointInsn, org.objectweb.asm.tree.InsnList output)static ArgumentCaptureContext.ArgumentTypegetType(java.util.List<org.objectweb.asm.tree.AnnotationNode>[] invisibileParameterAnnotations, int argumentIndex)static ArgumentCaptureContextparseModifyHandler(org.objectweb.asm.tree.ClassNode owner, org.objectweb.asm.tree.MethodNode mixinSource, java.lang.String annotationName)Parses the captured arguments for annotation handlers such asModifyConstantorModifyReturnValue.
-
-
-
Method Detail
-
getType
@NotNull public static ArgumentCaptureContext.ArgumentType getType(java.util.List<org.objectweb.asm.tree.AnnotationNode>[] invisibileParameterAnnotations, int argumentIndex)
-
parseModifyHandler
@NotNull public static ArgumentCaptureContext parseModifyHandler(@NotNull org.objectweb.asm.tree.ClassNode owner, @NotNull org.objectweb.asm.tree.MethodNode mixinSource, @NotNull java.lang.String annotationName)
Parses the captured arguments for annotation handlers such asModifyConstantorModifyReturnValue.This method has the added benefit of also checking whether the non-captured argument matches the return type, as would be expected from these modify handlers. Due to this restriction this method is not meant to be used for redirect handlers or other annotations such as @WrapOperation. Meanwhile other annotations (mainly
@Inject) do not support processing argument and local capture usingArgumentCaptureContextat all. They most likely have their own dedicated infrastructure as such or have clear technical reasons to not do so (as is the case foroverlaying annotations).Although this method does not account for MixinExtras' @Local annotation at this point in time, this class - and as such this method - is engineered to easily account for it in due time.
- Parameters:
owner- TheClassNodein which the modify handler is located in.mixinSource- TheMethodNodewhich is the modify handler's source (as opposed to the target method, which is irrelevant)annotationName- The name of the annotation that invoked this method. For debugging reasons only (this string is added to a thrownMixinParseException).- Returns:
- The
ArgumentCaptureContextinstance that corresponds to theMethodNode'ssignature with whom the insertion of argument and local capture can be more easily pulled off without having dedicated implementations for every annotation.
-
appendCaptures
public void appendCaptures(@NotNull org.objectweb.asm.tree.ClassNode targetNode, @NotNull org.objectweb.asm.tree.MethodNode targetMethod, @NotNull MixinMethodStub sourceStub, @NotNull org.objectweb.asm.tree.AbstractInsnNode selectedInjectionPointInsn, @NotNull org.objectweb.asm.tree.InsnList output)
-
-