mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
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:
parent
14ee25b8ba
commit
33b36476d9
4 changed files with 50 additions and 1 deletions
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue