1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-03 00:42:14 +00:00

LibJS: Support empty statements

We already skipped random semicolons in Parser::parse_program(), but now
they are properly matched and parsed as empty statements - and thus
recognized as a valid body of an if / else / while / ... statement.
This commit is contained in:
Linus Groh 2020-05-03 10:59:00 +01:00 committed by Andreas Kling
parent 3b432eed98
commit 32742709dc
3 changed files with 23 additions and 4 deletions

View file

@ -71,6 +71,12 @@ private:
class Statement : public ASTNode {
};
class EmptyStatement final : public Statement {
public:
Value execute(Interpreter&) const override { return js_undefined(); }
const char* class_name() const override { return "EmptyStatement"; }
};
class ErrorStatement final : public Statement {
public:
Value execute(Interpreter&) const override { return js_undefined(); }