File tree Expand file tree Collapse file tree 1 file changed +62
-1
lines changed Expand file tree Collapse file tree 1 file changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -1589,26 +1589,87 @@ nodes:
1589
1589
fields :
1590
1590
- name : if_keyword_loc
1591
1591
type : location?
1592
+ comment : |
1593
+ The location of the `if` keyword if present.
1594
+
1595
+ bar if foo
1596
+ ^^
1597
+
1598
+ The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
1592
1599
- name : predicate
1593
1600
type : node
1601
+ comment : |
1602
+ The node for the condition the `IfNode` is testing.
1603
+
1604
+ if foo
1605
+ ^^^
1606
+ bar
1607
+ end
1608
+
1609
+ bar if foo
1610
+ ^^^
1611
+
1612
+ foo ? bar : baz
1613
+ ^^^
1594
1614
- name : then_keyword_loc
1595
1615
type : location?
1616
+ comment : |
1617
+ The location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
1618
+
1619
+ if foo then bar end
1620
+ ^^^^
1621
+
1622
+ a ? b : c
1623
+ ^
1596
1624
- name : statements
1597
1625
type : node?
1598
1626
kind : StatementsNode
1627
+ comment : |
1628
+ Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
1629
+
1630
+ if foo
1631
+ bar
1632
+ ^^^
1633
+ baz
1634
+ ^^^
1635
+ end
1599
1636
- name : consequent
1600
1637
type : node?
1638
+ comment : |
1639
+ Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
1640
+
1641
+ if foo
1642
+ bar
1643
+ elsif baz
1644
+ ^^^^^^^^^
1645
+ qux
1646
+ ^^^
1647
+ end
1648
+ ^^^
1649
+
1650
+ if foo then bar else baz end
1651
+ ^^^^^^^^^^^^
1601
1652
- name : end_keyword_loc
1602
1653
type : location?
1654
+ comment : |
1655
+ The location of the `end` keyword if present, `nil` otherwise.
1656
+
1657
+ if foo
1658
+ bar
1659
+ end
1660
+ ^^^
1603
1661
newline : predicate
1604
1662
comment : |
1605
- Represents the use of the `if` keyword, either in the block form or the modifier form.
1663
+ Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression .
1606
1664
1607
1665
bar if foo
1608
1666
^^^^^^^^^^
1609
1667
1610
1668
if foo then bar end
1611
1669
^^^^^^^^^^^^^^^^^^^
1670
+
1671
+ foo ? bar : baz
1672
+ ^^^^^^^^^^^^^^^
1612
1673
- name : ImaginaryNode
1613
1674
fields :
1614
1675
- name : numeric
You can’t perform that action at this time.
0 commit comments