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 compileDSymbol(Node, BodyCompiler, boolean)
|
Method name: void compileDStr(Node, BodyCompiler, boolean)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | final DSymbolNode dsymbolNode = (DSymbolNode) node;↵ | 1 | final DStrNode dstrNode = (DStrNode) node;↵ | |
2 | ArrayCallback dstrCallback = new ArrayCallback() {↵ | 2 | ArrayCallback dstrCallback = new ArrayCallback() {↵ | |
3 | public void nextValue(BodyCompiler context, Object sourceArray,↵ | 3 | public void nextValue(BodyCompiler context, Object sourceArray,↵ | |
4 | int index) {↵ | 4 | int index) {↵ | |
5 | compile(dsymbolNode.get(index), context, true);↵ | 5 | compile(dstrNode.get(index), context, true);↵ | |
6 | }↵ | 6 | }↵ | |
7 | };↵ | 7 | };↵ | |
8 | boolean doit = expr || !RubyInstanceConfig.PEEPHOLE_OPTZ;↵ | 8 | boolean doit = expr || !RubyInstanceConfig.PEEPHOLE_OPTZ;↵ | |
9 | boolean popit = !RubyInstanceConfig.PEEPHOLE_OPTZ && !expr;↵ | 9 | boolean popit = !RubyInstanceConfig.PEEPHOLE_OPTZ && !expr;↵ | |
10 | if (doit) {↵ | 10 | if (doit) {↵ | |
11 | context.createNewSymbol(dstrCallback, dsymbolNode.size());↵ | 11 | context.createNewString(dstrCallback, dstrNode.size());↵ | |
12 | if (popit) context.consumeCurrentValue();↵ | 12 | if (popit) context.consumeCurrentValue();↵ | |
13 | } else {↵ | 13 | } else {↵ | |
14 | // not an expression, only compile the elements↵ | 14 | // not an expression, only compile the elements↵ | |
15 | for (Node nextNode : dsymbolNode.childNodes()) {↵ | 15 | for (Node nextNode : dstrNode.childNodes()) {↵ | |
16 | compile(nextNode, context, false);↵ | 16 | compile(nextNode, context, false);↵ | |
17 | }↵ | 17 | }↵ | |
18 | } | 18 |
| |
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 27 |
Number of mapped statements | 10 |
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) | 8.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | final DSymbolNode dsymbolNode = (DSymbolNode)node; |
| 1 | final DStrNode dstrNode = (DStrNode)node; | ||||||||||||||||||||
2 | ArrayCallback dstrCallback = new ArrayCallback() {...}; |
| 2 | ArrayCallback dstrCallback = new ArrayCallback() {...}; | ||||||||||||||||||||
3 | boolean doit = expr || !RubyInstanceConfig.PEEPHOLE_OPTZ; | 3 | boolean doit = expr || !RubyInstanceConfig.PEEPHOLE_OPTZ; | |||||||||||||||||||||
4 | boolean popit = !RubyInstanceConfig.PEEPHOLE_OPTZ && !expr; | 4 | boolean popit = !RubyInstanceConfig.PEEPHOLE_OPTZ && !expr; | |||||||||||||||||||||
5 | if (doit) | 5 | if (doit) | |||||||||||||||||||||
6 | context.createNewSymbol(dstrCallback, dsymbolNode.size()); |
| 6 | context.createNewString(dstrCallback, dstrNode.size()); | ||||||||||||||||||||
7 | if (popit) | 7 | if (popit) | |||||||||||||||||||||
8 | context.consumeCurrentValue(); | 8 | context.consumeCurrentValue(); | |||||||||||||||||||||
else | else | |||||||||||||||||||||||
9 | for (Node nextNode : dsymbolNode.childNodes()) |
| 9 | for (Node nextNode : dstrNode.childNodes()) | ||||||||||||||||||||
10 | compile(nextNode, context, false); | 10 | compile(nextNode, context, false); |
Row | Violation |
---|---|
1 | Expression context.createNewSymbol(dstrCallback,dsymbolNode.size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression context.createNewString(dstrCallback,dstrNode.size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression context.createNewSymbol(dstrCallback,dsymbolNode.size()) is a void method call, and thus it cannot be parameterized |
4 | Expression context.createNewString(dstrCallback,dstrNode.size()) is a void method call, and thus it cannot be parameterized |