Class: Prism::NoBlockParameterNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::NoBlockParameterNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :no_block_parameter_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, operator_loc: self.operator_loc, keyword_loc: self.keyword_loc) ⇒ NoBlockParameterNode
:call-seq: copy(**fields) -> NoBlockParameterNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, operator_loc, keyword_loc) ⇒ NoBlockParameterNode
constructor
Initialize a new NoBlockParameterNode node.
-
#inspect ⇒ String
: () -> String.
-
#keyword ⇒ String
:call-seq: keyword -> String.
-
#keyword_loc ⇒ Location
:category: Locations :call-seq: keyword_loc -> Location.
-
#operator ⇒ String
:call-seq: operator -> String.
-
#operator_loc ⇒ Location
:category: Locations :call-seq: operator_loc -> Location.
-
#save_keyword_loc(repository) ⇒ Relocation::Entry
:category: Repository Save the keyword_loc location using the given saved source so that it can be retrieved later.
-
#save_operator_loc(repository) ⇒ Relocation::Entry
:category: Repository Save the operator_loc location using the given saved source so that it can be retrieved later.
-
#type ⇒ :no_block_parameter_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, operator_loc, keyword_loc) ⇒ NoBlockParameterNode
Initialize a new NoBlockParameterNode node.
: (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Location keyword_loc) -> void
24815 24816 24817 24818 24819 24820 24821 24822 |
# File 'lib/prism/node.rb', line 24815 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 ⇒ :no_block_parameter_node
See Node.type.
: () -> :no_block_parameter_node
24903 24904 24905 |
# File 'lib/prism/node.rb', line 24903 def self.type :no_block_parameter_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
24983 24984 24985 24986 24987 |
# File 'lib/prism/node.rb', line 24983 def ===(other) # :nodoc: other.is_a?(NoBlockParameterNode) && (operator_loc.nil? == other.operator_loc.nil?) && (keyword_loc.nil? == other.keyword_loc.nil?) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
24838 24839 24840 |
# File 'lib/prism/node.rb', line 24838 def accept(visitor) visitor.visit_no_block_parameter_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
24845 24846 24847 |
# File 'lib/prism/node.rb', line 24845 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
24861 24862 24863 |
# File 'lib/prism/node.rb', line 24861 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) ⇒ NoBlockParameterNode
:call-seq:
copy(**fields) -> NoBlockParameterNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoBlockParameterNode
24871 24872 24873 |
# File 'lib/prism/node.rb', line 24871 def copy(node_id: self.node_id, location: self.location, flags: self.flags, operator_loc: self.operator_loc, keyword_loc: self.keyword_loc) NoBlockParameterNode.new(source, node_id, location, flags, operator_loc, keyword_loc) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 24888 24889 24890 24891 |
# File 'lib/prism/node.rb', line 24878 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location operator_loc keyword_loc operator keyword]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location when :operator_loc then deconstructed[:operator_loc] = self.operator_loc when :keyword_loc then deconstructed[:keyword_loc] = self.keyword_loc when :operator then deconstructed[:operator] = self.operator when :keyword then deconstructed[:keyword] = self.keyword end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
24853 24854 24855 24856 |
# File 'lib/prism/node.rb', line 24853 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
24908 24909 24910 |
# File 'lib/prism/node.rb', line 24908 def inspect # :nodoc: InspectVisitor.compose(self) end |
#keyword ⇒ String
:call-seq:
keyword -> String
Slice the location of keyword_loc from the source.
: () -> String
24976 24977 24978 |
# File 'lib/prism/node.rb', line 24976 def keyword keyword_loc.slice end |
#keyword_loc ⇒ Location
:category: Locations :call-seq:
keyword_loc -> Location
Returns the Location represented by keyword_loc.
: () -> Location
24943 24944 24945 24946 24947 |
# File 'lib/prism/node.rb', line 24943 def keyword_loc location = @keyword_loc return location if location.is_a?(Location) @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end |
#operator ⇒ String
:call-seq:
operator -> String
Slice the location of operator_loc from the source.
: () -> String
24966 24967 24968 |
# File 'lib/prism/node.rb', line 24966 def operator operator_loc.slice end |
#operator_loc ⇒ Location
:category: Locations :call-seq:
operator_loc -> Location
Returns the Location represented by operator_loc.
: () -> Location
24921 24922 24923 24924 24925 |
# File 'lib/prism/node.rb', line 24921 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) ⇒ Relocation::Entry
:category: Repository Save the keyword_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
24954 24955 24956 |
# File 'lib/prism/node.rb', line 24954 def save_keyword_loc(repository) repository.enter(node_id, :keyword_loc) end |
#save_operator_loc(repository) ⇒ Relocation::Entry
:category: Repository Save the operator_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
24932 24933 24934 |
# File 'lib/prism/node.rb', line 24932 def save_operator_loc(repository) repository.enter(node_id, :operator_loc) end |
#type ⇒ :no_block_parameter_node
See Node#type.
: () -> :no_block_parameter_node
24896 24897 24898 |
# File 'lib/prism/node.rb', line 24896 def type :no_block_parameter_node end |