@@ -71,14 +71,14 @@ public static Builder builder() {
71
71
* @param node the {@link MethodNode} to search
72
72
* @return the InsnSequence object representing the matched pattern
73
73
*/
74
- public InsnSequence find (MethodNode node ) {
75
- return find (this .reverse ? node .instructions .getLast () : node .instructions .getFirst ());
74
+ public InsnList find (MethodNode node ) {
75
+ return this . find (this .reverse ? node .instructions .getLast () : node .instructions .getFirst ());
76
76
}
77
77
78
78
/**
79
79
* Tries to match the given pattern starting from a given node.
80
80
* @param node the node to start the search on
81
- * @return the {@link InsnSequence } object representing the matched pattern
81
+ * @return the {@link InsnList } object representing the matched pattern
82
82
*/
83
83
public InsnSequence find (AbstractInsnNode node ) {
84
84
if (node != null ) {
@@ -285,6 +285,11 @@ private static boolean matchList(
285
285
return true ;
286
286
}
287
287
288
+ private static final BiPredicate <Object , Object > COMPARE_LABELS = (p , ex ) -> {
289
+ LabelNode expected = (LabelNode ) ex ;
290
+ return expected .equals (p ) || expected .getLabel ().equals (p );
291
+ };
292
+
288
293
/**
289
294
* Tests whether a given {@link AbstractInsnNode} matches the given opcode and arguments.
290
295
* @param i the node to test
@@ -382,16 +387,12 @@ && matchList(1, args, lookup.keys.toArray(), false, Object::equals)
382
387
case AbstractInsnNode .TABLESWITCH_INSN :
383
388
if (args .length < 4 ) return false ;
384
389
TableSwitchInsnNode tab = (TableSwitchInsnNode ) i ;
385
- BiPredicate <Object , Object > compareLabels = (p , ex ) -> {
386
- LabelNode expected = (LabelNode ) ex ;
387
- return expected .equals (p ) || expected .getLabel ().equals (p );
388
- };
389
390
return args [0 ] instanceof Integer
390
391
&& tab .min == (Integer ) args [0 ]
391
392
&& args [1 ] instanceof Integer
392
393
&& tab .min == (Integer ) args [1 ]
393
- && compareLabels .test (args [2 ], tab .dflt )
394
- && matchList (3 , args , tab .labels .toArray (), true , compareLabels );
394
+ && COMPARE_LABELS .test (args [2 ], tab .dflt )
395
+ && matchList (3 , args , tab .labels .toArray (), true , COMPARE_LABELS );
395
396
case AbstractInsnNode .VAR_INSN :
396
397
return args .length == 1
397
398
&& ((VarInsnNode ) i ).var == (Integer ) args [0 ];
0 commit comments