From 89198e0ad4e302546e0ec8b6653ee1b92ce09b1a Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 20 Dec 2020 05:38:56 +0000 Subject: [PATCH] improve destructuring generation in `ufuzz` (#4428) --- test/ufuzz/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index 74fbd4bd..73f78300 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -521,24 +521,28 @@ function createAssignmentPairs(recurmax, stmtDepth, canThrow, nameLenBefore, was keys[index] = key; } }); - if (was_async) avoid.push("await"); - addAvoidVars(avoid); var save_async = async; - async = false; + if (was_async != null) { + async = false; + if (save_async || was_async) avoid.push("await"); + } + addAvoidVars(avoid); + var save_vars = nameLenBefore && VAR_NAMES.splice(nameLenBefore); names.unshift("{ " + addTrailingComma(pairs.names.map(function(name, index) { var key = index in keys ? keys[index] : rng(10) && createKey(recurmax, keys); return key ? key + ": " + name : name; }).join(", ")) + " }"); - if (was_async) removeAvoidVars([ avoid.pop() ]); - if (was_async != null) async = was_async; - var save_vars = nameLenBefore && VAR_NAMES.splice(nameLenBefore); + if (was_async != null) { + async = was_async; + if (save_async || was_async) removeAvoidVars([ avoid.pop() ]); + } values.unshift("{ " + addTrailingComma(pairs.values.map(function(value, index) { var key = index in keys ? keys[index] : createKey(recurmax, keys); return key + ": " + value; }).join(", ")) + " }"); if (save_vars) [].push.apply(VAR_NAMES, save_vars); - async = save_async; removeAvoidVars(avoid); + async = save_async; } break; default: -- 2.34.1