File path: /jruby-1.4.0/src/org/jruby/ast/CallNode.java | File path: /jruby-1.4.0/src/org/jruby/ast/AttrAssignNode.java | |||
Method name: String definition(Ruby, ThreadContext, IRubyObject, Block)
|
Method name: String definition(Ruby, ThreadContext, IRubyObject, Block)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | if (receiverNode.definition(runtime, context, self, aBlock) != null) {↵ | 1 | if (receiverNode.definition(runtime, context, self, aBlock) != null) {↵ | |
2 | try {↵ | 2 | try {↵ | |
3 | IRubyObject receiver = receiverNode.interpret(runtime, context, self, aBlock);↵ | 3 | IRubyObject receiver = receiverNode.interpret(runtime, context, self, aBlock);↵ | |
4 | RubyClass metaClass = receiver.getMetaClass();↵ | 4 | RubyClass metaClass = receiver.getMetaClass();↵ | |
5 | DynamicMethod method = metaClass.searchMethod(getName());↵ | 5 | DynamicMethod method = metaClass.searchMethod(name);↵ | |
6 | Visibility visibility = method.getVisibility();↵ | 6 | Visibility visibility = method.getVisibility();↵ | |
7 | ↵ | |||
8 | if (visibility != Visibility.PRIVATE &&↵ | 7 | if (visibility != Visibility.PRIVATE && ↵ | |
9 | (visibility != Visibility.PROTECTED || metaClass.getRealClass().isInstance(self))) {↵ | 8 | (visibility != Visibility.PROTECTED || metaClass.getRealClass().isInstance(self))) {↵ | |
10 | if (!method.isUndefined()) {↵ | 9 | if (metaClass.isMethodBound(name, false)) {↵ | |
11 | return ASTInterpreter.getArgumentDefinition(runtime, context, getArgsNode(), "method", self, aBlock);↵ | 10 | return ASTInterpreter.getArgumentDefinition(runtime, context, argsNode, "assignment", self, aBlock);↵ | |
12 | }↵ | 11 | }↵ | |
13 | }↵ | 12 | }↵ | |
14 | } catch (JumpException excptn) {↵ | 13 | } catch (JumpException e) {↵ | |
15 | }↵ | 14 | }↵ | |
16 | }↵ | 15 | }↵ | |
17 | return null; | 16 |
| |
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.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 32 |
Number of mapped statements | 10 |
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) | 20.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (receiverNode.definition(runtime, context, self, aBlock) != null) | 1 | if (receiverNode.definition(runtime, context, self, aBlock) != null) | ||||||||||||||
2 | try |
| 2 | try | |||||||||||||
3 | IRubyObject receiver = receiverNode.interpret(runtime, context, self, aBlock); | 3 | IRubyObject receiver = receiverNode.interpret(runtime, context, self, aBlock); | ||||||||||||||
4 | RubyClass metaClass = receiver.getMetaClass(); | 4 | RubyClass metaClass = receiver.getMetaClass(); | ||||||||||||||
5 | DynamicMethod method = metaClass.searchMethod(getName()); |
| 5 | DynamicMethod method = metaClass.searchMethod(name); | |||||||||||||
6 | Visibility visibility = method.getVisibility(); | 6 | Visibility visibility = method.getVisibility(); | ||||||||||||||
7 | if (visibility != Visibility.PRIVATE && (visibility != Visibility.PROTECTED || metaClass.getRealClass().isInstance(self))) | 7 | if (visibility != Visibility.PRIVATE && (visibility != Visibility.PROTECTED || metaClass.getRealClass().isInstance(self))) | ||||||||||||||
8 | if (!method.isUndefined()) |
| 8 | if (metaClass.isMethodBound(name, false)) | |||||||||||||
9 | return ASTInterpreter.getArgumentDefinition(runtime, context, getArgsNode(), "method", self, aBlock); |
| 9 | return ASTInterpreter.getArgumentDefinition(runtime, context, argsNode, "assignment", self, aBlock); | |||||||||||||
10 | return null; | 10 | return null; |
Row | Violation |
---|---|
1 | Expression !method.isUndefined() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression metaClass.isMethodBound(name,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |