Class: SyntaxTree::ZSuper

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

Overview

ZSuper represents the bare super keyword with no arguments.

super

Instance Attribute Summary collapse

Attributes inherited from Node

#location

Instance Method Summary collapse

Methods inherited from Node

#construct_keys, #end_char, #pretty_print, #start_char, #to_json, #to_mermaid

Constructor Details

#initialize(location:) ⇒ ZSuper

Returns a new instance of ZSuper.



12330
12331
12332
12333
# File 'lib/syntax_tree/node.rb', line 12330

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



12328
12329
12330
# File 'lib/syntax_tree/node.rb', line 12328

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



12360
12361
12362
# File 'lib/syntax_tree/node.rb', line 12360

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

#accept(visitor) ⇒ Object



12335
12336
12337
# File 'lib/syntax_tree/node.rb', line 12335

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

#child_nodesObject Also known as: deconstruct



12339
12340
12341
# File 'lib/syntax_tree/node.rb', line 12339

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



12343
12344
12345
12346
12347
12348
# File 'lib/syntax_tree/node.rb', line 12343

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

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

#deconstruct_keys(_keys) ⇒ Object



12352
12353
12354
# File 'lib/syntax_tree/node.rb', line 12352

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

#format(q) ⇒ Object



12356
12357
12358
# File 'lib/syntax_tree/node.rb', line 12356

def format(q)
  q.text("super")
end