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 compileBreak(Node, BodyCompiler, boolean)
|
Method name: void compilePostExe(Node, BodyCompiler, boolean)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | final BreakNode breakNode = (BreakNode) node;↵ | 1 | final PostExeNode postExeNode = (PostExeNode) 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 (breakNode.getValueNode() != null) {↵ | 5 | if (postExeNode.getBodyNode() != null) {↵ | |
6 | compile(breakNode.getValueNode(), context, true);↵ | 6 | compile(postExeNode.getBodyNode(), context, true);↵ | |
7 | } else {↵ | 7 | } else {↵ | |
8 | context.loadNil();↵ | 8 | context.loadNil();↵ | |
9 | }↵ | 9 | }↵ | |
10 | }↵ | 10 | }↵ | |
11 | };↵ | 11 | };↵ | |
12 | context.issueBreakEvent(valueCallback);↵ | 12 | context.createNewEndBlock(closureBody);↵ | |
13 | // TODO: don't require pop↵ | 13 | // TODO: don't require pop↵ | |
14 | if (!expr) context.consumeCurrentValue(); | 14 |
| |
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 | 13 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 4.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | final BreakNode breakNode = (BreakNode)node; |
| 1 | final PostExeNode postExeNode = (PostExeNode)node; | |||||||||||||||||||
|
| 2 | final CompilerCallback closureBody = new CompilerCallback() {...}; | ||||||||||||||||||||
2 | CompilerCallback valueCallback = new CompilerCallback() {...}; |
| | ||||||||||||||||||||
3 | context.issueBreakEvent(valueCallback); |
| 3 | context.createNewEndBlock(closureBody); | |||||||||||||||||||
4 | if (!expr) | 4 | if (!expr) | ||||||||||||||||||||
5 | context.consumeCurrentValue(); | 5 | context.consumeCurrentValue(); |
Row | Violation |
---|---|
1 | Unmatched statement final CompilerCallback closureBody=new CompilerCallback(){ public void call( BodyCompiler context){ if (postExeNode.getBodyNode() != null) { compile(postExeNode.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 | Unmatched statement CompilerCallback valueCallback=new CompilerCallback(){ public void call( BodyCompiler context){ if (breakNode.getValueNode() != null) { compile(breakNode.getValueNode(),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 |
3 | Expression context.issueBreakEvent(valueCallback) is a void method call, and thus it cannot be parameterized |
4 | Expression context.createNewEndBlock(closureBody) is a void method call, and thus it cannot be parameterized |
5 | Clone fragment #1 returns variable breakNode with type org.jruby.ast.BreakNode , while Clone fragment #2 returns variable postExeNode with type org.jruby.ast.PostExeNode |