mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibJS: Defer Value construction until a Literal is executed
Remove the need to construct a full Value during parsing. This means we don't have to worry about plumbing the heap into the parser. The Literal ASTNode now has a bunch of subclasses that synthesize a Value on demand.
This commit is contained in:
parent
4d942cc1d0
commit
425fd3ce51
3 changed files with 73 additions and 8 deletions
|
@ -86,9 +86,9 @@ NonnullOwnPtr<Expression> Parser::parse_primary_expression()
|
|||
case TokenType::Identifier:
|
||||
return make<Identifier>(consume().value());
|
||||
case TokenType::NumericLiteral:
|
||||
return make<Literal>(Value(consume().double_value()));
|
||||
return make<NumericLiteral>(consume().double_value());
|
||||
case TokenType::BoolLiteral:
|
||||
return make<Literal>(Value(consume().bool_value()));
|
||||
return make<BooleanLiteral>(consume().bool_value());
|
||||
case TokenType::CurlyOpen:
|
||||
return parse_object_expression();
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue