mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
LibJS: Rename FunctionKind::{Regular => Normal}
This is what CreateDynamicFunction calls it.
This commit is contained in:
parent
0d65af5e0f
commit
0c73fbbba5
8 changed files with 24 additions and 24 deletions
|
@ -32,7 +32,7 @@ ECMAScriptFunctionObject* ECMAScriptFunctionObject::create(GlobalObject& global_
|
|||
{
|
||||
Object* prototype = nullptr;
|
||||
switch (kind) {
|
||||
case FunctionKind::Regular:
|
||||
case FunctionKind::Normal:
|
||||
prototype = global_object.function_prototype();
|
||||
break;
|
||||
case FunctionKind::Generator:
|
||||
|
@ -99,7 +99,7 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
|||
if (!m_is_arrow_function) {
|
||||
Object* prototype = nullptr;
|
||||
switch (m_kind) {
|
||||
case FunctionKind::Regular:
|
||||
case FunctionKind::Normal:
|
||||
prototype = vm.heap().allocate<Object>(global_object, *global_object.new_ordinary_function_prototype_object_shape());
|
||||
MUST(prototype->define_property_or_throw(vm.names.constructor, { .value = this, .writable = true, .enumerable = false, .configurable = true }));
|
||||
break;
|
||||
|
@ -787,7 +787,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
|
||||
// NOTE: Running the bytecode should eventually return a completion.
|
||||
// Until it does, we assume "return" and include the undefined fallback from the call site.
|
||||
if (m_kind == FunctionKind::Regular)
|
||||
if (m_kind == FunctionKind::Normal)
|
||||
return { Completion::Type::Return, result.value_or(js_undefined()), {} };
|
||||
|
||||
auto generator_object = TRY(GeneratorObject::create(global_object(), result, this, vm.running_execution_context().copy(), move(*result_and_frame.frame)));
|
||||
|
@ -813,7 +813,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
VM::InterpreterExecutionScope scope(*ast_interpreter);
|
||||
|
||||
// FunctionBody : FunctionStatementList
|
||||
if (m_kind == FunctionKind::Regular) {
|
||||
if (m_kind == FunctionKind::Normal) {
|
||||
// 1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
|
||||
TRY(function_declaration_instantiation(ast_interpreter));
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
bool has_simple_parameter_list() const { return m_has_simple_parameter_list; }
|
||||
|
||||
// Equivalent to absence of [[Construct]]
|
||||
virtual bool has_constructor() const override { return m_kind == FunctionKind::Regular && !m_is_arrow_function; }
|
||||
virtual bool has_constructor() const override { return m_kind == FunctionKind::Normal && !m_is_arrow_function; }
|
||||
|
||||
FunctionKind kind() const { return m_kind; }
|
||||
|
||||
|
@ -113,7 +113,7 @@ private:
|
|||
FlyString m_name;
|
||||
Optional<Bytecode::Executable> m_bytecode_executable;
|
||||
i32 m_function_length { 0 };
|
||||
FunctionKind m_kind { FunctionKind::Regular };
|
||||
FunctionKind m_kind { FunctionKind::Normal };
|
||||
bool m_might_need_arguments_object { true };
|
||||
bool m_contains_direct_call_to_eval { true };
|
||||
bool m_is_arrow_function { false };
|
||||
|
|
|
@ -76,7 +76,7 @@ ThrowCompletionOr<Value> FunctionConstructor::call()
|
|||
ThrowCompletionOr<Object*> FunctionConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto function = TRY(create_dynamic_function_node(global_object(), new_target, FunctionKind::Regular));
|
||||
auto function = TRY(create_dynamic_function_node(global_object(), new_target, FunctionKind::Normal));
|
||||
|
||||
OwnPtr<Interpreter> local_interpreter;
|
||||
Interpreter* interpreter = vm.interpreter_if_exists();
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
namespace JS {
|
||||
|
||||
enum class FunctionKind {
|
||||
Normal,
|
||||
Generator,
|
||||
Regular,
|
||||
Async,
|
||||
AsyncGenerator
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue