Jelajahi Sumber

LibJS: Mark more ASTNode classes as `final`

Linus Groh 4 tahun lalu
induk
melakukan
fd32f00839
1 mengubah file dengan 17 tambahan dan 17 penghapusan
  1. 17 17
      Libraries/LibJS/AST.h

+ 17 - 17
Libraries/LibJS/AST.h

@@ -143,7 +143,7 @@ private:
     bool m_strict_mode { false };
 };
 
-class Program : public ScopeNode {
+class Program final : public ScopeNode {
 public:
     Program() { }
 
@@ -152,7 +152,7 @@ private:
     virtual const char* class_name() const override { return "Program"; }
 };
 
-class BlockStatement : public ScopeNode {
+class BlockStatement final : public ScopeNode {
 public:
     BlockStatement() { }
 
@@ -248,7 +248,7 @@ public:
     const char* class_name() const override { return "ErrorExpression"; }
 };
 
-class ReturnStatement : public Statement {
+class ReturnStatement final : public Statement {
 public:
     explicit ReturnStatement(RefPtr<Expression> argument)
         : m_argument(move(argument))
@@ -266,7 +266,7 @@ private:
     RefPtr<Expression> m_argument;
 };
 
-class IfStatement : public Statement {
+class IfStatement final : public Statement {
 public:
     IfStatement(NonnullRefPtr<Expression> predicate, NonnullRefPtr<Statement> consequent, RefPtr<Statement> alternate)
         : m_predicate(move(predicate))
@@ -290,7 +290,7 @@ private:
     RefPtr<Statement> m_alternate;
 };
 
-class WhileStatement : public Statement {
+class WhileStatement final : public Statement {
 public:
     WhileStatement(NonnullRefPtr<Expression> test, NonnullRefPtr<Statement> body)
         : m_test(move(test))
@@ -311,7 +311,7 @@ private:
     NonnullRefPtr<Statement> m_body;
 };
 
-class DoWhileStatement : public Statement {
+class DoWhileStatement final : public Statement {
 public:
     DoWhileStatement(NonnullRefPtr<Expression> test, NonnullRefPtr<Statement> body)
         : m_test(move(test))
@@ -332,7 +332,7 @@ private:
     NonnullRefPtr<Statement> m_body;
 };
 
-class ForStatement : public Statement {
+class ForStatement final : public Statement {
 public:
     ForStatement(RefPtr<ASTNode> init, RefPtr<Expression> test, RefPtr<Expression> update, NonnullRefPtr<Statement> body)
         : m_init(move(init))
@@ -359,7 +359,7 @@ private:
     NonnullRefPtr<Statement> m_body;
 };
 
-class ForInStatement : public Statement {
+class ForInStatement final : public Statement {
 public:
     ForInStatement(NonnullRefPtr<ASTNode> lhs, NonnullRefPtr<Expression> rhs, NonnullRefPtr<Statement> body)
         : m_lhs(move(lhs))
@@ -383,7 +383,7 @@ private:
     NonnullRefPtr<Statement> m_body;
 };
 
-class ForOfStatement : public Statement {
+class ForOfStatement final : public Statement {
 public:
     ForOfStatement(NonnullRefPtr<ASTNode> lhs, NonnullRefPtr<Expression> rhs, NonnullRefPtr<Statement> body)
         : m_lhs(move(lhs))
@@ -432,7 +432,7 @@ enum class BinaryOp {
     InstanceOf,
 };
 
-class BinaryExpression : public Expression {
+class BinaryExpression final : public Expression {
 public:
     BinaryExpression(BinaryOp op, NonnullRefPtr<Expression> lhs, NonnullRefPtr<Expression> rhs)
         : m_op(op)
@@ -458,7 +458,7 @@ enum class LogicalOp {
     NullishCoalescing,
 };
 
-class LogicalExpression : public Expression {
+class LogicalExpression final : public Expression {
 public:
     LogicalExpression(LogicalOp op, NonnullRefPtr<Expression> lhs, NonnullRefPtr<Expression> rhs)
         : m_op(op)
@@ -488,7 +488,7 @@ enum class UnaryOp {
     Delete,
 };
 
-class UnaryExpression : public Expression {
+class UnaryExpression final : public Expression {
 public:
     UnaryExpression(UnaryOp op, NonnullRefPtr<Expression> lhs)
         : m_op(op)
@@ -811,7 +811,7 @@ enum class AssignmentOp {
     UnsignedRightShiftAssignment,
 };
 
-class AssignmentExpression : public Expression {
+class AssignmentExpression final : public Expression {
 public:
     AssignmentExpression(AssignmentOp op, NonnullRefPtr<Expression> lhs, NonnullRefPtr<Expression> rhs)
         : m_op(op)
@@ -836,7 +836,7 @@ enum class UpdateOp {
     Decrement,
 };
 
-class UpdateExpression : public Expression {
+class UpdateExpression final : public Expression {
 public:
     UpdateExpression(UpdateOp op, NonnullRefPtr<Expression> argument, bool prefixed = false)
         : m_op(op)
@@ -888,7 +888,7 @@ private:
     RefPtr<Expression> m_init;
 };
 
-class VariableDeclaration : public Declaration {
+class VariableDeclaration final : public Declaration {
 public:
     VariableDeclaration(DeclarationKind declaration_kind, NonnullRefPtrVector<VariableDeclarator> declarations)
         : m_declaration_kind(declaration_kind)
@@ -950,7 +950,7 @@ private:
     bool m_is_method { false };
 };
 
-class ObjectExpression : public Expression {
+class ObjectExpression final : public Expression {
 public:
     ObjectExpression(NonnullRefPtrVector<ObjectProperty> properties = {})
         : m_properties(move(properties))
@@ -966,7 +966,7 @@ private:
     NonnullRefPtrVector<ObjectProperty> m_properties;
 };
 
-class ArrayExpression : public Expression {
+class ArrayExpression final : public Expression {
 public:
     ArrayExpression(Vector<RefPtr<Expression>> elements)
         : m_elements(move(elements))