Class: SyntaxTree::VoidStmt

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

VoidStmt represents an empty lexical block of code.

;;

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#construct_keys, #pretty_print, #to_json

Constructor Details

#initialize(location:, comments: []) ⇒ VoidStmt



9913
9914
9915
9916
# File 'lib/syntax_tree/node.rb', line 9913

def initialize(location:, comments: [])
  @location = location
  @comments = comments
end

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



9911
9912
9913
# File 'lib/syntax_tree/node.rb', line 9911

def comments
  @comments
end

#locationObject (readonly)

Location

the location of this node



9908
9909
9910
# File 'lib/syntax_tree/node.rb', line 9908

def location
  @location
end

Instance Method Details

#accept(visitor) ⇒ Object



9918
9919
9920
# File 'lib/syntax_tree/node.rb', line 9918

def accept(visitor)
  visitor.visit_void_stmt(self)
end

#child_nodesObject Also known as: deconstruct



9922
9923
9924
# File 'lib/syntax_tree/node.rb', line 9922

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



9928
9929
9930
# File 'lib/syntax_tree/node.rb', line 9928

def deconstruct_keys(_keys)
  { location: location, comments: comments }
end

#format(q) ⇒ Object



9932
9933
# File 'lib/syntax_tree/node.rb', line 9932

def format(q)
end