aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz/index.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-08 02:44:44 +0000
committerGitHub <noreply@github.com>2020-11-08 10:44:44 +0800
commitb82de04775a490f7a1ebf7a8911f7d1a24a5f0b6 (patch)
tree1c16707eee2326a03eeed13b1878399cc040aa12 /test/ufuzz/index.js
parent4bbeb09f7c12bfb3d12ac5264bbdf033ee0b66dc (diff)
downloadtracifyjs-b82de04775a490f7a1ebf7a8911f7d1a24a5f0b6.tar.gz
tracifyjs-b82de04775a490f7a1ebf7a8911f7d1a24a5f0b6.zip
support shorthand property name in object literal (#4263)
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r--test/ufuzz/index.js17
1 files changed, 10 insertions, 7 deletions
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");