aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-21 07:32:50 +0000
committerGitHub <noreply@github.com>2020-12-21 15:32:50 +0800
commite1b2026929623b3b0a771f2297c98c0f5e1ba1c9 (patch)
tree8e481d3b2b6d7edf83b8ecc2f6a5b6c37e536f31 /test
parentc3190303737db4cb3380e6fba19ec1cd86c12124 (diff)
downloadtracifyjs-e1b2026929623b3b0a771f2297c98c0f5e1ba1c9.tar.gz
tracifyjs-e1b2026929623b3b0a771f2297c98c0f5e1ba1c9.zip
improve object function generation in `ufuzz` (#4434)
Diffstat (limited to 'test')
-rw-r--r--test/ufuzz/index.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 73f78300..d554d644 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -1267,10 +1267,10 @@ function createObjectFunction(recurmax, stmtDepth, canThrow) {
var nameLenBefore = VAR_NAMES.length;
var save_async = async;
var s;
+ var name = createObjectKey(recurmax, stmtDepth, canThrow);
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 " + name + "(){",
@@ -1282,23 +1282,21 @@ function createObjectFunction(recurmax, stmtDepth, canThrow) {
];
break;
case 1:
- var prop1 = createObjectKey(recurmax, stmtDepth, canThrow);
- var prop2;
+ var prop;
do {
- prop2 = getDotKey();
- } while (prop1 == prop2);
+ prop = getDotKey();
+ } while (name == prop);
async = false;
s = [
- "set " + prop1 + "(" + createVarName(MANDATORY) + "){",
+ "set " + name + "(" + createVarName(MANDATORY) + "){",
strictMode(),
defns(),
_createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),
- "this." + prop2 + createAssignment() + _createBinaryExpr(recurmax, COMMA_OK, stmtDepth, canThrow) + ";",
+ "this." + prop + createAssignment() + _createBinaryExpr(recurmax, COMMA_OK, stmtDepth, canThrow) + ";",
"},",
];
break;
default:
- var name = createObjectKey(recurmax, stmtDepth, canThrow);
async = SUPPORT.async && rng(50) == 0;
s = [
(async ? "async " : "") + name + "(" + createParams(save_async, NO_DUPLICATE) + "){",