if (block.isGiven()) throw context.getRuntime().newArgumentError(2, 0);
// We just want the TypeError if the argument doesn't convert to a String (JRUBY-386)
RubyString evalStr;
if (arg0 instanceof RubyString) {
evalStr = (RubyString)arg0;
} else {
evalStr = arg0.convertToString();
}
String file = arg1.convertToString().asJavaString();
int line = (int)(arg2.convertToInteger().getLongValue() - 1);
return evalUnder(context, mod, evalStr, file, line);
if (block.isGiven()) throw context.getRuntime().newArgumentError(2, 0);
// We just want the TypeError if the argument doesn't convert to a String (JRUBY-386)
RubyString evalStr;
if (arg0 instanceof RubyString) {
evalStr = (RubyString)arg0;
} else {
evalStr = arg0.convertToString();
}
String file = arg1.convertToString().asJavaString();
int line = 0;
return evalUnder(context, mod, evalStr, file, line);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyObject.java
|
|
File path: /jruby-1.4.0/src/org/jruby/RubyObject.java
|
Method name: IRubyObject specificEval(ThreadContext, RubyModule, IRubyObject, IRubyObject, IRubyObject, Block)
|
|
Method name: IRubyObject specificEval(ThreadContext, RubyModule, IRubyObject, IRubyObject, Block)
|
Number of AST nodes: 9
|
|
Number of AST nodes: 9
|
|
1 | if (block.isGiven()) throw context.getRuntime().newArgumentError(2, 0);↵ | | 1 | if (block.isGiven()) throw context.getRuntime().newArgumentError(2, 0);↵
|
|
2 | // We just want the TypeError if the argument doesn't convert to a String (JRUBY-386)↵ | | 2 | // We just want the TypeError if the argument doesn't convert to a String (JRUBY-386)↵
|
3 | RubyString evalStr;↵ | | 3 | RubyString evalStr;↵
|
4 | if (arg0 instanceof RubyString) {↵ | | 4 | if (arg0 instanceof RubyString) {↵
|
5 | evalStr = (RubyString)arg0;↵ | | 5 | evalStr = (RubyString)arg0;↵
|
6 | } else {↵ | | 6 | } else {↵
|
7 | evalStr = arg0.convertToString();↵ | | 7 | evalStr = arg0.convertToString();↵
|
8 | }↵ | | 8 | }↵
|
|
9 | String file = arg1.convertToString().asJavaString();↵ | | 9 | String file = arg1.convertToString().asJavaString();↵
|
10 | int line = (int)(arg2.convertToInteger().getLongValue() - 1);↵ | | 10 | int line = 0;↵
|
|
11 | return evalUnder(context, mod, evalStr, file, line); | | 11 | return evalUnder(context, mod, evalStr, file, line);
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 36 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 9 |
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.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (block.isGiven()) | | 1 | if (block.isGiven()) |
2 | throw context.getRuntime().newArgumentError(2, 0); | | 2 | throw context.getRuntime().newArgumentError(2, 0); |
3 | RubyString evalStr; | | 3 | RubyString evalStr; |
4 | if (arg0 instanceof RubyString) | | 4 | if (arg0 instanceof RubyString) |
5 | evalStr = (RubyString)arg0; | | 5 | evalStr = (RubyString)arg0; |
| | | | |
6 | evalStr = arg0.convertToString(); | | 6 | evalStr = arg0.convertToString(); |
7 | String file = arg1.convertToString().asJavaString(); | | 7 | String file = arg1.convertToString().asJavaString(); |
8 | int line = (int)(arg2.convertToInteger().getLongValue() - 1); | | 8 | int line = 0; |
9 | return evalUnder(context, mod, evalStr, file, line); | | 9 | return evalUnder(context, mod, evalStr, file, line); |
Precondition Violations (0)
Row |
Violation |