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:
parent
3b432eed98
commit
32742709dc
3 changed files with 23 additions and 4 deletions
|
@ -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(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue