Implement GeneratorFunction constructor (#350)

* Fix some bugs
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
This commit is contained in:
Boram Bae 2019-08-06 22:12:49 +09:00 committed by Patrick Kim
commit de65761ac7
8 changed files with 27 additions and 25 deletions

View file

@ -2387,12 +2387,12 @@ NEVER_INLINE void ByteCodeInterpreter::classOperation(ExecutionState& state, Cre
} else {
if (!heritagePresent) {
Value argv[] = { String::emptyString, String::emptyString };
auto functionSource = FunctionObject::createFunctionSourceFromScriptSource(state, state.context()->staticStrings().constructor, 1, &argv[0], argv[1], true);
auto functionSource = FunctionObject::createFunctionSourceFromScriptSource(state, state.context()->staticStrings().constructor, 1, &argv[0], argv[1], true, false);
functionSource.codeBlock->setAsClassConstructor();
constructor = new ScriptClassConstructorFunctionObject(state, functionSource.codeBlock, functionSource.outerEnvironment, proto);
} else {
Value argv[] = { new ASCIIString("...args"), new ASCIIString("super(...args)") };
auto functionSource = FunctionObject::createFunctionSourceFromScriptSource(state, state.context()->staticStrings().constructor, 1, &argv[0], argv[1], true);
auto functionSource = FunctionObject::createFunctionSourceFromScriptSource(state, state.context()->staticStrings().constructor, 1, &argv[0], argv[1], true, false);
functionSource.codeBlock->setAsClassConstructor();
functionSource.codeBlock->setAsDerivedClassConstructor();
constructor = new ScriptClassConstructorFunctionObject(state, functionSource.codeBlock, functionSource.outerEnvironment, proto);