Files
xliu 8527f0ca83 Fix Asyncfunction Reject
Description
  Update the value of ACC to the value returned by reject
Issue:
  #I54KKQ:Fix Asyncfunction Reject

Signed-off-by: xliu <liuxin259@huawei.com>
Change-Id: Ie4916e08091d31002f581d5f0c4e80d11fb2cbe6
2022-04-25 15:08:15 +08:00

48 lines
1.1 KiB
JavaScript

/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
async function foo() {
var a = await 1
print(a)
}
var s = foo()
var arrow = () => {}
var async_arrow = async () => {}
print(foo.name)
print(arrow.name)
print(async_arrow.name)
s.then(msg=>{
print(msg)
})
// should return Promise
async function testAsync() {
throw new Error("hello world!!!");
}
var a = testAsync();
print(a instanceof Promise);
a.then(
function (result) {
print("testAsync success!!!");
},
function (result) {
print("testAsync failed: " + result);
}
)
print("main over");