summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/AST.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-24 14:03:55 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-24 16:14:10 +0100
commitc33d4aefc3eb1d91d90c55b4d18e6b972fd8d6eb (patch)
treef13f55382d84fe0d23f9be4fd17090e12b672f8b /Libraries/LibJS/AST.cpp
parent404de10a151650fd0f69d4c9347a509757941d5f (diff)
downloadserenity-c33d4aefc3eb1d91d90c55b4d18e6b972fd8d6eb.zip
LibJS: Parse "try", "catch" and "finally"
This is the first step towards support exceptions. :^)
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r--Libraries/LibJS/AST.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index f89b3b0f5a..936f48d18c 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -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 {};
+}
+
}