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.
12974 12975 12976 12977 |
# File 'lib/syntax_tree.rb', line 12974 def initialize(location:, comments: []) @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
12972 12973 12974 |
# File 'lib/syntax_tree.rb', line 12972 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
12969 12970 12971 |
# File 'lib/syntax_tree.rb', line 12969 def location @location end |
Instance Method Details
#format(q) ⇒ Object
12979 12980 |
# File 'lib/syntax_tree.rb', line 12979 def format(q) end |
#pretty_print(q) ⇒ Object
12982 12983 12984 12985 12986 12987 |
# File 'lib/syntax_tree.rb', line 12982 def pretty_print(q) q.group(2, "(", ")") do q.text("void_stmt") q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
12989 12990 12991 |
# File 'lib/syntax_tree.rb', line 12989 def to_json(*opts) { type: :void_stmt, loc: location, cmts: comments }.to_json(*opts) end |