IRubyObject receiver = receiverNode.interpret(runtime, context, self, block); if (argsNode == null) { // attribute set. RuntimeHelpers.invoke(context, receiver, name, value, CallType.NORMAL, Block.NULL_BLOCK); } else { // element set RubyArray args = (RubyArray) argsNode.interpret(runtime, context, self, block); args.append(value); RuntimeHelpers.invoke(context, receiver, name, args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK); } return runtime.getNil();
IRubyObject receiver = receiverNode.interpret(runtime, context, self, block); if (argsNode == null) { // attribute set. RuntimeHelpers.invoke(context, receiver, getName(), new IRubyObject[] {value}, CallType.NORMAL, Block.NULL_BLOCK); } else { // element set RubyArray args = (RubyArray)argsNode.interpret(runtime, context, self, block); args.append(value); RuntimeHelpers.invoke(context, receiver, getName(), args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK); } return runtime.getNil();
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ast/AttrAssignNode.java File path: /jruby-1.4.0/src/org/jruby/ast/CallNode.java
Method name: IRubyObject otherAssign(Ruby, ThreadContext, IRubyObject, IRubyObject, Block, boolean) Method name: IRubyObject assign(Ruby, ThreadContext, IRubyObject, IRubyObject, Block, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
IRubyObject receiver = receiverNode.interpret(runtime, context, self, block);
1
IRubyObject receiver = receiverNode.interpret(runtime, context, self, block);
2
        if (argsNode == null) { // attribute set.
2
        if (argsNode == null) { // attribute set.
3
            RuntimeHelpers.invoke(context, receiver, name, value, CallType.NORMAL, Block.NULL_BLOCK);
3
            RuntimeHelpers.invoke(context, receiver, getName(), new IRubyObject[] {value}, CallType.NORMAL, Block.NULL_BLOCK);
4
        } else { // element set
4
        } else { // element set
5
            RubyArray args = (RubyArray) argsNode.interpret(runtime, context, self, block);
5
            RubyArray args = (RubyArray)argsNode.interpret(runtime, context, self, block);
6
            args.append(value);
6
            args.append(value);
7
            RuntimeHelpers.invoke(context, receiver, name, args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK);
7
            RuntimeHelpers.invoke(context, receiver, getName(), args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK);
8
        } 
8
        }
9
        
9
        
10
        return runtime.getNil();
10
        return runtime.getNil();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons29
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    IRubyObject receiver = receiverNode.interpret(runtime, context, self, block);
    1
    IRubyObject receiver = receiverNode.interpret(runtime, context, self, block);
    2
    if (argsNode == null)
    2
    if (argsNode == null)
                                                                                                                                                                                                                                  
    3
    RuntimeHelpers.invoke(context, receiver, getName(), new IRubyObject[] {value}, CallType.NORMAL, Block.NULL_BLOCK);
    3
    RuntimeHelpers.invoke(context, receiver, name, value, CallType.NORMAL, Block.NULL_BLOCK);
                                                                                                                                                                                  
    else
    else
    4
    RubyArray args = (RubyArray)argsNode.interpret(runtime, context, self, block);
    4
    RubyArray args = (RubyArray)argsNode.interpret(runtime, context, self, block);
    5
    args.append(value);
    5
    args.append(value);
    6
    RuntimeHelpers.invoke(context, receiver, name, args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK);
    6
    RuntimeHelpers.invoke(context, receiver, name, args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK);
    6
    RuntimeHelpers.invoke(context, receiver, getName(), args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK);
    Differences
    Expression1Expression2Difference
    namegetName()TYPE_COMPATIBLE_REPLACEMENT
    6
    RuntimeHelpers.invoke(context, receiver, getName(), args.toJavaArray(), CallType.NORMAL, Block.NULL_BLOCK);
    7
    return runtime.getNil();
    7
    return runtime.getNil();
    Precondition Violations (0)
    Row Violation