From 1c023263a3a5ea7c5abf05e75598a84ca6c56c53 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Mon, 6 Mar 2023 16:35:52 -0800 Subject: [PATCH] Use shorthand where possible for ObjectExpression properties During codegen, emit object properties as shorthand where possible (`{x}` instead of `{x: x}`) --- .../forget/src/ReactiveScopes/CodegenReactiveFunction.ts | 8 ++++++-- .../hir/_bug.capturing-reference-changes-type.expect.md | 2 +- .../__tests__/fixtures/hir/alias-computed-load.expect.md | 2 +- .../__tests__/fixtures/hir/bug_object-pattern.expect.md | 2 +- .../fixtures/hir/capture-func-passed-to-jsx.expect.md | 4 ++-- .../fixtures/hir/capture-indirect-mutate-alias.expect.md | 2 +- .../fixtures/hir/capture_mutate-across-fns.expect.md | 2 +- .../fixtures/hir/capturing-arrow-function-1.expect.md | 2 +- .../hir/capturing-fun-alias-captured-mutate-2.expect.md | 4 ++-- .../capturing-fun-alias-captured-mutate-arr-2.expect.md | 4 ++-- .../capturing-func-alias-captured-mutate-arr.expect.md | 4 ++-- .../hir/capturing-func-alias-captured-mutate.expect.md | 4 ++-- .../hir/capturing-func-alias-computed-mutate.expect.md | 2 +- .../fixtures/hir/capturing-func-alias-mutate.expect.md | 2 +- ...apturing-func-alias-receiver-computed-mutate.expect.md | 2 +- .../hir/capturing-func-alias-receiver-mutate.expect.md | 2 +- .../fixtures/hir/capturing-func-mutate-2.expect.md | 4 ++-- .../fixtures/hir/capturing-func-mutate-3.expect.md | 4 ++-- .../fixtures/hir/capturing-func-mutate-nested.expect.md | 2 +- .../fixtures/hir/capturing-func-mutate.expect.md | 4 ++-- .../fixtures/hir/capturing-func-simple-alias.expect.md | 2 +- .../__tests__/fixtures/hir/capturing-function-1.expect.md | 2 +- .../hir/capturing-function-within-block.expect.md | 2 +- .../fixtures/hir/capturing-member-expr.expect.md | 2 +- .../fixtures/hir/capturing-nested-member-call.expect.md | 2 +- .../capturing-nested-member-expr-in-nested-func.expect.md | 2 +- .../fixtures/hir/capturing-nested-member-expr.expect.md | 2 +- .../hir/capturing-variable-in-nested-block.expect.md | 2 +- .../hir/capturing-variable-in-nested-function.expect.md | 2 +- .../__tests__/fixtures/hir/computed-store-alias.expect.md | 4 ++-- .../fixtures/hir/destructure-capture-global.expect.md | 2 +- .../fixtures/hir/destructuring-assignment.expect.md | 2 +- .../hir/independently-memoize-object-property.expect.md | 2 +- .../forget/src/__tests__/fixtures/hir/issue852.expect.md | 2 +- .../fixtures/hir/logical-expression-object.expect.md | 2 +- .../fixtures/hir/mutable-lifetime-with-aliasing.expect.md | 2 +- .../fixtures/hir/obj-literal-cached-in-if-else.expect.md | 4 ++-- .../hir/obj-literal-mutated-after-if-else.expect.md | 4 ++-- .../fixtures/hir/object-pattern-params.expect.md | 6 +++--- .../fixtures/hir/prop-capturing-function-1.expect.md | 2 +- .../fixtures/hir/ssa-objectexpression-phi.expect.md | 2 +- .../__tests__/fixtures/hir/ssa-property-call.expect.md | 2 +- .../src/__tests__/fixtures/hir/unary-expr.expect.md | 2 +- .../__tests__/fixtures/hir/update-expression.expect.md | 2 +- 44 files changed, 62 insertions(+), 58 deletions(-) diff --git a/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts index fbec7b76b7..058d45fbc7 100644 --- a/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -591,10 +591,14 @@ function codegenInstructionValue( const properties = []; for (const property of instrValue.properties) { if (property.kind === "ObjectProperty") { + const key = t.identifier(property.name); + const value = codegenPlace(cx, property.place); properties.push( t.objectProperty( - t.stringLiteral(property.name), - codegenPlace(cx, property.place) + key, + value, + false, + value.type === "Identifier" && value.name === key.name ) ); } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-reference-changes-type.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-reference-changes-type.expect.md index 40ca099123..5e73cf6a42 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-reference-changes-type.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-reference-changes-type.expect.md @@ -18,7 +18,7 @@ function component(a) { ```javascript function component(a) { - const x = { a: a }; + const x = { a }; (function () { y = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-computed-load.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-computed-load.expect.md index 37c3dd3872..142cf2311e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-computed-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-computed-load.expect.md @@ -21,7 +21,7 @@ function component(a) { const c_0 = $[0] !== a; let x; if (c_0) { - x = { a: a }; + x = { a }; const y = {}; y.x = x.a; diff --git a/compiler/forget/src/__tests__/fixtures/hir/bug_object-pattern.expect.md b/compiler/forget/src/__tests__/fixtures/hir/bug_object-pattern.expect.md index 31b19bf7d3..6a0ab084e3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/bug_object-pattern.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/bug_object-pattern.expect.md @@ -19,7 +19,7 @@ function component(t) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capture-func-passed-to-jsx.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capture-func-passed-to-jsx.expect.md index deb506ce66..acae2e4956 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capture-func-passed-to-jsx.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capture-func-passed-to-jsx.expect.md @@ -24,7 +24,7 @@ function component(a, b) { const c_0 = $[0] !== b; let t0; if (c_0) { - t0 = { b: b }; + t0 = { b }; $[0] = b; $[1] = t0; } else { @@ -34,7 +34,7 @@ function component(a, b) { const c_2 = $[2] !== a; let t1; if (c_2) { - t1 = { a: a }; + t1 = { a }; $[2] = a; $[3] = t1; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capture-indirect-mutate-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capture-indirect-mutate-alias.expect.md index 6e2ae9bfa8..eea27b671c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capture-indirect-mutate-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capture-indirect-mutate-alias.expect.md @@ -24,7 +24,7 @@ function component(a) { const c_0 = $[0] !== a; let x; if (c_0) { - x = { a: a }; + x = { a }; (function () { let q = x; (function () { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capture_mutate-across-fns.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capture_mutate-across-fns.expect.md index 3f4d3a806f..9a96663ded 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capture_mutate-across-fns.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capture_mutate-across-fns.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let z; if (c_0) { - z = { a: a }; + z = { a }; (function () { (function () { z.b = 1; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-arrow-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-arrow-function-1.expect.md index c11c944dbf..ff7f152d3e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-arrow-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-arrow-function-1.expect.md @@ -20,7 +20,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-2.expect.md index 606c7e8a78..3567ab374e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-2.expect.md @@ -25,8 +25,8 @@ function component(foo, bar) { const c_1 = $[1] !== bar; let x; if (c_0 || c_1) { - x = { foo: foo }; - const y = { bar: bar }; + x = { foo }; + const y = { bar }; (function () { let a = { y }; let b = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-arr-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-arr-2.expect.md index 9ecfd02773..0ea345d456 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-arr-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-fun-alias-captured-mutate-arr-2.expect.md @@ -25,8 +25,8 @@ function component(foo, bar) { const c_1 = $[1] !== bar; let x; if (c_0 || c_1) { - x = { foo: foo }; - const y = { bar: bar }; + x = { foo }; + const y = { bar }; (function () { let a = [y]; let b = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate-arr.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate-arr.expect.md index 4a96a5fd6a..b812a4d7e9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate-arr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate-arr.expect.md @@ -25,8 +25,8 @@ function component(foo, bar) { const c_1 = $[1] !== bar; let y; if (c_0 || c_1) { - const x = { foo: foo }; - y = { bar: bar }; + const x = { foo }; + y = { bar }; (function () { let a = [y]; let b = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate.expect.md index 2c4b3151a9..25265512ff 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-captured-mutate.expect.md @@ -25,8 +25,8 @@ function component(foo, bar) { const c_1 = $[1] !== bar; let y; if (c_0 || c_1) { - const x = { foo: foo }; - y = { bar: bar }; + const x = { foo }; + y = { bar }; (function () { let a = { y }; let b = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-computed-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-computed-mutate.expect.md index efaa1a7cae..719852c856 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-computed-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-computed-mutate.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let y; if (c_0) { - const x = { a: a }; + const x = { a }; y = {}; (function () { y["x"] = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-mutate.expect.md index 00063417a4..9cbb684d4d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-mutate.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let y; if (c_0) { - const x = { a: a }; + const x = { a }; y = {}; (function () { y.x = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-computed-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-computed-mutate.expect.md index 25007434c4..fbfc6a5241 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-computed-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-computed-mutate.expect.md @@ -23,7 +23,7 @@ function component(a) { const c_0 = $[0] !== a; let y; if (c_0) { - const x = { a: a }; + const x = { a }; y = {}; (function () { let a = y; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-mutate.expect.md index 4e67c2b111..f51e9d2f5c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-alias-receiver-mutate.expect.md @@ -23,7 +23,7 @@ function component(a) { const c_0 = $[0] !== a; let y; if (c_0) { - const x = { a: a }; + const x = { a }; y = {}; (function () { let a = y; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-2.expect.md index 55339e98d2..ba71fb8c5d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-2.expect.md @@ -23,7 +23,7 @@ function component(a, b) { const c_0 = $[0] !== b; let t0; if (c_0) { - t0 = { b: b }; + t0 = { b }; $[0] = b; $[1] = t0; } else { @@ -34,7 +34,7 @@ function component(a, b) { const c_3 = $[3] !== y.b; let x; if (c_2 || c_3) { - const z = { a: a }; + const z = { a }; x = function () { z.a = 2; y.b; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-3.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-3.expect.md index 1fdf0b7eb0..845cf45022 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-3.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-3.expect.md @@ -22,7 +22,7 @@ function component(a, b) { const c_0 = $[0] !== b; let t0; if (c_0) { - t0 = { b: b }; + t0 = { b }; $[0] = b; $[1] = t0; } else { @@ -32,7 +32,7 @@ function component(a, b) { const c_2 = $[2] !== a; let t1; if (c_2) { - t1 = { a: a }; + t1 = { a }; $[2] = a; $[3] = t1; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-nested.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-nested.expect.md index e6cedbd5dc..8172b173ae 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-nested.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate-nested.expect.md @@ -21,7 +21,7 @@ function component(a) { const c_0 = $[0] !== a; let x; if (c_0) { - const y = { b: { a: a } }; + const y = { b: { a } }; x = function () { y.b.a = 2; }; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate.expect.md index 555b7635c1..79308c81bf 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-mutate.expect.md @@ -24,11 +24,11 @@ function component(a, b) { const c_1 = $[1] !== b; let x; if (c_0 || c_1) { - const z = { a: a }; + const z = { a }; const c_3 = $[3] !== b; let t0; if (c_3) { - t0 = { b: b }; + t0 = { b }; $[3] = b; $[4] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-simple-alias.expect.md index e090d8cbc1..74f1151869 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-func-simple-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-func-simple-alias.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let y; if (c_0) { - const x = { a: a }; + const x = { a }; y = {}; (function () { y = x; diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-function-1.expect.md index 1ba76cd11a..520aa9e334 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-function-1.expect.md @@ -20,7 +20,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-function-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-function-within-block.expect.md index b6ecc41614..778962238c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-function-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-function-within-block.expect.md @@ -23,7 +23,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-member-expr.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-member-expr.expect.md index 9eb8a5cc1c..33bd7f09d3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-member-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-member-expr.expect.md @@ -20,7 +20,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-call.expect.md index 16583f4ac3..bd82e67566 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-call.expect.md @@ -20,7 +20,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr-in-nested-func.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr-in-nested-func.expect.md index 74a8575667..72f6390e32 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr-in-nested-func.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr-in-nested-func.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr.expect.md index 0ff028550d..0f69bd2873 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-nested-member-expr.expect.md @@ -20,7 +20,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-block.expect.md index a49d9ace8b..f67a1e32ef 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-block.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-function.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-function.expect.md index fdee9711a3..311ed47fad 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-function.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/capturing-variable-in-nested-function.expect.md @@ -22,7 +22,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/computed-store-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/computed-store-alias.expect.md index aaeb0628ce..82ea1fe243 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/computed-store-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/computed-store-alias.expect.md @@ -21,8 +21,8 @@ function component(a, b) { const c_1 = $[1] !== b; let x; if (c_0 || c_1) { - const y = { a: a }; - x = { b: b }; + const y = { a }; + x = { b }; x.y = y; mutate(x); diff --git a/compiler/forget/src/__tests__/fixtures/hir/destructure-capture-global.expect.md b/compiler/forget/src/__tests__/fixtures/hir/destructure-capture-global.expect.md index 94d5c7c989..6d1fd6c295 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/destructure-capture-global.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/destructure-capture-global.expect.md @@ -19,7 +19,7 @@ function component(a) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a, someGlobal: someGlobal }; + t0 = { a, someGlobal }; $[0] = a; $[1] = t0; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/destructuring-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/destructuring-assignment.expect.md index f6ceeaa99b..510014d4b2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/destructuring-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/destructuring-assignment.expect.md @@ -45,7 +45,7 @@ function foo(a, b, c) { const c_3 = $[3] !== o; let t0; if (c_0 || c_1 || c_2 || c_3) { - t0 = { d: d, g: g, n: n, o: o }; + t0 = { d, g, n, o }; $[0] = d; $[1] = g; $[2] = n; diff --git a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md index 40efa1a704..2f8442f41f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md @@ -22,7 +22,7 @@ function foo(a, b, c) { const c_2 = $[2] !== c; let x; if (c_0 || c_1 || c_2) { - x = { a: a }; + x = { a }; const c_4 = $[4] !== b; const c_5 = $[5] !== c; let t0; diff --git a/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md b/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md index 23a621c30f..585f8761c4 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md @@ -15,7 +15,7 @@ function Component(c) { ```javascript function Component(c) { - const x = { c: c }; + const x = { c }; mutate(x); } diff --git a/compiler/forget/src/__tests__/fixtures/hir/logical-expression-object.expect.md b/compiler/forget/src/__tests__/fixtures/hir/logical-expression-object.expect.md index 8e716a5933..95a3c75e61 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/logical-expression-object.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/logical-expression-object.expect.md @@ -44,7 +44,7 @@ function component(props) { const c_5 = $[5] !== b; let t2; if (c_4 || c_5) { - t2 = { a: a, b: b }; + t2 = { a, b }; $[4] = a; $[5] = b; $[6] = t2; diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md index 543ada01da..54c512a662 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md @@ -44,7 +44,7 @@ function Component(props) { const a = {}; const b = [a]; const c = {}; - const d = { c: c }; + const d = { c }; const x = {}; x.b = b; diff --git a/compiler/forget/src/__tests__/fixtures/hir/obj-literal-cached-in-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/hir/obj-literal-cached-in-if-else.expect.md index 9a1877dcd6..23c7890ccb 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/obj-literal-cached-in-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/obj-literal-cached-in-if-else.expect.md @@ -25,7 +25,7 @@ function foo(a, b, c, d) { const c_0 = $[0] !== b; let t0; if (c_0) { - t0 = { b: b }; + t0 = { b }; $[0] = b; $[1] = t0; } else { @@ -36,7 +36,7 @@ function foo(a, b, c, d) { const c_2 = $[2] !== c; let t1; if (c_2) { - t1 = { c: c }; + t1 = { c }; $[2] = c; $[3] = t1; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/obj-literal-mutated-after-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/hir/obj-literal-mutated-after-if-else.expect.md index 1f447dadfe..39b5b1edf5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/obj-literal-mutated-after-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/obj-literal-mutated-after-if-else.expect.md @@ -27,9 +27,9 @@ function foo(a, b, c, d) { if (c_0 || c_1) { x = undefined; if (someVal) { - x = { b: b }; + x = { b }; } else { - x = { c: c }; + x = { c }; } x.f = 1; $[0] = b; diff --git a/compiler/forget/src/__tests__/fixtures/hir/object-pattern-params.expect.md b/compiler/forget/src/__tests__/fixtures/hir/object-pattern-params.expect.md index 8ad14aa253..59adc0b978 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/object-pattern-params.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/object-pattern-params.expect.md @@ -19,7 +19,7 @@ function component(t16) { const c_0 = $[0] !== a; let t0; if (c_0) { - t0 = { a: a }; + t0 = { a }; $[0] = a; $[1] = t0; } else { @@ -29,7 +29,7 @@ function component(t16) { const c_2 = $[2] !== b; let t1; if (c_2) { - t1 = { b: b }; + t1 = { b }; $[2] = b; $[3] = t1; } else { @@ -40,7 +40,7 @@ function component(t16) { const c_5 = $[5] !== z; let t2; if (c_4 || c_5) { - t2 = { y: y, z: z }; + t2 = { y, z }; $[4] = y; $[5] = z; $[6] = t2; diff --git a/compiler/forget/src/__tests__/fixtures/hir/prop-capturing-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/hir/prop-capturing-function-1.expect.md index 7dcbede9de..276d9685c0 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/prop-capturing-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/prop-capturing-function-1.expect.md @@ -21,7 +21,7 @@ function component(a, b) { const c_1 = $[1] !== b; let t0; if (c_0 || c_1) { - t0 = { a: a, b: b }; + t0 = { a, b }; $[0] = a; $[1] = b; $[2] = t0; diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md index 9ac9eb5a89..cacca08508 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md @@ -28,7 +28,7 @@ function foo() { const y = 3; let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = { x: x, y: y }; + t0 = { x, y }; $[0] = t0; } else { t0 = $[0]; diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md index df33e9bad1..fb24ad69f3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md @@ -19,7 +19,7 @@ function foo() { let y; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const x = []; - y = { x: x }; + y = { x }; y.x.push([]); $[0] = y; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/unary-expr.expect.md b/compiler/forget/src/__tests__/fixtures/hir/unary-expr.expect.md index d67398abb8..6eb72a1f79 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/unary-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/unary-expr.expect.md @@ -47,7 +47,7 @@ function component(a) { const c_8 = $[8] !== f; let t1; if (c_2 || c_3 || c_4 || c_5 || c_6 || c_7 || c_8) { - t1 = { z: z, p: p, q: q, n: n, m: m, e: e, f: f }; + t1 = { z, p, q, n, m, e, f }; $[2] = z; $[3] = p; $[4] = q; diff --git a/compiler/forget/src/__tests__/fixtures/hir/update-expression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/update-expression.expect.md index 0b5febeaa0..84ea1afeb3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/update-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/update-expression.expect.md @@ -26,7 +26,7 @@ function foo(props) { const c_2 = $[2] !== z; let t0; if (c_0 || c_1 || c_2) { - t0 = { x: x, y: y, z: z }; + t0 = { x, y, z }; $[0] = x; $[1] = y; $[2] = z;