Class: Yadriggy::Identifier
- Inherits:
-
IdentifierOrCall
- Object
- ASTnode
- Name
- IdentifierOrCall
- Yadriggy::Identifier
- Defined in:
- lib/yadriggy/ast.rb,
lib/yadriggy/ast_value.rb
Overview
Identifier.
Instance Attribute Summary
Attributes inherited from Name
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ Identifier
constructor
A new instance of Identifier.
- #value ⇒ Object
Methods inherited from Name
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) ⇒ Identifier
Returns a new instance of Identifier.
110 111 112 |
# File 'lib/yadriggy/ast.rb', line 110 def initialize(sexp) super(sexp) end |
Class Method Details
.tags ⇒ Object
108 |
# File 'lib/yadriggy/ast.rb', line 108 def self.() [:@ident, :@op] end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
117 118 119 |
# File 'lib/yadriggy/ast.rb', line 117 def accept(evaluator) evaluator.identifier(self) end |
#value ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/yadriggy/ast_value.rb', line 67 def value() c = root.context if c.is_a?(Proc) if c.binding.local_variable_defined?(name) c.binding.local_variable_get(name) else Undef end else # c is Method or UnboundMethod Undef end end |