aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-20 00:19:04 +0000
committerGitHub <noreply@github.com>2020-12-20 08:19:04 +0800
commitb7c49b72b3abd5da869d882a4e122cb155382874 (patch)
tree7488822884452643995370842eafc7fd23982e72 /test/ufuzz
parent8ce3c7d70fb476a65dc23f27bb5444ee89e59652 (diff)
downloadtracifyjs-b7c49b72b3abd5da869d882a4e122cb155382874.tar.gz
tracifyjs-b7c49b72b3abd5da869d882a4e122cb155382874.zip
support async function within object literal (#4424)
Diffstat (limited to 'test/ufuzz')
-rw-r--r--test/ufuzz/index.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 77a69a51..8fce55de 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -1262,13 +1262,14 @@ function createObjectKey(recurmax, stmtDepth, canThrow) {
function createObjectFunction(recurmax, stmtDepth, canThrow) {
var nameLenBefore = VAR_NAMES.length;
var save_async = async;
- async = SUPPORT.async && rng(50) == 0;
var s;
createBlockVariables(recurmax, stmtDepth, canThrow, function(defns) {
switch (rng(SUPPORT.computed_key ? 3 : 2)) {
case 0:
+ var name = createObjectKey(recurmax, stmtDepth, canThrow);
+ async = false;
s = [
- "get " + createObjectKey(recurmax, stmtDepth, canThrow) + "(){",
+ "get " + name + "(){",
strictMode(),
defns(),
_createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),
@@ -1282,6 +1283,7 @@ function createObjectFunction(recurmax, stmtDepth, canThrow) {
do {
prop2 = getDotKey();
} while (prop1 == prop2);
+ async = false;
s = [
"set " + prop1 + "(" + createVarName(MANDATORY) + "){",
strictMode(),
@@ -1292,8 +1294,10 @@ function createObjectFunction(recurmax, stmtDepth, canThrow) {
];
break;
default:
+ var name = createObjectKey(recurmax, stmtDepth, canThrow);
+ async = SUPPORT.async && rng(50) == 0;
s = [
- createObjectKey(recurmax, stmtDepth, canThrow) + "(" + createParams(save_async, NO_DUPLICATE) + "){",
+ (async ? "async " : "") + name + "(" + createParams(save_async, NO_DUPLICATE) + "){",
strictMode(),
defns(),
_createStatements(3, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),