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:) ⇒ VoidStmt

Returns a new instance of VoidStmt.



11601
11602
11603
11604
# File 'lib/syntax_tree/node.rb', line 11601

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



11599
11600
11601
# File 'lib/syntax_tree/node.rb', line 11599

def comments
  @comments
end

#locationObject (readonly)

Location

the location of this node



11596
11597
11598
# File 'lib/syntax_tree/node.rb', line 11596

def location
  @location
end

Instance Method Details

#===(other) ⇒ Object



11630
11631
11632
# File 'lib/syntax_tree/node.rb', line 11630

def ===(other)
  other.is_a?(VoidStmt)
end

#accept(visitor) ⇒ Object



11606
11607
11608
# File 'lib/syntax_tree/node.rb', line 11606

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

#child_nodesObject Also known as: deconstruct



11610
11611
11612
# File 'lib/syntax_tree/node.rb', line 11610

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



11614
11615
11616
11617
11618
11619
# File 'lib/syntax_tree/node.rb', line 11614

def copy(location: nil)
  node = VoidStmt.new(location: location || self.location)

  node.comments.concat(comments.map(&:copy))
  node
end

#deconstruct_keys(_keys) ⇒ Object



11623
11624
11625
# File 'lib/syntax_tree/node.rb', line 11623

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

#format(q) ⇒ Object



11627
11628
# File 'lib/syntax_tree/node.rb', line 11627

def format(q)
end