File path: /jruby-1.4.0/src/org/jruby/RubyEnumerable.java | File path: /jruby-1.4.0/src/org/jruby/RubyEnumerable.java | |||
Method name: IRubyObject sort(ThreadContext, IRubyObject, Block)
|
Method name: IRubyObject to_a19(ThreadContext, IRubyObject, IRubyObject[])
|
|||
Number of AST nodes: 5 | Number of AST nodes: 4 | |||
1 | Ruby runtime = context.getRuntime();↵ | 1 | Ruby runtime = context.getRuntime();↵ | |
2 | RubyArray result = runtime.newArray();↵ | 2 | RubyArray result = runtime.newArray();↵ | |
3 | callEach(runtime, context, self, new AppendBlockCallback(runtime, result));↵ | 3 | ↵ | |
4 | result.sort_bang(context, block);↵ | |||
5 | ↵ | 4 | RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(), ↵ | |
5 | Arity.OPTIONAL, new AppendBlockCallback(runtime, result), context));↵ | |||
6 | return result; | 6 |
| |
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 20 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Ruby runtime = context.getRuntime(); | 1 | Ruby runtime = context.getRuntime(); | |||||||||||||||||||||
2 | RubyArray result = runtime.newArray(); | 2 | RubyArray result = runtime.newArray(); | |||||||||||||||||||||
3 | callEach(runtime, context, self, new AppendBlockCallback(runtime, result)); |
| 3 | RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(), Arity.OPTIONAL, new AppendBlockCallback(runtime, result), context)); | ||||||||||||||||||||
4 | result.sort_bang(context, block); |
| | |||||||||||||||||||||
5 | return result; | 4 | return result; |
Row | Violation |
---|---|
1 | Expression callEach(runtime,context,self,new AppendBlockCallback(runtime,result)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression callEach(runtime,context,self,new AppendBlockCallback(runtime,result)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement result.sort_bang(context,block); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Clone fragment #1 returns variables result , while Clone fragment #2 returns variables |