18
18
#include < LibJS/Bytecode/CodeGenerationError.h>
19
19
#include < LibJS/Bytecode/Executable.h>
20
20
#include < LibJS/Bytecode/IdentifierTable.h>
21
+ #include < LibJS/Bytecode/Op.h>
21
22
#include < LibJS/Bytecode/Operand.h>
22
23
#include < LibJS/Forward.h>
23
24
#include < LibJS/Heap/Handle.h>
@@ -710,6 +711,9 @@ class FunctionNode {
710
711
FunctionKind kind () const { return m_kind; }
711
712
UsesThis uses_this () const { return m_uses_this; }
712
713
714
+ virtual bool has_name () const = 0;
715
+ virtual Value instantiate_ordinary_function_expression (VM&, DeprecatedFlyString given_name) const = 0;
716
+
713
717
protected:
714
718
FunctionNode (RefPtr<Identifier const > name, ByteString source_text, NonnullRefPtr<Statement const > body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Vector<DeprecatedFlyString> local_variables_names, UsesThis uses_this)
715
719
: m_name(move(name))
@@ -769,6 +773,12 @@ class FunctionDeclaration final
769
773
770
774
void set_should_do_additional_annexB_steps () { m_is_hoisted = true ; }
771
775
776
+ bool has_name () const override { return true ; }
777
+ Value instantiate_ordinary_function_expression (VM&, DeprecatedFlyString) const override
778
+ {
779
+ VERIFY_NOT_REACHED ();
780
+ }
781
+
772
782
private:
773
783
bool m_is_hoisted { false };
774
784
};
@@ -790,9 +800,9 @@ class FunctionExpression final
790
800
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::Operand>> generate_bytecode (Bytecode::Generator&, Optional<Bytecode::Operand> preferred_dst = {}) const override ;
791
801
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::Operand>> generate_bytecode_with_lhs_name (Bytecode::Generator&, Optional<Bytecode::IdentifierTableIndex> lhs_name, Optional<Bytecode::Operand> preferred_dst = {}) const ;
792
802
793
- bool has_name () const { return !name ().is_empty (); }
803
+ bool has_name () const override { return !name ().is_empty (); }
794
804
795
- Value instantiate_ordinary_function_expression (VM&, DeprecatedFlyString given_name) const ;
805
+ Value instantiate_ordinary_function_expression (VM&, DeprecatedFlyString given_name) const override ;
796
806
797
807
private:
798
808
virtual bool is_function_expression () const override { return true ; }
@@ -2181,6 +2191,8 @@ class SyntheticReferenceExpression final : public Expression {
2181
2191
Value m_value;
2182
2192
};
2183
2193
2194
+ Bytecode::CodeGenerationErrorOr<void > generate_binding_pattern_bytecode (Bytecode::Generator& generator, BindingPattern const & pattern, Bytecode::Op::SetVariable::InitializationMode, Bytecode::Operand const & input_value, bool create_variables);
2195
+
2184
2196
template <>
2185
2197
inline bool ASTNode::fast_is<NewExpression>() const { return is_new_expression (); }
2186
2198
0 commit comments