Class: Ikra::AST::VarDefNode
- Defined in:
- lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#read ⇒ Object
Returns the value of attribute read.
-
#written ⇒ Object
Returns the value of attribute written.
Attributes inherited from Node
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #clone ⇒ Object
-
#initialize(name:, read: false, written: false) ⇒ VarDefNode
constructor
A new instance of VarDefNode.
- #to_s ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(name:, read: false, written: false) ⇒ VarDefNode
Returns a new instance of VarDefNode.
116 117 118 119 120 |
# File 'lib/ast/nodes.rb', line 116 def initialize(name:, read: false, written: false) @name = name @read = read @written = written end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
112 113 114 |
# File 'lib/ast/nodes.rb', line 112 def name @name end |
#read ⇒ Object
Returns the value of attribute read.
113 114 115 |
# File 'lib/ast/nodes.rb', line 113 def read @read end |
#written ⇒ Object
Returns the value of attribute written.
114 115 116 |
# File 'lib/ast/nodes.rb', line 114 def written @written end |
Instance Method Details
#==(other) ⇒ Object
129 130 131 132 133 134 |
# File 'lib/ast/nodes.rb', line 129 def ==(other) return super(other) && name == other.name && read == other.read && written == other.written end |
#accept(visitor) ⇒ Object
26 27 28 |
# File 'lib/ast/visitor.rb', line 26 def accept(visitor) return visitor.visit_var_def_node(self) end |
#clone ⇒ Object
122 123 124 125 126 127 |
# File 'lib/ast/nodes.rb', line 122 def clone return VarDefNode.new( name: @name, read: @read, written: @written) end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/ast/printer.rb', line 22 def to_s return "[VarDefNode: #{name}, read = #{read}, written = #{written}]" end |