aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-04-18 00:12:13 +0100
committerGitHub <noreply@github.com>2020-04-18 07:12:13 +0800
commit39aa33749b24031e88a794481abfb4650700bc68 (patch)
tree0ac1444d832de516db517814e46c155093e8a7f0
parentda68ec6e190e8969741606b2b2a3eb2d327061ba (diff)
downloadtracifyjs-39aa33749b24031e88a794481abfb4650700bc68.tar.gz
tracifyjs-39aa33749b24031e88a794481abfb4650700bc68.zip
expand `ufuzz` patterns (#3792)
-rw-r--r--test/ufuzz/index.js18
1 files 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) + ")";