Class: Masamune::AbstractSyntaxTree::MethodCallsVisitor
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- Masamune::AbstractSyntaxTree::MethodCallsVisitor
- Defined in:
- lib/masamune/abstract_syntax_tree/visitors/method_calls_visitor.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#token_value ⇒ Object
readonly
Returns the value of attribute token_value.
Instance Method Summary collapse
-
#initialize(token_value) ⇒ MethodCallsVisitor
constructor
A new instance of MethodCallsVisitor.
- #visit_call_node(node) ⇒ Object
Constructor Details
#initialize(token_value) ⇒ MethodCallsVisitor
Returns a new instance of MethodCallsVisitor.
6 7 8 9 |
# File 'lib/masamune/abstract_syntax_tree/visitors/method_calls_visitor.rb', line 6 def initialize(token_value) @token_value = token_value @results = [] end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
4 5 6 |
# File 'lib/masamune/abstract_syntax_tree/visitors/method_calls_visitor.rb', line 4 def results @results end |
#token_value ⇒ Object (readonly)
Returns the value of attribute token_value.
4 5 6 |
# File 'lib/masamune/abstract_syntax_tree/visitors/method_calls_visitor.rb', line 4 def token_value @token_value end |
Instance Method Details
#visit_call_node(node) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/masamune/abstract_syntax_tree/visitors/method_calls_visitor.rb', line 11 def visit_call_node(node) # TODO: We should probably replace this with unless node.variable_call? if node.method_call? results << node if token_value.nil? || token_value == node.name.to_s end super end |