Use Function's Context when throw exception

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2021-08-18 13:07:31 +09:00 committed by Boram Bae
commit a07fe9ed1e
7 changed files with 20 additions and 8 deletions

View file

@ -75,7 +75,9 @@ Value ScriptGeneratorFunctionObject::call(ExecutionState& state, const Value& th
Value ScriptGeneratorFunctionObject::construct(ExecutionState& state, const size_t argc, Value* argv, Object* newTarget)
{
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "Generator cannot be invoked with 'new'");
ExecutionState newState(m_codeBlock->context(), &state,
static_cast<LexicalEnvironment*>(nullptr), argc, argv, m_codeBlock->asInterpretedCodeBlock()->isStrict());
ErrorObject::throwBuiltinError(newState, ErrorObject::TypeError, "Generator cannot be invoked with 'new'");
ASSERT_NOT_REACHED();
return Value();
}