mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:15:07 +00:00
LibJS: Parse "try", "catch" and "finally"
This is the first step towards support exceptions. :^)
This commit is contained in:
parent
404de10a15
commit
c33d4aefc3
5 changed files with 132 additions and 1 deletions
|
@ -715,4 +715,44 @@ Value ArrayExpression::execute(Interpreter& interpreter) const
|
|||
return array;
|
||||
}
|
||||
|
||||
void TryStatement::dump(int indent) const
|
||||
{
|
||||
ASTNode::dump(indent);
|
||||
print_indent(indent);
|
||||
printf("(Block)\n");
|
||||
block().dump(indent + 1);
|
||||
|
||||
if (handler()) {
|
||||
print_indent(indent);
|
||||
printf("(Handler)\n");
|
||||
handler()->dump(indent + 1);
|
||||
}
|
||||
|
||||
if (finalizer()) {
|
||||
print_indent(indent);
|
||||
printf("(Finalizer)\n");
|
||||
finalizer()->dump(indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void CatchClause::dump(int indent) const
|
||||
{
|
||||
print_indent(indent);
|
||||
printf("CatchClause");
|
||||
if (!m_parameter.is_null())
|
||||
printf(" (%s)", m_parameter.characters());
|
||||
printf("\n");
|
||||
body().dump(indent + 1);
|
||||
}
|
||||
|
||||
Value TryStatement::execute(Interpreter&) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Value CatchClause::execute(Interpreter&) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue