Class: YARP::WhileNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::WhileNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘while` keyword, either in the block form or the modifier form.
bar while foo
^^^^^^^^^^^^^
while foo do bar end
^^^^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
attr_reader flags: Integer.
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_loc: Location.
-
#predicate ⇒ Object
readonly
attr_reader predicate: Node.
-
#statements ⇒ Object
readonly
attr_reader statements: Node?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(keyword_loc, predicate, statements, flags, location) ⇒ WhileNode
constructor
def initialize: (keyword_loc: Location, predicate: Node, statements: Node?, flags: Integer, location: Location) -> void.
-
#keyword ⇒ Object
def keyword: () -> String.
- #set_newline_flag(newline_marked) ⇒ Object
Constructor Details
#initialize(keyword_loc, predicate, statements, flags, location) ⇒ WhileNode
def initialize: (keyword_loc: Location, predicate: Node, statements: Node?, flags: Integer, location: Location) -> void
6200 6201 6202 6203 6204 6205 6206 |
# File 'lib/yarp/node.rb', line 6200 def initialize(keyword_loc, predicate, statements, flags, location) @keyword_loc = keyword_loc @predicate = predicate @statements = statements @flags = flags @location = location end |
Instance Attribute Details
#flags ⇒ Object (readonly)
attr_reader flags: Integer
6197 6198 6199 |
# File 'lib/yarp/node.rb', line 6197 def flags @flags end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
6188 6189 6190 |
# File 'lib/yarp/node.rb', line 6188 def keyword_loc @keyword_loc end |
#predicate ⇒ Object (readonly)
attr_reader predicate: Node
6191 6192 6193 |
# File 'lib/yarp/node.rb', line 6191 def predicate @predicate end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
6194 6195 6196 |
# File 'lib/yarp/node.rb', line 6194 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
6209 6210 6211 |
# File 'lib/yarp/node.rb', line 6209 def accept(visitor) visitor.visit_while_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6218 6219 6220 |
# File 'lib/yarp/node.rb', line 6218 def child_nodes [predicate, statements] end |
#deconstruct_keys(keys) ⇒ Object
6226 6227 6228 |
# File 'lib/yarp/node.rb', line 6226 def deconstruct_keys(keys) { keyword_loc: keyword_loc, predicate: predicate, statements: statements, flags: flags, location: location } end |
#keyword ⇒ Object
def keyword: () -> String
6231 6232 6233 |
# File 'lib/yarp/node.rb', line 6231 def keyword keyword_loc.slice end |
#set_newline_flag(newline_marked) ⇒ Object
6213 6214 6215 |
# File 'lib/yarp/node.rb', line 6213 def set_newline_flag(newline_marked) predicate.set_newline_flag(newline_marked) end |