support for [await]...of statements (#4627)
This commit is contained in:
@@ -828,6 +828,21 @@ empty_for_in_prop_init: {
|
||||
]
|
||||
}
|
||||
|
||||
for_of: {
|
||||
input: {
|
||||
var async = [ "PASS", 42 ];
|
||||
async.p = "FAIL";
|
||||
for (async of (null, async))
|
||||
console.log(async);
|
||||
}
|
||||
expect_exact: 'var async=["PASS",42];async.p="FAIL";for(async of(null,async))console.log(async);'
|
||||
expect_stdout: [
|
||||
"PASS",
|
||||
"42",
|
||||
]
|
||||
node_version: ">=0.12"
|
||||
}
|
||||
|
||||
issue_3631_1: {
|
||||
options = {
|
||||
dead_code: true,
|
||||
|
||||
@@ -96,6 +96,48 @@ pause_resume: {
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
for_of: {
|
||||
input: {
|
||||
function* f() {
|
||||
if (yield "PASS") yield "FAIL 1";
|
||||
yield 42;
|
||||
return "FAIL 2";
|
||||
}
|
||||
for (var a of f())
|
||||
console.log(a);
|
||||
}
|
||||
expect_exact: 'function*f(){if(yield"PASS")yield"FAIL 1";yield 42;return"FAIL 2"}for(var a of f())console.log(a);'
|
||||
expect_stdout: [
|
||||
"PASS",
|
||||
"42",
|
||||
]
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
for_await_of: {
|
||||
input: {
|
||||
async function* f() {
|
||||
if (yield "PASS") yield "FAIL 1";
|
||||
yield {
|
||||
then: function(r) {
|
||||
r(42);
|
||||
},
|
||||
};
|
||||
return "FAIL 2";
|
||||
}
|
||||
(async function(a) {
|
||||
for await (a of f())
|
||||
console.log(a);
|
||||
})();
|
||||
}
|
||||
expect_exact: 'async function*f(){if(yield"PASS")yield"FAIL 1";yield{then:function(r){r(42)}};return"FAIL 2"}(async function(a){for await(a of f())console.log(a)})();'
|
||||
expect_stdout: [
|
||||
"PASS",
|
||||
"42",
|
||||
]
|
||||
node_version: ">=10"
|
||||
}
|
||||
|
||||
collapse_vars_1: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
|
||||
Reference in New Issue
Block a user