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
- #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.
12418 12419 12420 12421 |
# File 'lib/syntax_tree.rb', line 12418 def initialize(location:, comments: []) @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
12416 12417 12418 |
# File 'lib/syntax_tree.rb', line 12416 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
12413 12414 12415 |
# File 'lib/syntax_tree.rb', line 12413 def location @location end |
Instance Method Details
#format(q) ⇒ Object
12423 12424 |
# File 'lib/syntax_tree.rb', line 12423 def format(q) end |
#pretty_print(q) ⇒ Object
12426 12427 12428 12429 12430 12431 |
# File 'lib/syntax_tree.rb', line 12426 def pretty_print(q) q.group(2, "(", ")") do q.text("void_stmt") q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
12433 12434 12435 |
# File 'lib/syntax_tree.rb', line 12433 def to_json(*opts) { type: :void_stmt, loc: location, cmts: comments }.to_json(*opts) end |