Class: Yadriggy::Super
- Defined in:
- lib/yadriggy/ast.rb,
lib/yadriggy/ast_value.rb
Overview
Instance Attribute Summary
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ Super
constructor
A new instance of Super.
-
#invoked_method ⇒ Object
Gets the super method (Method or UnboundMethod object) or nil.
-
#value ⇒ Object
Gets an ASTree object representing the method body invoked by this call to super.
Methods inherited from ASTnode
#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value_in_class
Constructor Details
#initialize(sexp) ⇒ Super
Returns a new instance of Super.
239 |
# File 'lib/yadriggy/ast.rb', line 239 def initialize(sexp) end |
Class Method Details
.tag ⇒ Object
237 |
# File 'lib/yadriggy/ast.rb', line 237 def self.tag() :zsuper end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
244 245 246 |
# File 'lib/yadriggy/ast.rb', line 244 def accept(evaluator) evaluator.super_method(self) end |
#invoked_method ⇒ Object
Gets the super method (Method or UnboundMethod object) or nil. If this AST node is not a part of method body, Undef is returned.
253 254 255 256 257 258 259 260 |
# File 'lib/yadriggy/ast_value.rb', line 253 def invoked_method() mthd = root.context if mthd.is_a?(Method) || mthd.is_a?(UnboundMethod) mthd.super_method else Undef end end |
#value ⇒ Object
Gets an ASTree object representing the method body invoked by this call to super. Undef may be returned if the method is not found.
240 241 242 243 244 245 246 247 |
# File 'lib/yadriggy/ast_value.rb', line 240 def value() mth = invoked_method if mth == Undef Undef else root.reify(mth) || Undef end end |