Returns true if this expr matches 'that'. Two exprs match if: 1. The tree structures ignoring implicit casts are the same. 2. For every pair of corresponding SlotRefs, slotRefCmp.matches() returns true. 3. For every pair of corresponding non-SlotRef exprs, localEquals() returns true.
(Expr that, SlotRef.Comparator slotRefCmp)
| 1009 | * 3. For every pair of corresponding non-SlotRef exprs, localEquals() returns true. |
| 1010 | */ |
| 1011 | public boolean matches(Expr that, SlotRef.Comparator slotRefCmp) { |
| 1012 | if (that == null) return false; |
| 1013 | if (this instanceof CastExpr && ((CastExpr)this).isImplicit()) { |
| 1014 | return children_.get(0).matches(that, slotRefCmp); |
| 1015 | } |
| 1016 | if (that instanceof CastExpr && ((CastExpr)that).isImplicit()) { |
| 1017 | return matches(((CastExpr) that).children_.get(0), slotRefCmp); |
| 1018 | } |
| 1019 | if (this instanceof SlotRef && that instanceof SlotRef) { |
| 1020 | return slotRefCmp.matches((SlotRef)this, (SlotRef)that); |
| 1021 | } |
| 1022 | if (!localEquals(that)) return false; |
| 1023 | if (children_.size() != that.children_.size()) return false; |
| 1024 | for (int i = 0; i < children_.size(); ++i) { |
| 1025 | if (!children_.get(i).matches(that.children_.get(i), slotRefCmp)) return false; |
| 1026 | } |
| 1027 | return true; |
| 1028 | } |
| 1029 | |
| 1030 | /** |
| 1031 | * Local eq comparator. Returns true if this expr is equal to 'that' ignoring children. |
no test coverage detected