JSSpecCompiler: Properly parse function calls with zero arguments

We cannot handle them normally since we need text between parenthesis to
be a valid expression. As a workaround, we now push an artificial value
to stack to act as an argument (it'll be later removed during function
call canonicalization).
This commit is contained in:
Dan Klishch 2024-01-16 00:21:59 -05:00 committed by Andrew Kaster
commit 33b36476d9
Notes: sideshowbarker 2024-07-17 22:09:47 +09:00
4 changed files with 50 additions and 1 deletions

View file

@ -25,6 +25,11 @@ RecursionDecision FunctionCallCanonicalizationPass::on_entry(Tree tree)
}
arguments.append(current_tree);
if (arguments[0] == zero_argument_function_call) {
VERIFY(arguments.size() == 1);
arguments.clear();
}
replace_current_node_with(make_ref_counted<FunctionCall>(binary_operation->m_left, move(arguments)));
}
}