mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
style: 自动格式化
This commit is contained in:
@@ -433,9 +433,7 @@ fn stmt_has_top_level_await(stmt: &Statement) -> bool {
|
||||
.declarations
|
||||
.iter()
|
||||
.any(|d| d.init.as_ref().is_some_and(|i| expr_has_top_level_await(i))),
|
||||
Declaration::ClassDeclaration(cls) => {
|
||||
cls.super_class.as_ref().is_some_and(expr_has_top_level_await)
|
||||
}
|
||||
Declaration::ClassDeclaration(cls) => cls.super_class.as_ref().is_some_and(expr_has_top_level_await),
|
||||
_ => false,
|
||||
}),
|
||||
// `export default await ...` 是顶层 await;函数/类声明形态体不进入(同口径),
|
||||
|
||||
@@ -603,12 +603,8 @@ fn if_test_await_makes_module_async() {
|
||||
/// 表达式)是顶层 await,模块标记异步、体 await 编译为 AWAIT;类体不进入游走。
|
||||
#[test]
|
||||
fn extends_await_makes_module_async() {
|
||||
let (ir, _) = emit_module(
|
||||
"export class A extends (await Promise.resolve(1)) {}",
|
||||
"./entry.js",
|
||||
&[],
|
||||
)
|
||||
.expect("extends (await ...) 模块应编译成功");
|
||||
let (ir, _) = emit_module("export class A extends (await Promise.resolve(1)) {}", "./entry.js", &[])
|
||||
.expect("extends (await ...) 模块应编译成功");
|
||||
assert!(ir.is_async, "extends (await ...) 应标记模块异步求值");
|
||||
assert_eq!(
|
||||
ir.insts.iter().filter(|i| i.op == OpCode::AWAIT).count(),
|
||||
|
||||
Reference in New Issue
Block a user