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.



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

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



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

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



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

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

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



12376
12377
12378
12379
12380
12381
# File 'lib/syntax_tree/node.rb', line 12376

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

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

#deconstruct_keys(_keys) ⇒ Object



12385
12386
12387
# File 'lib/syntax_tree/node.rb', line 12385

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

#format(q) ⇒ Object



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

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