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 any_p(ThreadContext, IRubyObject, Block)
|
Method name: IRubyObject all_p(ThreadContext, IRubyObject, Block)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | final Ruby runtime = context.getRuntime();↵ | 1 | final Ruby runtime = context.getRuntime();↵ | |
2 | final ThreadContext localContext = context;↵ | 2 | final ThreadContext localContext = context;↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | if (block.isGiven()) {↵ | 4 | if (block.isGiven()) {↵ | |
5 | callEach(runtime, context, self, new BlockCallback() {↵ | 5 | callEach(runtime, context, self, new BlockCallback() {↵ | |
6 | public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {↵ | 6 | public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {↵ | |
7 | checkContext(localContext, ctx, "any?");↵ | 7 | checkContext(localContext, ctx, "all?");↵ | |
8 | IRubyObject larg = checkArgs(runtime, largs);↵ | 8 | IRubyObject larg = checkArgs(runtime, largs);↵ | |
9 | if (block.yield(ctx, larg).isTrue()) {↵ | 9 | if (!block.yield(ctx, larg).isTrue()) {↵ | |
10 | throw JumpException.SPECIAL_JUMP;↵ | 10 | throw JumpException.SPECIAL_JUMP;↵ | |
11 | }↵ | 11 | }↵ | |
12 | return runtime.getNil();↵ | 12 | return runtime.getNil();↵ | |
13 | }↵ | 13 | }↵ | |
14 | });↵ | 14 | });↵ | |
15 | } else {↵ | 15 | } else {↵ | |
16 | callEach(runtime, context, self, new BlockCallback() {↵ | 16 | callEach(runtime, context, self, new BlockCallback() {↵ | |
17 | public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {↵ | 17 | public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {↵ | |
18 | checkContext(localContext, ctx, "any?");↵ | 18 | checkContext(localContext, ctx, "all?");↵ | |
19 | IRubyObject larg = checkArgs(runtime, largs);↵ | 19 | IRubyObject larg = checkArgs(runtime, largs);↵ | |
20 | if (larg.isTrue()) {↵ | 20 | if (!larg.isTrue()) {↵ | |
21 | throw JumpException.SPECIAL_JUMP;↵ | 21 | throw JumpException.SPECIAL_JUMP;↵ | |
22 | }↵ | 22 | }↵ | |
23 | return runtime.getNil();↵ | 23 | return runtime.getNil();↵ | |
24 | }↵ | 24 | }↵ | |
25 | });↵ | 25 | });↵ | |
26 | }↵ | 26 | }↵ | |
27 | } catch (JumpException.SpecialJump sj) {↵ | 27 | } catch (JumpException.SpecialJump sj) {↵ | |
28 | return runtime.getTrue();↵ | 28 | return runtime.getFalse();↵ | |
29 | }↵ | 29 | }↵ | |
30 | return runtime.getFalse(); | 30 | return runtime.getTrue(); | |
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) | 1.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 19 |
Number of mapped statements | 7 |
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) | 25.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | final Ruby runtime = context.getRuntime(); | 1 | final Ruby runtime = context.getRuntime(); | ||||||||||||||||
2 | final ThreadContext localContext = context; | 2 | final ThreadContext localContext = context; | ||||||||||||||||
3 | try |
| 3 | try | |||||||||||||||
4 | if (block.isGiven()) | 4 | if (block.isGiven()) | ||||||||||||||||
5 | callEach(runtime, context, self, new BlockCallback() {...}); |
| 5 | callEach(runtime, context, self, new BlockCallback() {...}); | |||||||||||||||
else | else | ||||||||||||||||||
6 | callEach(runtime, context, self, new BlockCallback() {...}); |
| 6 | callEach(runtime, context, self, new BlockCallback() {...}); | |||||||||||||||
7 | return runtime.getFalse(); |
| 7 | return runtime.getTrue(); |
Row | Violation |
---|---|
1 | Expression runtime.getTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression runtime.getFalse() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression block.yield(ctx,larg).isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression !block.yield(ctx,larg).isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression larg.isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression !larg.isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression runtime.getFalse() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression runtime.getTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted |