Class: Prism::NoKeywordsParameterNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::NoKeywordsParameterNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents the use of ‘**nil` inside method arguments.
def a(**nil)
^^^^^
end
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, operator_loc: self.operator_loc, keyword_loc: self.keyword_loc) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, operator_loc: Location, keyword_loc: Location }.
-
#initialize(source, node_id, location, flags, operator_loc, keyword_loc) ⇒ NoKeywordsParameterNode
constructor
Initialize a new NoKeywordsParameterNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#keyword ⇒ Object
def keyword: () -> String.
-
#keyword_loc ⇒ Object
attr_reader keyword_loc: Location.
-
#operator ⇒ Object
def operator: () -> String.
-
#operator_loc ⇒ Object
attr_reader operator_loc: Location.
-
#save_keyword_loc(repository) ⇒ Object
Save the keyword_loc location using the given saved source so that it can be retrieved later.
-
#save_operator_loc(repository) ⇒ Object
Save the operator_loc location using the given saved source so that it can be retrieved later.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, operator_loc, keyword_loc) ⇒ NoKeywordsParameterNode
Initialize a new NoKeywordsParameterNode node.
13555 13556 13557 13558 13559 13560 13561 13562 |
# File 'lib/prism/node.rb', line 13555 def initialize(source, node_id, location, flags, operator_loc, keyword_loc) @source = source @node_id = node_id @location = location @flags = flags @operator_loc = operator_loc @keyword_loc = keyword_loc end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
13644 13645 13646 |
# File 'lib/prism/node.rb', line 13644 def self.type :no_keywords_parameter_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
13650 13651 13652 13653 13654 |
# File 'lib/prism/node.rb', line 13650 def ===(other) other.is_a?(NoKeywordsParameterNode) && (operator_loc.nil? == other.operator_loc.nil?) && (keyword_loc.nil? == other.keyword_loc.nil?) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
13565 13566 13567 |
# File 'lib/prism/node.rb', line 13565 def accept(visitor) visitor.visit_no_keywords_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
13570 13571 13572 |
# File 'lib/prism/node.rb', line 13570 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
13580 13581 13582 |
# File 'lib/prism/node.rb', line 13580 def comment_targets [operator_loc, keyword_loc] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
13575 13576 13577 |
# File 'lib/prism/node.rb', line 13575 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, operator_loc: self.operator_loc, keyword_loc: self.keyword_loc) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode
13585 13586 13587 |
# File 'lib/prism/node.rb', line 13585 def copy(node_id: self.node_id, location: self.location, flags: self.flags, operator_loc: self.operator_loc, keyword_loc: self.keyword_loc) NoKeywordsParameterNode.new(source, node_id, location, flags, operator_loc, keyword_loc) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, operator_loc: Location, keyword_loc: Location }
13593 13594 13595 |
# File 'lib/prism/node.rb', line 13593 def deconstruct_keys(keys) { node_id: node_id, location: location, operator_loc: operator_loc, keyword_loc: keyword_loc } end |
#inspect ⇒ Object
def inspect -> String
13634 13635 13636 |
# File 'lib/prism/node.rb', line 13634 def inspect InspectVisitor.compose(self) end |
#keyword ⇒ Object
def keyword: () -> String
13629 13630 13631 |
# File 'lib/prism/node.rb', line 13629 def keyword keyword_loc.slice end |
#keyword_loc ⇒ Object
attr_reader keyword_loc: Location
13611 13612 13613 13614 13615 |
# File 'lib/prism/node.rb', line 13611 def keyword_loc location = @keyword_loc return location if location.is_a?(Location) @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end |
#operator ⇒ Object
def operator: () -> String
13624 13625 13626 |
# File 'lib/prism/node.rb', line 13624 def operator operator_loc.slice end |
#operator_loc ⇒ Object
attr_reader operator_loc: Location
13598 13599 13600 13601 13602 |
# File 'lib/prism/node.rb', line 13598 def operator_loc location = @operator_loc return location if location.is_a?(Location) @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end |
#save_keyword_loc(repository) ⇒ Object
Save the keyword_loc location using the given saved source so that it can be retrieved later.
13619 13620 13621 |
# File 'lib/prism/node.rb', line 13619 def save_keyword_loc(repository) repository.enter(node_id, :keyword_loc) end |
#save_operator_loc(repository) ⇒ Object
Save the operator_loc location using the given saved source so that it can be retrieved later.
13606 13607 13608 |
# File 'lib/prism/node.rb', line 13606 def save_operator_loc(repository) repository.enter(node_id, :operator_loc) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
13639 13640 13641 |
# File 'lib/prism/node.rb', line 13639 def type :no_keywords_parameter_node end |