From b82de04775a490f7a1ebf7a8911f7d1a24a5f0b6 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 8 Nov 2020 02:44:44 +0000 Subject: support shorthand property name in object literal (#4263) --- test/ufuzz/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'test/ufuzz/index.js') diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index 1ebc655b..48e5a2fe 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -944,13 +944,16 @@ function createAccessor(recurmax, stmtDepth, canThrow) { function createObjectLiteral(recurmax, stmtDepth, canThrow) { recurmax--; var obj = ["({"]; - for (var i = rng(6); --i >= 0;) { - if (rng(20) == 0) { - obj.push(createAccessor(recurmax, stmtDepth, canThrow)); - } else { - var key = KEYS[rng(KEYS.length)]; - obj.push(key + ":(" + createExpression(recurmax, COMMA_OK, stmtDepth, canThrow) + "),"); - } + for (var i = rng(6); --i >= 0;) switch (rng(20)) { + case 0: + obj.push(createAccessor(recurmax, stmtDepth, canThrow)); + break; + case 1: + obj.push(getVarName() + ","); + break; + default: + obj.push(KEYS[rng(KEYS.length)] + ":(" + createExpression(recurmax, COMMA_OK, stmtDepth, canThrow) + "),"); + break; } obj.push("})"); return obj.join("\n"); -- cgit v1.2.3