mirror of
https://github.com/zaaarf/lillero.git
synced 2024-11-12 18:49:23 +01:00
fix: fixed ignore flags in PatternMatcher
This commit is contained in:
parent
752c7ae6ab
commit
dd09c4f8e1
1 changed files with 7 additions and 10 deletions
|
@ -78,24 +78,21 @@ public class PatternMatcher {
|
|||
*/
|
||||
public InsnSequence find(AbstractInsnNode node) {
|
||||
if(node != null) {
|
||||
AbstractInsnNode first;
|
||||
AbstractInsnNode last;
|
||||
AbstractInsnNode first, last;
|
||||
for(AbstractInsnNode cur = node; cur != null; cur = reverse ? cur.getPrevious() : cur.getNext()) {
|
||||
if(ignoreLabels && cur.getType() == AbstractInsnNode.LABEL) continue;
|
||||
if(ignoreFrames && cur.getType() == AbstractInsnNode.FRAME) continue;
|
||||
if(ignoreLineNumbers && cur.getType() == AbstractInsnNode.LINE) continue;
|
||||
if(predicates.size() == 0)
|
||||
return new InsnSequence(cur); //match whatever
|
||||
if(predicates.size() == 0) return new InsnSequence(cur); //match whatever
|
||||
first = cur;
|
||||
last = cur;
|
||||
for(int match = 0; match < predicates.size(); match++) {
|
||||
for(int match = 0; match < predicates.size(); last = reverse ? last.getPrevious() : last.getNext()) {
|
||||
if(ignoreLabels && cur.getType() == AbstractInsnNode.LABEL) continue;
|
||||
if(ignoreFrames && cur.getType() == AbstractInsnNode.FRAME) continue;
|
||||
if(ignoreLineNumbers && cur.getType() == AbstractInsnNode.LINE) continue;
|
||||
if(last == null) break;
|
||||
if(!predicates.get(match).test(last)) break;
|
||||
if(match == predicates.size() - 1) {
|
||||
if(reverse) return new InsnSequence(last, first); //we are matching backwards
|
||||
else return new InsnSequence(first, last);
|
||||
}
|
||||
last = reverse ? last.getPrevious() : last.getNext();
|
||||
} else match++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue