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.
-
#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.
13708 13709 13710 13711 13712 13713 13714 13715 |
# File 'lib/prism/node.rb', line 13708 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`.
13797 13798 13799 |
# File 'lib/prism/node.rb', line 13797 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.
13803 13804 13805 13806 13807 |
# File 'lib/prism/node.rb', line 13803 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
13718 13719 13720 |
# File 'lib/prism/node.rb', line 13718 def accept(visitor) visitor.visit_no_keywords_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
13723 13724 13725 |
# File 'lib/prism/node.rb', line 13723 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
13733 13734 13735 |
# File 'lib/prism/node.rb', line 13733 def comment_targets [operator_loc, keyword_loc] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
13728 13729 13730 |
# File 'lib/prism/node.rb', line 13728 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
13738 13739 13740 |
# File 'lib/prism/node.rb', line 13738 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 }
13746 13747 13748 |
# File 'lib/prism/node.rb', line 13746 def deconstruct_keys(keys) { node_id: node_id, location: location, operator_loc: operator_loc, keyword_loc: keyword_loc } end |
#inspect ⇒ Object
def inspect -> String
13787 13788 13789 |
# File 'lib/prism/node.rb', line 13787 def inspect InspectVisitor.compose(self) end |
#keyword ⇒ Object
def keyword: () -> String
13782 13783 13784 |
# File 'lib/prism/node.rb', line 13782 def keyword keyword_loc.slice end |
#keyword_loc ⇒ Object
attr_reader keyword_loc: Location
13764 13765 13766 13767 13768 |
# File 'lib/prism/node.rb', line 13764 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
13777 13778 13779 |
# File 'lib/prism/node.rb', line 13777 def operator operator_loc.slice end |
#operator_loc ⇒ Object
attr_reader operator_loc: Location
13751 13752 13753 13754 13755 |
# File 'lib/prism/node.rb', line 13751 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.
13772 13773 13774 |
# File 'lib/prism/node.rb', line 13772 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.
13759 13760 13761 |
# File 'lib/prism/node.rb', line 13759 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`.
13792 13793 13794 |
# File 'lib/prism/node.rb', line 13792 def type :no_keywords_parameter_node end |