!2006 asyncfuction bugfix

Merge pull request !2006 from lukai/asyncbugfix
This commit is contained in:
openharmony_ci 2022-08-10 02:13:52 +00:00 committed by Gitee
commit 411d56172f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 14 additions and 4 deletions

View File

@ -220,10 +220,6 @@ void Builtins::Initialize(const JSHandle<GlobalEnv> &env, JSThread *thread)
// initialize Function, forbidden change order
InitializeFunction(env, emptyFuncDynclass);
JSHandle<JSHClass> asyncFuncClass = factory_->CreateFunctionClass(
FunctionKind::ASYNC_FUNCTION, JSAsyncFunction::SIZE, JSType::JS_ASYNC_FUNCTION, env->GetFunctionPrototype());
env->SetAsyncFunctionClass(thread_, asyncFuncClass);
JSHandle<JSHClass> asyncAwaitStatusFuncClass =
factory_->CreateFunctionClass(FunctionKind::NORMAL_FUNCTION, JSAsyncAwaitStatusFunction::SIZE,
JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION, env->GetFunctionPrototype());
@ -333,6 +329,10 @@ void Builtins::Initialize(const JSHandle<GlobalEnv> &env, JSThread *thread)
JSType::JS_ASYNC_GENERATOR_FUNCTION, env->GetAsyncGeneratorFunctionPrototype());
env->SetAsyncGeneratorFunctionClass(thread_, asyncGenetatorFuncClass);
env->SetObjectFunctionPrototypeClass(thread_, JSTaggedValue(objFuncPrototype->GetClass()));
JSHandle<JSHClass> asyncFuncClass = factory_->CreateFunctionClass(
FunctionKind::ASYNC_FUNCTION, JSAsyncFunction::SIZE, JSType::JS_ASYNC_FUNCTION,
env->GetAsyncFunctionPrototype());
env->SetAsyncFunctionClass(thread_, asyncFuncClass);
thread_->ResetGuardians();
thread_->SetGlueGlobalEnv(reinterpret_cast<GlobalEnv *>(env.GetTaggedType()));
}

View File

@ -23,6 +23,11 @@ var arrow = () => {}
var async_arrow = async () => {}
print(foo.name)
print(foo.call != undefined)
print(foo.__proto__.constructor.name);
print(foo.__proto__.__proto__.constructor.name);
print(foo.__proto__.__proto__.__proto__.constructor.name);
print(foo.length)
print(arrow.name)
print(async_arrow.name)

View File

@ -12,6 +12,11 @@
# limitations under the License.
foo
true
AsyncFunction
Function
Object
0
arrow
async_arrow
true