1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

LibJS: Implement basic support for the "new" keyword

NewExpression mostly piggybacks on the existing CallExpression. The big
difference is that "new" creates a new Object and passes it as |this|
to the callee.
This commit is contained in:
Andreas Kling 2020-03-28 16:33:52 +01:00
parent fecbef4ffe
commit 0593ce406b
5 changed files with 67 additions and 9 deletions

View file

@ -63,6 +63,7 @@ public:
NonnullRefPtr<ArrayExpression> parse_array_expression();
NonnullRefPtr<Expression> parse_secondary_expression(NonnullRefPtr<Expression>, int min_precedence, Associativity associate = Associativity::Right);
NonnullRefPtr<CallExpression> parse_call_expression(NonnullRefPtr<Expression>);
NonnullRefPtr<NewExpression> parse_new_expression();
bool has_errors() const { return m_has_errors; }