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[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, 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.
7754 7755 7756 7757 7758 7759 7760 |
# File 'lib/prism/node.rb', line 7754 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
7796 7797 7798 |
# File 'lib/prism/node.rb', line 7796 def value @value end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
7809 7810 7811 |
# File 'lib/prism/node.rb', line 7809 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.
7815 7816 7817 7818 |
# File 'lib/prism/node.rb', line 7815 def ===(other) other.is_a?(ImplicitNode) && (value === other.value) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
7763 7764 7765 |
# File 'lib/prism/node.rb', line 7763 def accept(visitor) visitor.visit_implicit_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
7768 7769 7770 |
# File 'lib/prism/node.rb', line 7768 def child_nodes [value] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
7778 7779 7780 |
# File 'lib/prism/node.rb', line 7778 def comment_targets [value] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
7773 7774 7775 |
# File 'lib/prism/node.rb', line 7773 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
7783 7784 7785 |
# File 'lib/prism/node.rb', line 7783 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 }
7791 7792 7793 |
# File 'lib/prism/node.rb', line 7791 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end |
#inspect ⇒ Object
def inspect -> String
7799 7800 7801 |
# File 'lib/prism/node.rb', line 7799 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
7804 7805 7806 |
# File 'lib/prism/node.rb', line 7804 def type :implicit_node end |