compile(andNode.getFirstNode(), context, true); BranchCallback longCallback = new BranchCallback() { public void branch(BodyCompiler context) { compile(andNode.getSecondNode(), context, true); } }; context.performLogicalAnd(longCallback); if (!expr) context.consumeCurrentValue();
compile(orNode.getFirstNode(), context, true); BranchCallback longCallback = new BranchCallback() { public void branch(BodyCompiler context) { compile(orNode.getSecondNode(), context, true); } }; context.performLogicalOr(longCallback); // TODO: don't require pop if (!expr) context.consumeCurrentValue();
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java
Method name: void compileAnd(Node, BodyCompiler, boolean) Method name: void compileOr(Node, BodyCompiler, boolean)
Number of AST nodes: 5 Number of AST nodes: 5
1
compile(andNode.getFirstNode(), context, true);
1
compile(orNode.getFirstNode(), context, true);
2
            BranchCallback longCallback = new BranchCallback() {
2
            BranchCallback longCallback = new BranchCallback() {
3
                        public void branch(BodyCompiler context) {
3
                        public void branch(BodyCompiler context) {
4
                            compile(andNode.getSecondNode(), context, true);
4
                            compile(orNode.getSecondNode(), context, true);
5
                        }
5
                        }
6
                    };
6
                    };
7
            context.performLogicalAnd(longCallback);
7
            context.performLogicalOr(longCallback);
8
            // TODO: don't require pop
8
            if (!expr) context.consumeCurrentValue();
9
            if (!expr) context.consumeCurrentValue();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.7
Clones locationClones are declared in the same class
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    compile(andNode.getFirstNode(), context, true);
    7
    compile(andNode.getFirstNode(), context, true);
    7
    compile(orNode.getFirstNode(), context, true);
    Differences
    Expression1Expression2Difference
    andNodeorNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.AndNodeorg.jruby.ast.OrNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression andNode cannot be unified with expression orNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getFirstNode()
    7
    compile(orNode.getFirstNode(), context, true);
    8
    BranchCallback longCallback = new BranchCallback() {...};
    8
    BranchCallback longCallback = new BranchCallback() {...};
    8
    BranchCallback longCallback = new BranchCallback() {...};
    Differences
    Expression1Expression2Difference
    andNodeorNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.AndNodeorg.jruby.ast.OrNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression andNode cannot be unified with expression orNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getSecondNode()
    8
    BranchCallback longCallback = new BranchCallback() {...};
    9
    context.performLogicalAnd(longCallback);
    9
    context.performLogicalAnd(longCallback);
    9
    context.performLogicalOr(longCallback);
    Differences
    Expression1Expression2Difference
    performLogicalAndperformLogicalOrMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression context.performLogicalAnd(longCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.performLogicalOr(longCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.performLogicalAnd(longCallback) is a void method call, and thus it cannot be parameterized
    Expression context.performLogicalOr(longCallback) is a void method call, and thus it cannot be parameterized
    9
    context.performLogicalOr(longCallback);
    10
    if (!expr)
    10
    if (!expr)
    11
    context.consumeCurrentValue();
    11
    context.consumeCurrentValue();
    Precondition Violations (6)
    Row Violation
    1Expression andNode cannot be unified with expression orNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getFirstNode()
    2Expression andNode cannot be unified with expression orNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getSecondNode()
    3Expression context.performLogicalAnd(longCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression context.performLogicalOr(longCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression context.performLogicalAnd(longCallback) is a void method call, and thus it cannot be parameterized
    6Expression context.performLogicalOr(longCallback) is a void method call, and thus it cannot be parameterized