Class Constructor
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.struct.Target
-
- org.spongepowered.asm.mixin.injection.struct.Constructor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.struct.Target
Target.Extension
-
-
Constructor Summary
Constructors Constructor Description Constructor(ClassInfo classInfo, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode method)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Bytecode.DelegateInitialiserfindDelegateInitNode()Find the call to super() or this() in a constructor.org.objectweb.asm.tree.AbstractInsnNodefindFirstBodyInsn()Find the injection pointorg.objectweb.asm.tree.AbstractInsnNodefindInitialiserInjectionPoint(Initialiser.InjectionMode mode)Find the injection point for injected initialiser insns in the target ctor.static InsnRangegetRange(org.objectweb.asm.tree.MethodNode ctor)Identifies line numbers in the supplied ctor which correspond to the start and end of the method body.voidinspect(Initialiser initialiser)Inspect an incoming initialiser to determine which fields are touched by the mixin.booleanisInjectable()Get whether this constructor should have mixin initialisers injected into it based on whether a delegate initialiser call is absent or is a call to super()-
Methods inherited from class org.spongepowered.asm.mixin.injection.struct.Target
addInjectionNode, addLocalVariable, addLocalVariable, allocateLocal, allocateLocals, compareTo, extendLocals, extendStack, findInitNodeFor, findInitNodeFor, generateArgMap, generateArgMap, get, getArgIndices, getCallbackDescriptor, getCallbackDescriptor, getCallbackInfoClass, getCurrentMaxLocals, getCurrentMaxStack, getDesc, getInjectionNode, getMaxLocals, getMaxStack, getName, getSignature, getSimpleCallbackDescriptor, indexOf, indexOf, insert, insert, insert, insert, insertBefore, insertBefore, insertBefore, insertBefore, iterator, of, removeNode, replaceNode, replaceNode, replaceNode, toString, wrapNode
-
-
-
-
Constructor Detail
-
Constructor
public Constructor(ClassInfo classInfo, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode method)
-
-
Method Detail
-
findDelegateInitNode
public Bytecode.DelegateInitialiser findDelegateInitNode()
Find the call to super() or this() in a constructor. This attempts to locate the first call to <init> which isn't an inline call to another object ctor being passed into the super invocation.- Returns:
- Call to super(), this() or DelegateInitialiser.NONE if not found
-
isInjectable
public boolean isInjectable()
Get whether this constructor should have mixin initialisers injected into it based on whether a delegate initialiser call is absent or is a call to super()
-
inspect
public void inspect(Initialiser initialiser)
Inspect an incoming initialiser to determine which fields are touched by the mixin. This is then used infindInitialiserInjectionPoint(org.spongepowered.asm.mixin.transformer.struct.Initialiser.InjectionMode)to determine the instruction after which the mixin initialisers will be placed- Parameters:
initialiser- the initialiser to inspect
-
findInitialiserInjectionPoint
public org.objectweb.asm.tree.AbstractInsnNode findInitialiserInjectionPoint(Initialiser.InjectionMode mode)
Find the injection point for injected initialiser insns in the target ctor. This starts by assuming that initialiser instructions should be placed immediately after the delegate initialiser call, but then searches for field assignments and selects the last unique field assignment in the ctor body which represents a reasonable heuristic for the end of the existing initialisers.- Parameters:
mode- Injection mode for this specific environment- Returns:
- target node
-
findFirstBodyInsn
public org.objectweb.asm.tree.AbstractInsnNode findFirstBodyInsn()
Find the injection point
-
getRange
public static InsnRange getRange(org.objectweb.asm.tree.MethodNode ctor)
Identifies line numbers in the supplied ctor which correspond to the start and end of the method body.- Parameters:
ctor- constructor to scan- Returns:
- range indicating the line numbers of the specified constructor and the position of the superclass ctor invocation
-
-