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.



12366
12367
12368
12369
# File 'lib/syntax_tree/node.rb', line 12366

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



12364
12365
12366
# File 'lib/syntax_tree/node.rb', line 12364

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



12396
12397
12398
# File 'lib/syntax_tree/node.rb', line 12396

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

#accept(visitor) ⇒ Object



12371
12372
12373
# File 'lib/syntax_tree/node.rb', line 12371

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

#child_nodesObject Also known as: deconstruct



12375
12376
12377
# File 'lib/syntax_tree/node.rb', line 12375

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



12379
12380
12381
12382
12383
12384
# File 'lib/syntax_tree/node.rb', line 12379

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

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

#deconstruct_keys(_keys) ⇒ Object



12388
12389
12390
# File 'lib/syntax_tree/node.rb', line 12388

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

#format(q) ⇒ Object



12392
12393
12394
# File 'lib/syntax_tree/node.rb', line 12392

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