mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Implement MetaProperty(new.target) (#397)
* add some missed public api functions Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
b656248ce4
commit
b33e7df9a2
24 changed files with 241 additions and 115 deletions
|
|
@ -155,6 +155,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class ScriptFunctionObjectNewTargetBinderWithConstruct {
|
||||
public:
|
||||
void operator()(ExecutionState& calleeState, FunctionObject* self, Object* newTarget, FunctionEnvironmentRecord* record)
|
||||
{
|
||||
record->setNewTarget(newTarget);
|
||||
}
|
||||
};
|
||||
|
||||
Object* ScriptFunctionObject::construct(ExecutionState& state, const size_t argc, NULLABLE Value* argv, Object* newTarget)
|
||||
{
|
||||
if (UNLIKELY(!newTarget->isConstructor())) {
|
||||
|
|
@ -186,9 +194,7 @@ Object* ScriptFunctionObject::construct(ExecutionState& state, const size_t argc
|
|||
thisArgument->setPrototype(state, proto);
|
||||
// ReturnIfAbrupt(thisArgument).
|
||||
|
||||
// We don't need to setNewTarget here
|
||||
// only `super` keyword uses getNewTarget on executing
|
||||
return FunctionObjectProcessCallGenerator::processCall<ScriptFunctionObject, false, true, false, false, ScriptFunctionObjectObjectThisValueBinderWithConstruct, FunctionObjectNewTargetBinder, ScriptFunctionObjectReturnValueBinderWithConstruct>(state, this, Value(thisArgument), argc, argv, newTarget).asObject();
|
||||
return FunctionObjectProcessCallGenerator::processCall<ScriptFunctionObject, false, true, true, false, ScriptFunctionObjectObjectThisValueBinderWithConstruct, ScriptFunctionObjectNewTargetBinderWithConstruct, ScriptFunctionObjectReturnValueBinderWithConstruct>(state, this, Value(thisArgument), argc, argv, newTarget).asObject();
|
||||
}
|
||||
|
||||
void ScriptFunctionObject::generateArgumentsObject(ExecutionState& state, size_t argc, Value* argv, FunctionEnvironmentRecord* environmentRecordWillArgumentsObjectBeLocatedIn, Value* stackStorage, bool isMapped)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue