Skip to content

Commit

Permalink
Minor refactor for slice host
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumfrey committed Jan 30, 2017
1 parent d794ae7 commit 9fd488c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@
*/
public interface ISliceContext extends IInjectionPointContext {

public abstract MethodSlice getSlice(String id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.spongepowered.asm.lib.tree.InsnList;
import org.spongepowered.asm.lib.tree.MethodNode;
import org.spongepowered.asm.mixin.injection.InjectionPoint;
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo;
import org.spongepowered.asm.mixin.injection.struct.Target;

/**
Expand All @@ -42,7 +41,7 @@ public class InjectorTarget {
/**
* Owner injector
*/
private final InjectionInfo info;
private final ISliceContext context;

/**
* Cache of slices
Expand All @@ -57,11 +56,11 @@ public class InjectorTarget {
/**
* ctor
*
* @param info owner
* @param context owner
* @param target target
*/
public InjectorTarget(InjectionInfo info, Target target) {
this.info = info;
public InjectorTarget(ISliceContext context, Target target) {
this.context = context;
this.target = target;
}

Expand All @@ -88,7 +87,7 @@ public MethodNode getMethod() {
public InsnList getSlice(String id) {
ReadOnlyInsnList slice = this.cache.get(id);
if (slice == null) {
MethodSlice sliceInfo = this.info.getSlice(id);
MethodSlice sliceInfo = this.context.getSlice(id);
if (sliceInfo != null) {
slice = sliceInfo.getSlice(this.target.method);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ public Collection<MethodNode> getTargets() {
/**
* Get the slice descriptors
*/
@Override
public MethodSlice getSlice(String id) {
return this.slices.get(this.getSliceId(id));
}
Expand Down

0 comments on commit 9fd488c

Please sign in to comment.