LibJS: Implement parsing and execution of optional chains

This commit is contained in:
Ali Mohammad Pur 2021-09-14 06:56:31 +04:30 committed by Linus Groh
commit 72ddaa31e3
Notes: sideshowbarker 2024-07-18 03:58:17 +09:00
6 changed files with 318 additions and 42 deletions

View file

@ -76,6 +76,7 @@ public:
NonnullRefPtr<WithStatement> parse_with_statement();
NonnullRefPtr<DebuggerStatement> parse_debugger_statement();
NonnullRefPtr<ConditionalExpression> parse_conditional_expression(NonnullRefPtr<Expression> test);
NonnullRefPtr<OptionalChain> parse_optional_chain(NonnullRefPtr<Expression> base);
NonnullRefPtr<Expression> parse_expression(int min_precedence, Associativity associate = Associativity::Right, const Vector<TokenType>& forbidden = {});
PrimaryExpressionParseResult parse_primary_expression();
NonnullRefPtr<Expression> parse_unary_prefixed_expression();
@ -100,6 +101,8 @@ public:
RefPtr<Statement> try_parse_labelled_statement(AllowLabelledFunction allow_function);
RefPtr<MetaProperty> try_parse_new_target_expression();
Vector<CallExpression::Argument> parse_arguments();
struct Error {
String message;
Optional<Position> position;