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.
12893 12894 12895 12896 |
# File 'lib/syntax_tree.rb', line 12893 def initialize(location:, comments: []) @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
12891 12892 12893 |
# File 'lib/syntax_tree.rb', line 12891 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
12888 12889 12890 |
# File 'lib/syntax_tree.rb', line 12888 def location @location end |
Instance Method Details
#format(q) ⇒ Object
12898 12899 |
# File 'lib/syntax_tree.rb', line 12898 def format(q) end |
#pretty_print(q) ⇒ Object
12901 12902 12903 12904 12905 12906 |
# File 'lib/syntax_tree.rb', line 12901 def pretty_print(q) q.group(2, "(", ")") do q.text("void_stmt") q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
12908 12909 12910 |
# File 'lib/syntax_tree.rb', line 12908 def to_json(*opts) { type: :void_stmt, loc: location, cmts: comments }.to_json(*opts) end |