if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. int start = scope.getRequiredArgs(); for (int i = start; i < scope.getNumberOfVariables(); i++) { methodCompiler.loadNil(); assignLocalVariable(i, false); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); }
if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. int start = scope.getRequiredArgs(); for (int i = start; i < scope.getNumberOfVariables(); i++) { methodCompiler.loadNil(); assignLocalVariable(i, false); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/impl/StackBasedVariableCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/impl/StackBasedVariableCompiler.java
Method name: void beginClass(CompilerCallback, StaticScope) Method name: void beginMethod(CompilerCallback, StaticScope)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (scope.getNumberOfVariables() > 0) {
1
if (scope.getNumberOfVariables() > 0) {
2
            // if we don't have opt args, start after args (they will be assigned later)
2
            // if we don't have opt args, start after args (they will be assigned later)
3
            // this is for crap like def foo(a = (b = true; 1)) which numbers b before a
3
            // this is for crap like def foo(a = (b = true; 1)) which numbers b before a
4
            // FIXME: only starting after required args, since opt args may access others
4
            // FIXME: only starting after required args, since opt args may access others
5
            // and rest args conflicts with compileRoot using "0" to indicate [] signature.
5
            // and rest args conflicts with compileRoot using "0" to indicate [] signature.
6
            int start = scope.getRequiredArgs();
6
            int start = scope.getRequiredArgs();
7
            for (int i = start; i < scope.getNumberOfVariables(); i++) {
7
            for (int i = start; i < scope.getNumberOfVariables(); i++) {
8
                methodCompiler.loadNil();
8
                methodCompiler.loadNil();
9
                assignLocalVariable(i, false);
9
                assignLocalVariable(i, false);
10
            }
10
            }
11
            // temp locals must start after last real local
11
            // temp locals must start after last real local
12
            tempVariableIndex += scope.getNumberOfVariables();
12
            tempVariableIndex += scope.getNumberOfVariables();
13
        }
13
        }
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.5
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    2
    if (scope.getNumberOfVariables() > 0)
    1
    if (scope.getNumberOfVariables() > 0)
    3
    int start = scope.getRequiredArgs();
    2
    int start = scope.getRequiredArgs();
    4
    for (int i = start; i < scope.getNumberOfVariables(); i++)
    3
    for (int i = start; i < scope.getNumberOfVariables(); i++)
    5
    methodCompiler.loadNil();
    4
    methodCompiler.loadNil();
    6
    assignLocalVariable(i, false);
    5
    assignLocalVariable(i, false);
    7
    tempVariableIndex += scope.getNumberOfVariables();
    6
    tempVariableIndex += scope.getNumberOfVariables();
    Precondition Violations (0)
    Row Violation