Class: SyntaxTree::VoidStmt
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::VoidStmt
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
VoidStmt represents an empty lexical block of code.
;;
Instance Attribute Summary collapse
Attributes inherited from Node
#location
Instance Method Summary
collapse
Methods inherited from Node
#construct_keys, #end_char, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(location:) ⇒ VoidStmt
Returns a new instance of VoidStmt.
11798
11799
11800
11801
|
# File 'lib/syntax_tree/node.rb', line 11798
def initialize(location:)
@location = location
@comments = []
end
|
Instance Attribute Details
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
11796
11797
11798
|
# File 'lib/syntax_tree/node.rb', line 11796
def
@comments
end
|
Instance Method Details
#===(other) ⇒ Object
11827
11828
11829
|
# File 'lib/syntax_tree/node.rb', line 11827
def ===(other)
other.is_a?(VoidStmt)
end
|
#accept(visitor) ⇒ Object
11803
11804
11805
|
# File 'lib/syntax_tree/node.rb', line 11803
def accept(visitor)
visitor.visit_void_stmt(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
11807
11808
11809
|
# File 'lib/syntax_tree/node.rb', line 11807
def child_nodes
[]
end
|
#copy(location: nil) ⇒ Object
11811
11812
11813
11814
11815
11816
|
# File 'lib/syntax_tree/node.rb', line 11811
def copy(location: nil)
node = VoidStmt.new(location: location || self.location)
node..concat(.map(&:copy))
node
end
|
#deconstruct_keys(_keys) ⇒ Object
11820
11821
11822
|
# File 'lib/syntax_tree/node.rb', line 11820
def deconstruct_keys(_keys)
{ location: location, comments: }
end
|
11824
11825
|
# File 'lib/syntax_tree/node.rb', line 11824
def format(q)
end
|