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 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 18 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 1 |
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(); |
Row | Violation |
---|