File path: /jruby-1.4.0/src/org/jruby/parser/BlockStaticScope.java | File path: /jruby-1.4.0/src/org/jruby/parser/LocalStaticScope.java | |||
Method name: Node declare(ISourcePosition, String, int)
|
Method name: Node declare(ISourcePosition, String, int)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | int slot = exists(name);↵ | 1 | int slot = exists(name);↵ | |
2 | ↵ | 2 | ↵ | |
3 | if (slot >= 0) {↵ | 3 | if (slot >= 0) {↵ | |
4 | // mark as captured if from containing scope↵ | 4 | // mark as captured if from containing scope↵ | |
5 | if (depth > 0) capture(slot);↵ | 5 | if (depth > 0) capture(slot);↵ | |
6 | ↵ | 6 | ↵ | |
7 | //System.out.println("LVAR: " + name + ", l: " + depth + ", i: " + slot);↵ | |||
7 | return new DVarNode(position, ((depth << 16) | slot), name);↵ | 8 | return new LocalVarNode(position, ((depth << 16) | slot), name);↵ | |
8 | }↵ | 9 | }↵ | |
9 | ↵ | 10 | ↵ | |
10 | return enclosingScope.declare(position, name, depth + 1); | 11 | return new VCallNode(position, name); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 12 |
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.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | int slot = exists(name); | 1 | int slot = exists(name); | |||||||||||||
2 | if (slot >= 0) | 2 | if (slot >= 0) | |||||||||||||
3 | if (depth > 0) | 3 | if (depth > 0) | |||||||||||||
4 | capture(slot); | 4 | capture(slot); | |||||||||||||
5 | return new DVarNode(position, ((depth << 16) | slot), name); |
| 5 | return new LocalVarNode(position, ((depth << 16) | slot), name); | ||||||||||||
6 | return enclosingScope.declare(position, name, depth + 1); |
| 6 | return new VCallNode(position, name); |
Row | Violation |
---|---|
1 | Expression new DVarNode(position,((depth << 16) | slot),name) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new LocalVarNode(position,((depth << 16) | slot),name) cannot be parameterized, because it has dependencies to/from statements that will be extracted |