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 compileNext(Node, BodyCompiler, boolean)
|
Method name: void compilePreExe(Node, BodyCompiler, boolean)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 5 | |||
1 | final NextNode nextNode = (NextNode) node;↵ | 1 | final PreExeNode preExeNode = (PreExeNode) node;↵ | |
2 | ↵ | 2 | // create the closure class and instantiate it↵ | |
3 | CompilerCallback valueCallback = new CompilerCallback() {↵ | 3 | final CompilerCallback closureBody = new CompilerCallback() {↵ | |
4 | public void call(BodyCompiler context) {↵ | 4 | public void call(BodyCompiler context) {↵ | |
5 | if (nextNode.getValueNode() != null) {↵ | 5 | if (preExeNode.getBodyNode() != null) {↵ | |
6 | compile(nextNode.getValueNode(), context,true);↵ | 6 | compile(preExeNode.getBodyNode(), context,true);↵ | |
7 | } else {↵ | 7 | } else {↵ | |
8 | context.loadNil();↵ | 8 | context.loadNil();↵ | |
9 | }↵ | 9 | }↵ | |
10 | }↵ | 10 | }↵ | |
11 | };↵ | 11 | };↵ | |
12 | context.pollThreadEvents();↵ | 12 | context.↵ | |
13 | context.issueNextEvent(valueCallback);↵ | 13 | runBeginBlock(preExeNode.getScope(), closureBody);↵ | |
14 | // TODO: don't require pop↵ | 14 | // TODO: don't require pop↵ | |
15 | if (!expr) context.consumeCurrentValue(); | 15 |
| |
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 16 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | final NextNode nextNode = (NextNode)node; |
| 1 | final PreExeNode preExeNode = (PreExeNode)node; | |||||||||||||||||||
|
| 2 | final CompilerCallback closureBody = new CompilerCallback() {...}; | ||||||||||||||||||||
2 | CompilerCallback valueCallback = new CompilerCallback() {...}; | | |||||||||||||||||||||
3 | context.pollThreadEvents(); |
| 3 | context.runBeginBlock(preExeNode.getScope(), closureBody); | |||||||||||||||||||
4 | context.issueNextEvent(valueCallback); | | |||||||||||||||||||||
5 | if (!expr) | 4 | if (!expr) | ||||||||||||||||||||
6 | context.consumeCurrentValue(); | 5 | context.consumeCurrentValue(); |
Row | Violation |
---|---|
1 | Unmatched statement final CompilerCallback closureBody=new CompilerCallback(){ public void call( BodyCompiler context){ if (preExeNode.getBodyNode() != null) { compile(preExeNode.getBodyNode(),context,true); } else { context.loadNil(); } } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression context.runBeginBlock(preExeNode.getScope(),closureBody) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression context.pollThreadEvents() is a void method call, and thus it cannot be parameterized |
4 | Expression context.runBeginBlock(preExeNode.getScope(),closureBody) is a void method call, and thus it cannot be parameterized |
5 | Expression context.runBeginBlock(preExeNode.getScope(),closureBody) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression context.pollThreadEvents() is a void method call, and thus it cannot be parameterized |
7 | Expression context.runBeginBlock(preExeNode.getScope(),closureBody) is a void method call, and thus it cannot be parameterized |
8 | Clone fragment #1 returns variable nextNode with type org.jruby.ast.NextNode , while Clone fragment #2 returns variable preExeNode with type org.jruby.ast.PreExeNode |