File path: /jruby-1.4.0/src/org/jruby/RubyString.java | File path: /jruby-1.4.0/src/org/jruby/RubyString.java | |||
Method name: IRubyObject to_r(ThreadContext)
|
Method name: IRubyObject to_c(ThreadContext)
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | Ruby runtime = context.getRuntime();↵ | 1 | Ruby runtime = context.getRuntime();↵ | |
2 | DynamicScope scope = context.getCurrentScope();↵ | 2 | DynamicScope scope = context.getCurrentScope();↵ | |
3 | IRubyObject backref = scope.getBackRef(runtime);↵ | 3 | IRubyObject backref = scope.getBackRef(runtime);↵ | |
4 | if (backref instanceof RubyMatchData) ((RubyMatchData)backref).use();↵ | 4 | if (backref instanceof RubyMatchData) ((RubyMatchData)backref).use();↵ | |
5 | IRubyObject s = RuntimeHelpers.invoke(↵ | 5 | IRubyObject s = RuntimeHelpers.invoke(↵ | |
6 | context, this, "gsub",↵ | 6 | context, this, "gsub",↵ | |
7 | RubyRegexp.newDummyRegexp(runtime, Numeric.ComplexPatterns.underscores_pat),↵ | 7 | RubyRegexp.newDummyRegexp(runtime, Numeric.ComplexPatterns.underscores_pat),↵ | |
8 | runtime.newString(new ByteList(new byte[]{'_'})));↵ | 8 | runtime.newString(new ByteList(new byte[]{'_'})));↵ | |
9 | RubyArray a = RubyRational.str_to_r_internal(context, s);↵ | 9 | RubyArray a = RubyComplex.str_to_c_internal(context, s);↵ | |
10 | scope.setBackRef(backref);↵ | 10 | scope.setBackRef(backref);↵ | |
11 | if (!a.eltInternal(0).isNil()) {↵ | 11 | if (!a.eltInternal(0).isNil()) {↵ | |
12 | return a.eltInternal(0);↵ | 12 | return a.eltInternal(0);↵ | |
13 | } else {↵ | 13 | } else {↵ | |
14 | return RubyRational.newRationalCanonicalize(context, RubyFixnum.zero(runtime));↵ | 14 | return RubyComplex.newComplexCanonicalize(context, RubyFixnum.zero(runtime));↵ | |
15 | } | 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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 40 |
Number of mapped statements | 11 |
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) | 106.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Ruby runtime = context.getRuntime(); | 1 | Ruby runtime = context.getRuntime(); | ||||||||||||||||
2 | DynamicScope scope = context.getCurrentScope(); | 2 | DynamicScope scope = context.getCurrentScope(); | ||||||||||||||||
3 | IRubyObject backref = scope.getBackRef(runtime); | 3 | IRubyObject backref = scope.getBackRef(runtime); | ||||||||||||||||
4 | if (backref instanceof RubyMatchData) | 4 | if (backref instanceof RubyMatchData) | ||||||||||||||||
5 | ((RubyMatchData)backref).use(); | 5 | ((RubyMatchData)backref).use(); | ||||||||||||||||
6 | IRubyObject s = RuntimeHelpers.invoke(context, this, "gsub", RubyRegexp.newDummyRegexp(runtime, Numeric.ComplexPatterns.underscores_pat), runtime.newString(new ByteList(new byte[] {'_'}))); | 6 | IRubyObject s = RuntimeHelpers.invoke(context, this, "gsub", RubyRegexp.newDummyRegexp(runtime, Numeric.ComplexPatterns.underscores_pat), runtime.newString(new ByteList(new byte[] {'_'}))); | ||||||||||||||||
7 | RubyArray a = RubyRational.str_to_r_internal(context, s); |
| 7 | RubyArray a = RubyComplex.str_to_c_internal(context, s); | |||||||||||||||
8 | scope.setBackRef(backref); | 8 | scope.setBackRef(backref); | ||||||||||||||||
9 | if (!a.eltInternal(0).isNil()) | 9 | if (!a.eltInternal(0).isNil()) | ||||||||||||||||
10 | return a.eltInternal(0); | 10 | return a.eltInternal(0); | ||||||||||||||||
else | else | ||||||||||||||||||
11 | return RubyRational.newRationalCanonicalize(context, RubyFixnum.zero(runtime)); |
| 11 | return RubyComplex.newComplexCanonicalize(context, RubyFixnum.zero(runtime)); |
Row | Violation |
---|---|
1 | Expression RubyRational.str_to_r_internal(context,s) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression RubyComplex.str_to_c_internal(context,s) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression RubyRational.newRationalCanonicalize(context,RubyFixnum.zero(runtime)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression RubyComplex.newComplexCanonicalize(context,RubyFixnum.zero(runtime)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |