Class BeforeLoadLocal
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.InjectionPoint
-
- org.spongepowered.asm.mixin.injection.modify.BeforeLoadLocal
-
- Direct Known Subclasses:
AfterStoreLocal
public class BeforeLoadLocal extends InjectionPoint
This injection point is a companion for the
ModifyVariableinjector which searches for LOAD operations which match the local variables described by the injector's defined discriminators.This allows you consumers to specify an injection immediately before a local variable is accessed in a method. Specify an ordinal of n to match the n + 1th access of the variable in question.
- ordinal
- The ordinal position of the LOAD opcode for the matching local variable to search for, if not specified then the injection point returns all opcodes for which the parent annotation's discriminators match. The default value is -1 which supresses ordinal checking.
Example:
@ModifyVariable( method = "md", ordinal = 1, at = @At( value = "LOAD", ordinal = 0 ) )Note that if value is the only parameter specified, it can be omitted:
@At("LOAD")
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
InjectionPoint.AtCode, InjectionPoint.Flags, InjectionPoint.RestrictTargetLevel, InjectionPoint.Specifier
-
-
Field Summary
Fields Modifier and Type Field Description protected LocalVariableDiscriminatordiscriminatorDiscriminator, parsed from parent annotationprotected IMixinContextmixinprotected intopcodeTarget opcode, inflected from return typeprotected intordinalTarget ordinalprotected org.objectweb.asm.TypereturnTypeReturn type of the handler, also the type of the local variable we're interested in-
Fields inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBeforeLoadLocal(InjectionPointData data)protectedBeforeLoadLocal(InjectionPointData data, int opcode, boolean opcodeAfter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMessage(java.lang.String format, java.lang.Object... args)Notify method for subclasses to log when notable but non-fatal failures occur, for example allows subclasses to add notes when they return no results.booleanfind(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)Find injection points in the supplied insn listjava.lang.StringtoString()java.lang.StringtoString(LocalVariableDiscriminator.Context context)-
Methods inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
after, and, before, checkPriority, getAtCode, getId, getSlice, getSpecifier, getTargetRestriction, nextNode, or, parse, parse, parse, parse, parse, parse, parse, parse, register, register, setTargetRestriction, shift
-
-
-
-
Field Detail
-
returnType
protected final org.objectweb.asm.Type returnType
Return type of the handler, also the type of the local variable we're interested in
-
discriminator
protected final LocalVariableDiscriminator discriminator
Discriminator, parsed from parent annotation
-
opcode
protected final int opcode
Target opcode, inflected from return type
-
ordinal
protected final int ordinal
Target ordinal
-
mixin
protected final IMixinContext mixin
-
-
Constructor Detail
-
BeforeLoadLocal
protected BeforeLoadLocal(InjectionPointData data)
-
BeforeLoadLocal
protected BeforeLoadLocal(InjectionPointData data, int opcode, boolean opcodeAfter)
-
-
Method Detail
-
addMessage
protected void addMessage(java.lang.String format, java.lang.Object... args)Description copied from class:InjectionPointNotify method for subclasses to log when notable but non-fatal failures occur, for example allows subclasses to add notes when they return no results.- Overrides:
addMessagein classInjectionPoint- Parameters:
format- Message formatargs- Format args
-
toString
public java.lang.String toString()
- Overrides:
toStringin classInjectionPoint
-
toString
public java.lang.String toString(LocalVariableDiscriminator.Context context)
-
find
public boolean find(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)Description copied from class:InjectionPointFind injection points in the supplied insn list- Specified by:
findin classInjectionPoint- Parameters:
desc- Method descriptor, supplied to allow return types and arguments etc. to be determinedinsns- Insn list to search in, the strategy MUST ONLY add nodes from this list to thenodescollectionnodes- Collection of nodes to populate. Injectors should NOT make any assumptions about the state of this collection and should only call the add() method- Returns:
- true if one or more injection points were found
-
-