Package org.stianloader.micromixin.transform.internal.util.locals

## 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 class` | `ArgumentCaptureContext.ArgumentType` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `appendCaptures​(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.ArgumentType` | `getType​(java.util.List<org.objectweb.asm.tree.AnnotationNode>[] invisibileParameterAnnotations, int argumentIndex)` |
    `static ArgumentCaptureContext` | `parseModifyHandler​(org.objectweb.asm.tree.ClassNode owner, org.objectweb.asm.tree.MethodNode mixinSource, java.lang.String annotationName)` | Parses the captured arguments for annotation handlers such as `ModifyConstant` or `ModifyReturnValue`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 as `ModifyConstant` or `ModifyReturnValue`.

      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 using `ArgumentCaptureContext` at all. They most likely have their own dedicated infrastructure as such or have clear technical reasons to not do so (as is the case for `overlaying 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` - The `ClassNode` in which the modify handler is located in.
        `mixinSource` - The `MethodNode` which 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 thrown `MixinParseException`).
      Returns:
        The `ArgumentCaptureContext` instance that corresponds to the `MethodNode's` signature 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)