mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibJS: Implement null and undefined literals
This commit is contained in:
parent
7aad10d984
commit
cfd710eb31
Notes:
sideshowbarker
2024-07-19 08:16:59 +09:00
Author: https://github.com/0xtechnobabble
Commit: cfd710eb31
Pull-request: https://github.com/SerenityOS/serenity/pull/1470
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/oriko1010
6 changed files with 61 additions and 0 deletions
|
@ -349,6 +349,18 @@ void BooleanLiteral::dump(int indent) const
|
|||
printf("BooleanLiteral %s\n", m_value ? "true" : "false");
|
||||
}
|
||||
|
||||
void UndefinedLiteral::dump(int indent) const
|
||||
{
|
||||
print_indent(indent);
|
||||
printf("undefined\n");
|
||||
}
|
||||
|
||||
void NullLiteral::dump(int indent) const
|
||||
{
|
||||
print_indent(indent);
|
||||
printf("null\n");
|
||||
}
|
||||
|
||||
void FunctionDeclaration::dump(int indent) const
|
||||
{
|
||||
bool first_time = true;
|
||||
|
@ -617,4 +629,14 @@ Value BooleanLiteral::execute(Interpreter&) const
|
|||
return Value(m_value);
|
||||
}
|
||||
|
||||
Value UndefinedLiteral::execute(Interpreter&) const
|
||||
{
|
||||
return js_undefined();
|
||||
}
|
||||
|
||||
Value NullLiteral::execute(Interpreter&) const
|
||||
{
|
||||
return js_null();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue