From e84957e3dabeb676113da5d513cde07981bcfbaa Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 12 Jan 2021 20:29:39 +0000 Subject: [PATCH] suppress invalid test generation in `ufuzz` (#4551) --- test/ufuzz/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index edb98aa7..73e00efd 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -1485,18 +1485,26 @@ function _createSimpleBinaryExpr(recurmax, noComma, stmtDepth, canThrow) { function createTypeofExpr(recurmax, stmtDepth, canThrow) { switch (rng(8)) { case 0: - return "(typeof " + createVarName(MANDATORY, DONT_STORE) + ' === "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; + return "(typeof " + createVar() + ' === "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; case 1: - return "(typeof " + createVarName(MANDATORY, DONT_STORE) + ' !== "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; + return "(typeof " + createVar() + ' !== "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; case 2: - return "(typeof " + createVarName(MANDATORY, DONT_STORE) + ' == "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; + return "(typeof " + createVar() + ' == "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; case 3: - return "(typeof " + createVarName(MANDATORY, DONT_STORE) + ' != "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; + return "(typeof " + createVar() + ' != "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '")'; case 4: - return "(typeof " + createVarName(MANDATORY, DONT_STORE) + ")"; + return "(typeof " + createVar() + ")"; default: return "(typeof " + createExpression(recurmax, COMMA_OK, stmtDepth, canThrow) + ")"; } + + function createVar() { + var save_async = async; + if (!async && avoid_vars.indexOf("await") >= 0) async = true; + var name = createVarName(MANDATORY, DONT_STORE); + async = save_async; + return name; + } } function createValue() { -- 2.34.1