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.



12347
12348
12349
12350
# File 'lib/syntax_tree/node.rb', line 12347

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



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

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



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

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

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



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

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

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

#deconstruct_keys(_keys) ⇒ Object



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

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

#format(q) ⇒ Object



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

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