Class: SyntaxTree::VoidStmt
- Inherits:
-
Object
- Object
- SyntaxTree::VoidStmt
- Defined in:
- lib/syntax_tree.rb
Overview
VoidStmt represents an empty lexical block of code.
;;
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
[Array[ Comment | EmbDoc ]] the comments attached to this node.
-
#location ⇒ Object
readonly
[Location] the location of this node.
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #format(q) ⇒ Object
-
#initialize(location:, comments: []) ⇒ VoidStmt
constructor
A new instance of VoidStmt.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(location:, comments: []) ⇒ VoidStmt
Returns a new instance of VoidStmt.
13166 13167 13168 13169 |
# File 'lib/syntax_tree.rb', line 13166 def initialize(location:, comments: []) @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
[Array[ Comment | EmbDoc ]] the comments attached to this node
13164 13165 13166 |
# File 'lib/syntax_tree.rb', line 13164 def comments @comments end |
#location ⇒ Object (readonly)
[Location] the location of this node
13161 13162 13163 |
# File 'lib/syntax_tree.rb', line 13161 def location @location end |
Instance Method Details
#child_nodes ⇒ Object
13171 13172 13173 |
# File 'lib/syntax_tree.rb', line 13171 def child_nodes [] end |
#format(q) ⇒ Object
13175 13176 |
# File 'lib/syntax_tree.rb', line 13175 def format(q) end |
#pretty_print(q) ⇒ Object
13178 13179 13180 13181 13182 13183 |
# File 'lib/syntax_tree.rb', line 13178 def pretty_print(q) q.group(2, "(", ")") do q.text("void_stmt") q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
13185 13186 13187 |
# File 'lib/syntax_tree.rb', line 13185 def to_json(*opts) { type: :void_stmt, loc: location, cmts: comments }.to_json(*opts) end |