mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibJS: Treat arrow expression as function and stop parsing after
This commit is contained in:
parent
e31b715808
commit
05444103e3
Notes:
sideshowbarker
2024-07-18 05:37:07 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/05444103e39 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
@ -820,7 +820,7 @@ Parser::PrimaryExpressionParseResult Parser::parse_primary_expression()
|
|||||||
|
|
||||||
auto arrow_function_result = try_parse_arrow_function_expression(true);
|
auto arrow_function_result = try_parse_arrow_function_expression(true);
|
||||||
if (!arrow_function_result.is_null())
|
if (!arrow_function_result.is_null())
|
||||||
return { arrow_function_result.release_nonnull() };
|
return { arrow_function_result.release_nonnull(), false };
|
||||||
|
|
||||||
set_try_parse_arrow_function_expression_failed_at_position(paren_position, true);
|
set_try_parse_arrow_function_expression_failed_at_position(paren_position, true);
|
||||||
}
|
}
|
||||||
@ -846,7 +846,7 @@ Parser::PrimaryExpressionParseResult Parser::parse_primary_expression()
|
|||||||
if (!try_parse_arrow_function_expression_failed_at_position(position())) {
|
if (!try_parse_arrow_function_expression_failed_at_position(position())) {
|
||||||
auto arrow_function_result = try_parse_arrow_function_expression(false);
|
auto arrow_function_result = try_parse_arrow_function_expression(false);
|
||||||
if (!arrow_function_result.is_null())
|
if (!arrow_function_result.is_null())
|
||||||
return { arrow_function_result.release_nonnull() };
|
return { arrow_function_result.release_nonnull(), false };
|
||||||
|
|
||||||
set_try_parse_arrow_function_expression_failed_at_position(position(), true);
|
set_try_parse_arrow_function_expression_failed_at_position(position(), true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user