mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
[Bug]: AsyncGeneratorResolve遇到空队列问题
在debug模式下,挂在AsyncGeneratorResolve字节码遇到空队列, 按照ECMA规范分析,执行两次next()后,状态应该为completed且队列应该为空。此时,不需要进入对应逻辑。 Issue: #I7HA9B Signed-off-by: lichenshuai <lichenshuai@huawei.com> Change-Id: I6559bd8d60f78341ee6783d636b6d6fa7fe55391
This commit is contained in:
parent
d9a0ed1bb7
commit
a99fcc7f30
@ -359,6 +359,10 @@ JSTaggedValue RuntimeStubs::RuntimeAsyncGeneratorResolve(JSThread *thread, JSHan
|
||||
|
||||
ASSERT(flag.IsBoolean());
|
||||
bool done = flag.IsTrue();
|
||||
if (asyncGeneratorObjHandle->GetAsyncGeneratorState() == JSAsyncGeneratorState::COMPLETED &&
|
||||
TaggedQueue::Cast(asyncGeneratorObjHandle->GetAsyncGeneratorQueue().GetTaggedObject())->Empty()) {
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, asyncGeneratorObjHandle, valueHandle, done);
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,17 @@ async function *a() {
|
||||
print(c);
|
||||
}
|
||||
|
||||
async function *f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let b = a();
|
||||
print("asyncgenerator next start");
|
||||
b.next();
|
||||
b.next(3);
|
||||
|
||||
const g = f();
|
||||
g.next();
|
||||
g.next();
|
||||
print("asyncgenerator double next");
|
||||
print("asyncgenerator next end");
|
@ -14,6 +14,7 @@
|
||||
async generator start
|
||||
asyncgenerator next start
|
||||
1
|
||||
asyncgenerator double next
|
||||
asyncgenerator next end
|
||||
3
|
||||
asyncgenerator return start
|
||||
|
Loading…
Reference in New Issue
Block a user