LibJS: Implement null and undefined literals

This commit is contained in:
0xtechnobabble 2020-03-15 23:32:34 +02:00 committed by Andreas Kling
parent 7aad10d984
commit cfd710eb31
Notes: sideshowbarker 2024-07-19 08:16:59 +09:00
6 changed files with 61 additions and 0 deletions

View file

@ -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();
}
}