From 39aa33749b24031e88a794481abfb4650700bc68 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 18 Apr 2020 00:12:13 +0100 Subject: [PATCH] expand `ufuzz` patterns (#3792) --- test/ufuzz/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index ec2a442c..e56408d9 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -764,20 +764,22 @@ function _createExpression(recurmax, noComma, stmtDepth, canThrow) { return createObjectLiteral(recurmax, stmtDepth, canThrow) + "." + getDotKey(); case p++: var name = getVarName(); - return name + " && " + name + "[" + createExpression(recurmax, COMMA_OK, stmtDepth, canThrow) + "]"; + var s = name + "[" + createExpression(recurmax, COMMA_OK, stmtDepth, canThrow) + "]"; + return canThrow && rng(8) == 0 ? s : name + " && " + s; case p++: var name = getVarName(); - return name + " && " + name + "." + getDotKey(); + var s = name + "." + getDotKey(); + return canThrow && rng(8) == 0 ? s : name + " && " + s; + case p++: + case p++: + var name = getVarName(); + var s = name + "." + getDotKey(); + s = "typeof " + s + ' == "function" && --_calls_ >= 0 && ' + s + "(" + createArgs(recurmax, stmtDepth, canThrow) + ")"; + return canThrow && rng(8) == 0 ? s : name + " && " + s; case p++: case p++: case p++: case p++: - if (rng(16) == 0) { - var name = getVarName(); - var fn = name + "." + getDotKey(); - called[name] = true; - return name + " && " + "typeof " + fn + ' == "function" && --_calls_ >= 0 && ' + fn + "(" + createArgs(recurmax, stmtDepth, canThrow) + ")"; - } var name = rng(3) == 0 ? getVarName() : "f" + rng(funcs + 2); called[name] = true; return "typeof " + name + ' == "function" && --_calls_ >= 0 && ' + name + "(" + createArgs(recurmax, stmtDepth, canThrow) + ")"; -- 2.34.1