mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-31 14:48:17 +00:00
LibJS: Allow labelled functions in certain contexts
Also disallow duplicated labels.
This commit is contained in:
parent
4cc95ae39d
commit
b16c02d6b4
Notes:
sideshowbarker
2024-07-18 05:37:19 +09:00
Author: https://github.com/davidot
Commit: b16c02d6b4
Pull-request: https://github.com/SerenityOS/serenity/pull/9085
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/trflynn89
2 changed files with 45 additions and 11 deletions
|
@ -50,7 +50,13 @@ public:
|
|||
};
|
||||
|
||||
NonnullRefPtr<Declaration> parse_declaration();
|
||||
NonnullRefPtr<Statement> parse_statement();
|
||||
|
||||
enum class AllowLabelledFunction {
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
|
||||
NonnullRefPtr<Statement> parse_statement(AllowLabelledFunction allow_labelled_function = AllowLabelledFunction::No);
|
||||
NonnullRefPtr<BlockStatement> parse_block_statement();
|
||||
NonnullRefPtr<BlockStatement> parse_block_statement(bool& is_strict, bool error_on_binding = false);
|
||||
NonnullRefPtr<ReturnStatement> parse_return_statement();
|
||||
|
@ -91,7 +97,7 @@ public:
|
|||
NonnullRefPtr<ExportStatement> parse_export_statement(Program& program);
|
||||
|
||||
RefPtr<FunctionExpression> try_parse_arrow_function_expression(bool expect_parens);
|
||||
RefPtr<Statement> try_parse_labelled_statement();
|
||||
RefPtr<Statement> try_parse_labelled_statement(AllowLabelledFunction allow_function);
|
||||
RefPtr<MetaProperty> try_parse_new_target_expression();
|
||||
|
||||
struct Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue