@@ -1648,12 +1648,6 @@ unique_ptr<parser::Node> Translator::translate(pm_node_t *node) {
16481648 // We can skip the `hasFwdRestArg`/`hasSplat` logic below if it's false.
16491649 // However, we still need the loop if it's true, to be able to tell the two cases apart.
16501650
1651- NodeVec args;
1652- // true if the call contains a forwarded argument like `foo(...)`
1653- auto hasFwdArgs = callNode->arguments != nullptr &&
1654- PM_NODE_FLAG_P (callNode->arguments , PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING);
1655- auto hasFwdRestArg = false ; // true if the call contains an anonymous forwarded rest arg like `foo(*)`
1656- auto hasSplat = false ; // true if the call contains a splatted expression like `foo(*a)`
16571651 pm_keyword_hash_node *kwargsHash = nullptr ;
16581652 if (!prismArgs.empty ()) {
16591653 // Pop the Kwargs Hash off the end of the arguments, if there is one.
@@ -1688,31 +1682,37 @@ unique_ptr<parser::Node> Translator::translate(pm_node_t *node) {
16881682 prismArgs.remove_suffix (1 );
16891683 }
16901684 }
1685+ }
1686+ NodeVec args;
1687+ // true if the call contains a forwarded argument like `foo(...)`
1688+ auto hasFwdArgs = callNode->arguments != nullptr &&
1689+ PM_NODE_FLAG_P (callNode->arguments , PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING);
1690+ auto hasFwdRestArg = false ; // true if the call contains an anonymous forwarded rest arg like `foo(*)`
1691+ auto hasSplat = false ; // true if the call contains a splatted expression like `foo(*a)`
16911692
1692- // TODO: reserve size for kwargs Hash keys and values, if needed.
1693- // TODO: reserve size for block, if needed.
1694- args.reserve (prismArgs.size ());
1695-
1696- for (auto &arg : prismArgs) {
1697- switch (PM_NODE_TYPE (arg)) {
1698- case PM_SPLAT_NODE: {
1699- auto splatNode = down_cast<pm_splat_node>(arg);
1700- if (splatNode->expression == nullptr ) { // An anonymous splat like `f(*)`
1701- hasFwdRestArg = true ;
1702- } else { // Splatting an expression like `f(*a)`
1703- hasSplat = true ;
1704- }
1705-
1706- args.emplace_back (translate (arg));
1707-
1708- break ;
1693+ // TODO: reserve size for kwargs Hash keys and values, if needed.
1694+ // TODO: reserve size for block, if needed.
1695+ args.reserve (prismArgs.size ());
1696+
1697+ for (auto &arg : prismArgs) {
1698+ switch (PM_NODE_TYPE (arg)) {
1699+ case PM_SPLAT_NODE: {
1700+ auto splatNode = down_cast<pm_splat_node>(arg);
1701+ if (splatNode->expression == nullptr ) { // An anonymous splat like `f(*)`
1702+ hasFwdRestArg = true ;
1703+ } else { // Splatting an expression like `f(*a)`
1704+ hasSplat = true ;
17091705 }
17101706
1711- default :
1712- args.emplace_back (translate (arg));
1707+ args.emplace_back (translate (arg));
17131708
1714- break ;
1709+ break ;
17151710 }
1711+
1712+ default :
1713+ args.emplace_back (translate (arg));
1714+
1715+ break ;
17161716 }
17171717 }
17181718
0 commit comments