Class Constructor
java.lang.Object
org.spongepowered.asm.mixin.injection.struct.Target
org.spongepowered.asm.mixin.injection.struct.Constructor
- All Implemented Interfaces:
Comparable<Target>,Iterable<org.objectweb.asm.tree.AbstractInsnNode>
A
Target which is a constructor-
Nested Class Summary
Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.struct.Target
Target.Extension -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor(ClassInfo classInfo, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode method) -
Method Summary
Modifier and TypeMethodDescriptionFind the call to super() or this() in a constructor.org.objectweb.asm.tree.AbstractInsnNodeFind the injection pointorg.objectweb.asm.tree.AbstractInsnNodeFind 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.booleanGet 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, wrapNodeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Constructor
public Constructor(ClassInfo classInfo, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode method)
-
-
Method Details
-
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
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
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
-