ShowAmbigTreesDialog.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:intellij-plugin-v4 作者:
public static void markFromRoots(final PreviewInterpreterRuleContext t, final PreviewInterpreterRuleContext u) {
    if ( t==null || u==null ) return;
    if ( !t.equals(u) ) return;
    t.reached = true;
    u.reached = true;
    int n = Math.min(t.getChildCount(), u.getChildCount());
    for (int i = 0; i<n; i++) { // for each leaf of t and u
        Tree tchild = t.getChild(i);
        Tree uchild = u.getChild(i);
        if ( !tchild.equals(uchild) ) {
            return; // don't consider other kids if ith doesn't match
        }
        if ( tchild instanceof PreviewInterpreterRuleContext &&
            uchild instanceof PreviewInterpreterRuleContext ) {
            markFromRoots((PreviewInterpreterRuleContext) tchild,
                          (PreviewInterpreterRuleContext) uchild);
        }
        else {
            return; // mismatched kids. should be caught above but...
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号