Skip to content

Commit 372f864

Browse files
committed
Add (hash)splat AST tests
1 parent 2094aa9 commit 372f864

6 files changed

Lines changed: 544 additions & 525 deletions

File tree

ql/test/library-tests/ast/Ast.expected

Lines changed: 149 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,141 +1617,159 @@ operations/operations.rb:
16171617
# 27| getAnOperand/getOperand: [LocalVariableAccess] x
16181618
# 28| getStmt: [DefinedExpr] defined? ...
16191619
# 28| getAnOperand/getOperand: [LocalVariableAccess] foo
1620-
# 31| getStmt: [AddExpr] ... + ...
1621-
# 31| getAnOperand/getLeftOperand: [LocalVariableAccess] w
1622-
# 31| getAnOperand/getRightOperand: [IntegerLiteral] 234
1623-
# 32| getStmt: [SubExpr] ... - ...
1624-
# 32| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1625-
# 32| getAnOperand/getRightOperand: [IntegerLiteral] 17
1626-
# 33| getStmt: [MulExpr] ... * ...
1627-
# 33| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1628-
# 33| getAnOperand/getRightOperand: [IntegerLiteral] 10
1629-
# 34| getStmt: [DivExpr] ... / ...
1630-
# 34| getAnOperand/getLeftOperand: [LocalVariableAccess] z
1631-
# 34| getAnOperand/getRightOperand: [IntegerLiteral] 2
1632-
# 35| getStmt: [ModuloExpr] ... % ...
1633-
# 35| getAnOperand/getLeftOperand: [LocalVariableAccess] num
1620+
# 29| getStmt: [Method] foo
1621+
# 29| getStmt: [ReturnStmt] return
1622+
# 29| getValue: [ArgumentList] ..., ...
1623+
# 29| getElement: [IntegerLiteral] 1
1624+
# 29| getElement: [SplatArgument] *...
1625+
# 29| getValue: [ArrayLiteral] [...]
1626+
# 29| getElement: [IntegerLiteral] 2
1627+
# 29| getElement: [Pair] Pair
1628+
# 29| getKey: [SymbolLiteral] :a
1629+
# 29| getValue: [IntegerLiteral] 3
1630+
# 29| getElement: [HashSplatArgument] **...
1631+
# 29| getValue: [HashLiteral] {...}
1632+
# 29| getElement: [Pair] Pair
1633+
# 29| getKey: [SymbolLiteral] :b
1634+
# 29| getValue: [IntegerLiteral] 4
1635+
# 29| getElement: [Pair] Pair
1636+
# 29| getKey: [SymbolLiteral] :c
1637+
# 29| getValue: [IntegerLiteral] 5
1638+
# 32| getStmt: [AddExpr] ... + ...
1639+
# 32| getAnOperand/getLeftOperand: [LocalVariableAccess] w
1640+
# 32| getAnOperand/getRightOperand: [IntegerLiteral] 234
1641+
# 33| getStmt: [SubExpr] ... - ...
1642+
# 33| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1643+
# 33| getAnOperand/getRightOperand: [IntegerLiteral] 17
1644+
# 34| getStmt: [MulExpr] ... * ...
1645+
# 34| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1646+
# 34| getAnOperand/getRightOperand: [IntegerLiteral] 10
1647+
# 35| getStmt: [DivExpr] ... / ...
1648+
# 35| getAnOperand/getLeftOperand: [LocalVariableAccess] z
16341649
# 35| getAnOperand/getRightOperand: [IntegerLiteral] 2
1635-
# 36| getStmt: [ExponentExpr] ... ** ...
1636-
# 36| getAnOperand/getLeftOperand: [LocalVariableAccess] base
1637-
# 36| getAnOperand/getRightOperand: [LocalVariableAccess] power
1638-
# 39| getStmt: [LogicalAndExpr] ... && ...
1639-
# 39| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1640-
# 39| getAnOperand/getRightOperand: [LocalVariableAccess] bar
1641-
# 40| getStmt: [LogicalAndExpr] ... and ...
1642-
# 40| getAnOperand/getLeftOperand: [LocalVariableAccess] baz
1643-
# 40| getAnOperand/getRightOperand: [LocalVariableAccess] qux
1644-
# 41| getStmt: [LogicalOrExpr] ... or ...
1645-
# 41| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1646-
# 41| getAnOperand/getRightOperand: [LocalVariableAccess] b
1647-
# 42| getStmt: [LogicalOrExpr] ... || ...
1648-
# 42| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1649-
# 42| getAnOperand/getRightOperand: [LocalVariableAccess] y
1650-
# 45| getStmt: [LShiftExpr] ... << ...
1651-
# 45| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1652-
# 45| getAnOperand/getRightOperand: [IntegerLiteral] 3
1653-
# 46| getStmt: [RShiftExpr] ... >> ...
1654-
# 46| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1655-
# 46| getAnOperand/getRightOperand: [IntegerLiteral] 16
1656-
# 47| getStmt: [BitwiseAndExpr] ... & ...
1657-
# 47| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1658-
# 47| getAnOperand/getRightOperand: [IntegerLiteral] 0xff
1659-
# 48| getStmt: [BitwiseOrExpr] ... | ...
1660-
# 48| getAnOperand/getLeftOperand: [LocalVariableAccess] bar
1661-
# 48| getAnOperand/getRightOperand: [IntegerLiteral] 0x02
1662-
# 49| getStmt: [BitwiseXorExpr] ... ^ ...
1663-
# 49| getAnOperand/getLeftOperand: [LocalVariableAccess] baz
1664-
# 49| getAnOperand/getRightOperand: [LocalVariableAccess] qux
1665-
# 52| getStmt: [EqExpr] ... == ...
1666-
# 52| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1667-
# 52| getAnOperand/getRightOperand: [LocalVariableAccess] y
1668-
# 53| getStmt: [NEExpr] ... != ...
1669-
# 53| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1670-
# 53| getAnOperand/getRightOperand: [IntegerLiteral] 123
1671-
# 54| getStmt: [CaseEqExpr] ... === ...
1672-
# 54| getAnOperand/getLeftOperand: [LocalVariableAccess] m
1673-
# 54| getAnOperand/getRightOperand: [LocalVariableAccess] n
1674-
# 57| getStmt: [GTExpr] ... > ...
1675-
# 57| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] x
1676-
# 57| getAnOperand/getLesserOperand/getRightOperand: [IntegerLiteral] 0
1677-
# 58| getStmt: [GEExpr] ... >= ...
1678-
# 58| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] y
1679-
# 58| getAnOperand/getLesserOperand/getRightOperand: [IntegerLiteral] 100
1680-
# 59| getStmt: [LTExpr] ... < ...
1681-
# 59| getAnOperand/getLeftOperand/getLesserOperand: [LocalVariableAccess] a
1682-
# 59| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] b
1683-
# 60| getStmt: [LEExpr] ... <= ...
1684-
# 60| getAnOperand/getLeftOperand/getLesserOperand: [IntegerLiteral] 7
1685-
# 60| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] foo
1686-
# 63| getStmt: [SpaceshipExpr] ... <=> ...
1687-
# 63| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1688-
# 63| getAnOperand/getRightOperand: [LocalVariableAccess] b
1689-
# 64| getStmt: [RegexMatchExpr] ... =~ ...
1690-
# 64| getAnOperand/getLeftOperand: [LocalVariableAccess] name
1691-
# 64| getAnOperand/getRightOperand: [RegexLiteral] /foo.*/
1692-
# 64| getComponent: [StringTextComponent] foo.*
1693-
# 65| getStmt: [NoRegexMatchExpr] ... !~ ...
1694-
# 65| getAnOperand/getLeftOperand: [LocalVariableAccess] handle
1695-
# 65| getAnOperand/getRightOperand: [RegexLiteral] /.*bar/
1696-
# 65| getComponent: [StringTextComponent] .*bar
1697-
# 68| getStmt: [AssignAddExpr] ... += ...
1698-
# 68| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1699-
# 68| getAnOperand/getRightOperand: [IntegerLiteral] 128
1700-
# 69| getStmt: [AssignSubExpr] ... -= ...
1701-
# 69| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1702-
# 69| getAnOperand/getRightOperand: [IntegerLiteral] 32
1703-
# 70| getStmt: [AssignMulExpr] ... *= ...
1704-
# 70| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1705-
# 70| getAnOperand/getRightOperand: [IntegerLiteral] 12
1706-
# 71| getStmt: [AssignDivExpr] ... /= ...
1707-
# 71| getAnOperand/getLeftOperand: [LocalVariableAccess] b
1708-
# 71| getAnOperand/getRightOperand: [IntegerLiteral] 4
1709-
# 72| getStmt: [AssignModuloExpr] ... %= ...
1710-
# 72| getAnOperand/getLeftOperand: [LocalVariableAccess] z
1711-
# 72| getAnOperand/getRightOperand: [IntegerLiteral] 2
1712-
# 73| getStmt: [AssignExponentExpr] ... **= ...
1713-
# 73| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1714-
# 73| getAnOperand/getRightOperand: [LocalVariableAccess] bar
1715-
# 76| getStmt: [AssignLogicalAndExpr] ... &&= ...
1716-
# 76| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1717-
# 76| getAnOperand/getRightOperand: [LocalVariableAccess] y
1718-
# 77| getStmt: [AssignLogicalOrExpr] ... ||= ...
1719-
# 77| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1720-
# 77| getAnOperand/getRightOperand: [LocalVariableAccess] b
1721-
# 80| getStmt: [AssignLShiftExpr] ... <<= ...
1722-
# 80| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1723-
# 80| getAnOperand/getRightOperand: [IntegerLiteral] 2
1724-
# 81| getStmt: [AssignRShiftExpr] ... >>= ...
1725-
# 81| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1726-
# 81| getAnOperand/getRightOperand: [IntegerLiteral] 3
1727-
# 82| getStmt: [AssignBitwiseAndExpr] ... &= ...
1728-
# 82| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1729-
# 82| getAnOperand/getRightOperand: [LocalVariableAccess] mask
1730-
# 83| getStmt: [AssignBitwiseOrExpr] ... |= ...
1731-
# 83| getAnOperand/getLeftOperand: [LocalVariableAccess] bar
1732-
# 83| getAnOperand/getRightOperand: [IntegerLiteral] 0x01
1733-
# 84| getStmt: [AssignBitwiseXorExpr] ... ^= ...
1734-
# 84| getAnOperand/getLeftOperand: [LocalVariableAccess] baz
1735-
# 84| getAnOperand/getRightOperand: [LocalVariableAccess] qux
1736-
# 86| getStmt: [ClassDeclaration] X
1737-
# 87| getStmt: [AssignExpr] ... = ...
1738-
# 87| getAnOperand/getLeftOperand: [InstanceVariableAccess] @x
1739-
# 87| getAnOperand/getRightOperand: [IntegerLiteral] 1
1740-
# 88| getStmt: [AssignAddExpr] ... += ...
1650+
# 36| getStmt: [ModuloExpr] ... % ...
1651+
# 36| getAnOperand/getLeftOperand: [LocalVariableAccess] num
1652+
# 36| getAnOperand/getRightOperand: [IntegerLiteral] 2
1653+
# 37| getStmt: [ExponentExpr] ... ** ...
1654+
# 37| getAnOperand/getLeftOperand: [LocalVariableAccess] base
1655+
# 37| getAnOperand/getRightOperand: [LocalVariableAccess] power
1656+
# 40| getStmt: [LogicalAndExpr] ... && ...
1657+
# 40| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1658+
# 40| getAnOperand/getRightOperand: [LocalVariableAccess] bar
1659+
# 41| getStmt: [LogicalAndExpr] ... and ...
1660+
# 41| getAnOperand/getLeftOperand: [LocalVariableAccess] baz
1661+
# 41| getAnOperand/getRightOperand: [LocalVariableAccess] qux
1662+
# 42| getStmt: [LogicalOrExpr] ... or ...
1663+
# 42| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1664+
# 42| getAnOperand/getRightOperand: [LocalVariableAccess] b
1665+
# 43| getStmt: [LogicalOrExpr] ... || ...
1666+
# 43| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1667+
# 43| getAnOperand/getRightOperand: [LocalVariableAccess] y
1668+
# 46| getStmt: [LShiftExpr] ... << ...
1669+
# 46| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1670+
# 46| getAnOperand/getRightOperand: [IntegerLiteral] 3
1671+
# 47| getStmt: [RShiftExpr] ... >> ...
1672+
# 47| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1673+
# 47| getAnOperand/getRightOperand: [IntegerLiteral] 16
1674+
# 48| getStmt: [BitwiseAndExpr] ... & ...
1675+
# 48| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1676+
# 48| getAnOperand/getRightOperand: [IntegerLiteral] 0xff
1677+
# 49| getStmt: [BitwiseOrExpr] ... | ...
1678+
# 49| getAnOperand/getLeftOperand: [LocalVariableAccess] bar
1679+
# 49| getAnOperand/getRightOperand: [IntegerLiteral] 0x02
1680+
# 50| getStmt: [BitwiseXorExpr] ... ^ ...
1681+
# 50| getAnOperand/getLeftOperand: [LocalVariableAccess] baz
1682+
# 50| getAnOperand/getRightOperand: [LocalVariableAccess] qux
1683+
# 53| getStmt: [EqExpr] ... == ...
1684+
# 53| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1685+
# 53| getAnOperand/getRightOperand: [LocalVariableAccess] y
1686+
# 54| getStmt: [NEExpr] ... != ...
1687+
# 54| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1688+
# 54| getAnOperand/getRightOperand: [IntegerLiteral] 123
1689+
# 55| getStmt: [CaseEqExpr] ... === ...
1690+
# 55| getAnOperand/getLeftOperand: [LocalVariableAccess] m
1691+
# 55| getAnOperand/getRightOperand: [LocalVariableAccess] n
1692+
# 58| getStmt: [GTExpr] ... > ...
1693+
# 58| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] x
1694+
# 58| getAnOperand/getLesserOperand/getRightOperand: [IntegerLiteral] 0
1695+
# 59| getStmt: [GEExpr] ... >= ...
1696+
# 59| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] y
1697+
# 59| getAnOperand/getLesserOperand/getRightOperand: [IntegerLiteral] 100
1698+
# 60| getStmt: [LTExpr] ... < ...
1699+
# 60| getAnOperand/getLeftOperand/getLesserOperand: [LocalVariableAccess] a
1700+
# 60| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] b
1701+
# 61| getStmt: [LEExpr] ... <= ...
1702+
# 61| getAnOperand/getLeftOperand/getLesserOperand: [IntegerLiteral] 7
1703+
# 61| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] foo
1704+
# 64| getStmt: [SpaceshipExpr] ... <=> ...
1705+
# 64| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1706+
# 64| getAnOperand/getRightOperand: [LocalVariableAccess] b
1707+
# 65| getStmt: [RegexMatchExpr] ... =~ ...
1708+
# 65| getAnOperand/getLeftOperand: [LocalVariableAccess] name
1709+
# 65| getAnOperand/getRightOperand: [RegexLiteral] /foo.*/
1710+
# 65| getComponent: [StringTextComponent] foo.*
1711+
# 66| getStmt: [NoRegexMatchExpr] ... !~ ...
1712+
# 66| getAnOperand/getLeftOperand: [LocalVariableAccess] handle
1713+
# 66| getAnOperand/getRightOperand: [RegexLiteral] /.*bar/
1714+
# 66| getComponent: [StringTextComponent] .*bar
1715+
# 69| getStmt: [AssignAddExpr] ... += ...
1716+
# 69| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1717+
# 69| getAnOperand/getRightOperand: [IntegerLiteral] 128
1718+
# 70| getStmt: [AssignSubExpr] ... -= ...
1719+
# 70| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1720+
# 70| getAnOperand/getRightOperand: [IntegerLiteral] 32
1721+
# 71| getStmt: [AssignMulExpr] ... *= ...
1722+
# 71| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1723+
# 71| getAnOperand/getRightOperand: [IntegerLiteral] 12
1724+
# 72| getStmt: [AssignDivExpr] ... /= ...
1725+
# 72| getAnOperand/getLeftOperand: [LocalVariableAccess] b
1726+
# 72| getAnOperand/getRightOperand: [IntegerLiteral] 4
1727+
# 73| getStmt: [AssignModuloExpr] ... %= ...
1728+
# 73| getAnOperand/getLeftOperand: [LocalVariableAccess] z
1729+
# 73| getAnOperand/getRightOperand: [IntegerLiteral] 2
1730+
# 74| getStmt: [AssignExponentExpr] ... **= ...
1731+
# 74| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1732+
# 74| getAnOperand/getRightOperand: [LocalVariableAccess] bar
1733+
# 77| getStmt: [AssignLogicalAndExpr] ... &&= ...
1734+
# 77| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1735+
# 77| getAnOperand/getRightOperand: [LocalVariableAccess] y
1736+
# 78| getStmt: [AssignLogicalOrExpr] ... ||= ...
1737+
# 78| getAnOperand/getLeftOperand: [LocalVariableAccess] a
1738+
# 78| getAnOperand/getRightOperand: [LocalVariableAccess] b
1739+
# 81| getStmt: [AssignLShiftExpr] ... <<= ...
1740+
# 81| getAnOperand/getLeftOperand: [LocalVariableAccess] x
1741+
# 81| getAnOperand/getRightOperand: [IntegerLiteral] 2
1742+
# 82| getStmt: [AssignRShiftExpr] ... >>= ...
1743+
# 82| getAnOperand/getLeftOperand: [LocalVariableAccess] y
1744+
# 82| getAnOperand/getRightOperand: [IntegerLiteral] 3
1745+
# 83| getStmt: [AssignBitwiseAndExpr] ... &= ...
1746+
# 83| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
1747+
# 83| getAnOperand/getRightOperand: [LocalVariableAccess] mask
1748+
# 84| getStmt: [AssignBitwiseOrExpr] ... |= ...
1749+
# 84| getAnOperand/getLeftOperand: [LocalVariableAccess] bar
1750+
# 84| getAnOperand/getRightOperand: [IntegerLiteral] 0x01
1751+
# 85| getStmt: [AssignBitwiseXorExpr] ... ^= ...
1752+
# 85| getAnOperand/getLeftOperand: [LocalVariableAccess] baz
1753+
# 85| getAnOperand/getRightOperand: [LocalVariableAccess] qux
1754+
# 87| getStmt: [ClassDeclaration] X
1755+
# 88| getStmt: [AssignExpr] ... = ...
17411756
# 88| getAnOperand/getLeftOperand: [InstanceVariableAccess] @x
1742-
# 88| getAnOperand/getRightOperand: [IntegerLiteral] 2
1743-
# 90| getStmt: [AssignExpr] ... = ...
1744-
# 90| getAnOperand/getLeftOperand: [ClassVariableAccess] @@y
1745-
# 90| getAnOperand/getRightOperand: [IntegerLiteral] 3
1746-
# 91| getStmt: [AssignDivExpr] ... /= ...
1757+
# 88| getAnOperand/getRightOperand: [IntegerLiteral] 1
1758+
# 89| getStmt: [AssignAddExpr] ... += ...
1759+
# 89| getAnOperand/getLeftOperand: [InstanceVariableAccess] @x
1760+
# 89| getAnOperand/getRightOperand: [IntegerLiteral] 2
1761+
# 91| getStmt: [AssignExpr] ... = ...
17471762
# 91| getAnOperand/getLeftOperand: [ClassVariableAccess] @@y
1748-
# 91| getAnOperand/getRightOperand: [IntegerLiteral] 4
1749-
# 94| getStmt: [AssignExpr] ... = ...
1750-
# 94| getAnOperand/getLeftOperand: [GlobalVariableAccess] $global_var
1751-
# 94| getAnOperand/getRightOperand: [IntegerLiteral] 5
1752-
# 95| getStmt: [AssignMulExpr] ... *= ...
1763+
# 91| getAnOperand/getRightOperand: [IntegerLiteral] 3
1764+
# 92| getStmt: [AssignDivExpr] ... /= ...
1765+
# 92| getAnOperand/getLeftOperand: [ClassVariableAccess] @@y
1766+
# 92| getAnOperand/getRightOperand: [IntegerLiteral] 4
1767+
# 95| getStmt: [AssignExpr] ... = ...
17531768
# 95| getAnOperand/getLeftOperand: [GlobalVariableAccess] $global_var
1754-
# 95| getAnOperand/getRightOperand: [IntegerLiteral] 6
1769+
# 95| getAnOperand/getRightOperand: [IntegerLiteral] 5
1770+
# 96| getStmt: [AssignMulExpr] ... *= ...
1771+
# 96| getAnOperand/getLeftOperand: [GlobalVariableAccess] $global_var
1772+
# 96| getAnOperand/getRightOperand: [IntegerLiteral] 6
17551773
params/params.rb:
17561774
# 1| [Toplevel] params.rb
17571775
# 4| getStmt: [Method] identifier_method_params

0 commit comments

Comments
 (0)