Selaa lähdekoodia

LibJS: Add fast_is<T>() for FunctionDeclaration

Andreas Kling 3 vuotta sitten
vanhempi
commit
527a6f4ded
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      Userland/Libraries/LibJS/AST.h

+ 4 - 2
Userland/Libraries/LibJS/AST.h

@@ -69,6 +69,7 @@ public:
     virtual bool is_identifier() const { return false; }
     virtual bool is_scope_node() const { return false; }
     virtual bool is_program() const { return false; }
+    virtual bool is_function_declaration() const { return false; }
 
 protected:
     explicit ASTNode(SourceRange source_range)
@@ -378,8 +379,6 @@ public:
     // 8.1.3 Static Semantics: IsConstantDeclaration, https://tc39.es/ecma262/#sec-static-semantics-isconstantdeclaration
     virtual bool is_constant_declaration() const { return false; }
 
-    virtual bool is_function_declaration() const { return false; }
-
     virtual bool is_lexical_declaration() const { return false; }
 };
 
@@ -1787,4 +1786,7 @@ inline bool ASTNode::fast_is<ScopeNode>() const { return is_scope_node(); }
 template<>
 inline bool ASTNode::fast_is<Program>() const { return is_program(); }
 
+template<>
+inline bool ASTNode::fast_is<FunctionDeclaration>() const { return is_function_declaration(); }
+
 }