Class: Prism::ImplicitNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::ImplicitNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents a node that is implicitly being added to the tree but doesn’t correspond directly to a node in the source.
{ foo: }
^^^^
{ Foo: }
^^^^
foo in { bar: }
^^^^
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
attr_reader value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode.
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, value: self.value) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) -> ImplicitNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode }.
-
#initialize(source, node_id, location, flags, value) ⇒ ImplicitNode
constructor
Initialize a new ImplicitNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, value) ⇒ ImplicitNode
Initialize a new ImplicitNode node.
8876 8877 8878 8879 8880 8881 8882 |
# File 'lib/prism/node.rb', line 8876 def initialize(source, node_id, location, flags, value) @source = source @node_id = node_id @location = location @flags = flags @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
attr_reader value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode
8918 8919 8920 |
# File 'lib/prism/node.rb', line 8918 def value @value end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
8931 8932 8933 |
# File 'lib/prism/node.rb', line 8931 def self.type :implicit_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.
8937 8938 8939 8940 |
# File 'lib/prism/node.rb', line 8937 def ===(other) other.is_a?(ImplicitNode) && (value === other.value) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
8885 8886 8887 |
# File 'lib/prism/node.rb', line 8885 def accept(visitor) visitor.visit_implicit_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
8890 8891 8892 |
# File 'lib/prism/node.rb', line 8890 def child_nodes [value] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
8900 8901 8902 |
# File 'lib/prism/node.rb', line 8900 def comment_targets [value] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
8895 8896 8897 |
# File 'lib/prism/node.rb', line 8895 def compact_child_nodes [value] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) -> ImplicitNode
8905 8906 8907 |
# File 'lib/prism/node.rb', line 8905 def copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ImplicitNode.new(source, node_id, location, flags, value) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode }
8913 8914 8915 |
# File 'lib/prism/node.rb', line 8913 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end |
#inspect ⇒ Object
def inspect -> String
8921 8922 8923 |
# File 'lib/prism/node.rb', line 8921 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
8926 8927 8928 |
# File 'lib/prism/node.rb', line 8926 def type :implicit_node end |