mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00:00
LibJS: Rename OrdinaryFunctionObject to ECMAScriptFunctionObject
The old name is the result of the perhaps somewhat confusingly named abstract operation OrdinaryFunctionCreate(), which creates an "ordinary object" (https://tc39.es/ecma262/#ordinary-object) in contrast to an "exotic object" (https://tc39.es/ecma262/#exotic-object). However, the term "Ordinary Function" is not used anywhere in the spec, instead the created object is referred to as an "ECMAScript Function Object" (https://tc39.es/ecma262/#sec-ecmascript-function-objects), so let's call it that. The "ordinary" vs. "exotic" distinction is important because there are also "Built-in Function Objects", which can be either implemented as ordinary ECMAScript function objects, or as exotic objects (our NativeFunction). More work needs to be done to move a lot of infrastructure to ECMAScriptFunctionObject in order to make FunctionObject nothing more than an interface for objects that implement [[Call]] and optionally [[Construct]].
This commit is contained in:
parent
d787775806
commit
e37cf73300
19 changed files with 55 additions and 57 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/Array.h>
|
||||
#include <LibJS/Runtime/BoundFunction.h>
|
||||
#include <LibJS/Runtime/ECMAScriptFunctionObject.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/FinalizationRegistry.h>
|
||||
#include <LibJS/Runtime/FunctionEnvironment.h>
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/IteratorOperations.h>
|
||||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
#include <LibJS/Runtime/OrdinaryFunctionObject.h>
|
||||
#include <LibJS/Runtime/PromiseReaction.h>
|
||||
#include <LibJS/Runtime/Reference.h>
|
||||
#include <LibJS/Runtime/Symbol.h>
|
||||
|
@ -377,7 +377,7 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object)
|
|||
if (context.function->is_strict_mode() || !context.function->has_simple_parameter_list()) {
|
||||
context.arguments_object = create_unmapped_arguments_object(global_object, context.arguments.span());
|
||||
} else {
|
||||
context.arguments_object = create_mapped_arguments_object(global_object, *context.function, verify_cast<OrdinaryFunctionObject>(context.function)->parameters(), context.arguments.span(), *lexical_environment());
|
||||
context.arguments_object = create_mapped_arguments_object(global_object, *context.function, verify_cast<ECMAScriptFunctionObject>(context.function)->parameters(), context.arguments.span(), *lexical_environment());
|
||||
}
|
||||
}
|
||||
return context.arguments_object;
|
||||
|
@ -479,7 +479,7 @@ Value VM::construct(FunctionObject& function, FunctionObject& new_target, Option
|
|||
this_argument = TRY_OR_DISCARD(ordinary_create_from_constructor<Object>(global_object, new_target, &GlobalObject::object_prototype));
|
||||
|
||||
// FIXME: prepare_for_ordinary_call() is not supposed to receive a BoundFunction, ProxyObject, etc. - ever.
|
||||
// This needs to be moved to NativeFunction/OrdinaryFunctionObject's construct() (10.2.2 [[Construct]])
|
||||
// This needs to be moved to NativeFunction/ECMAScriptFunctionObject's construct() (10.2.2 [[Construct]])
|
||||
ExecutionContext callee_context(heap());
|
||||
prepare_for_ordinary_call(function, callee_context, &new_target);
|
||||
if (exception())
|
||||
|
@ -677,7 +677,7 @@ ThrowCompletionOr<Value> VM::call_internal(FunctionObject& function, Value this_
|
|||
}
|
||||
|
||||
// FIXME: prepare_for_ordinary_call() is not supposed to receive a BoundFunction, ProxyObject, etc. - ever.
|
||||
// This needs to be moved to NativeFunction/OrdinaryFunctionObject's construct() (10.2.2 [[Construct]])
|
||||
// This needs to be moved to NativeFunction/ECMAScriptFunctionObject's construct() (10.2.2 [[Construct]])
|
||||
ExecutionContext callee_context(heap());
|
||||
prepare_for_ordinary_call(function, callee_context, nullptr);
|
||||
if (auto* exception = this->exception())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue