From ce85b1458903954c9d3ffbaa79eb5663ffa33654 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 19 Feb 2015 13:11:59 -0800 Subject: [PATCH] Made the initial object literal properties indented. --- src/compiler/emitter.ts | 43 +++++++---- .../computedPropertyNames49_ES5.errors.txt | 52 +++++++++++++ .../reference/computedPropertyNames49_ES5.js | 75 +++++++++++++++++++ .../computedPropertyNames49_ES6.errors.txt | 40 ++++++++++ .../reference/computedPropertyNames49_ES6.js | 52 +++++++++++++ .../computedPropertyNames50_ES5.errors.txt | 52 +++++++++++++ .../reference/computedPropertyNames50_ES5.js | 71 ++++++++++++++++++ .../computedPropertyNames50_ES6.errors.txt | 40 ++++++++++ .../reference/computedPropertyNames50_ES6.js | 52 +++++++++++++ ...omputedPropertyNamesContextualType6_ES5.js | 6 +- ...omputedPropertyNamesContextualType7_ES5.js | 6 +- .../computedPropertyNames49_ES5.ts | 25 +++++++ .../computedPropertyNames49_ES6.ts | 26 +++++++ .../computedPropertyNames50_ES5.ts | 25 +++++++ .../computedPropertyNames50_ES6.ts | 26 +++++++ 15 files changed, 569 insertions(+), 22 deletions(-) create mode 100644 tests/baselines/reference/computedPropertyNames49_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames49_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames49_ES6.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames49_ES6.js create mode 100644 tests/baselines/reference/computedPropertyNames50_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames50_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames50_ES6.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames50_ES6.js create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 06648fb90db..0489fd70313 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2065,9 +2065,6 @@ module ts { } function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { - if (multiLine) { - increaseIndent(); - } for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -2086,7 +2083,6 @@ module ts { write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -2097,12 +2093,6 @@ module ts { } } - function emitMultiLineList(nodes: Node[]) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ true, /*trailingComma*/ false); - } - } - function emitLines(nodes: Node[]) { emitLinesStartingAt(nodes, /*startIndex*/ 0); } @@ -2457,7 +2447,13 @@ module ts { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -2475,8 +2471,15 @@ module ts { } else if (languageVersion >= ScriptTarget.ES6) { write("["); - emitList(elements, 0, elements.length, /*multiLine*/ (node.flags & NodeFlags.MultiLine) !== 0, + var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; + if (multiLine) { + increaseIndent(); + } + emitList(elements, 0, elements.length, /*multiLine*/ multiLine, /*trailingComma*/ elements.hasTrailingComma); + if (multiLine) { + decreaseIndent(); + } write("]"); } else { @@ -2488,17 +2491,24 @@ module ts { function emitObjectLiteralBody(node: ObjectLiteralExpression, numElements: number) { write("{"); + var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; + if (numElements > 0) { var properties = node.properties; - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; if (!multiLine) { write(" "); } + else { + increaseIndent(); + } emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); if (!multiLine) { write(" "); } + else { + decreaseIndent(); + } } write("}"); @@ -2510,6 +2520,10 @@ module ts { write("("); + if (multiLine) { + increaseIndent(); + } + // For computed properties, we need to create a unique handle to the object // literal so we can modify it without risking internal assignments tainting the object. var tempVar = createAndRecordTempVariable(node); @@ -2521,9 +2535,6 @@ module ts { write(" = "); emitObjectLiteralBody(node, firstComputedPropertyIndex); - if (multiLine) { - increaseIndent(); - } for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { writeComma(); @@ -2624,10 +2635,10 @@ module ts { var properties = node.properties; if (languageVersion < ScriptTarget.ES6) { + var numProperties = properties.length; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. - var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { if (properties[i].name.kind === SyntaxKind.ComputedPropertyName) { diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt new file mode 100644 index 00000000000..cb4034d3bad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js new file mode 100644 index 00000000000..542017d42c1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -0,0 +1,75 @@ +//// [computedPropertyNames49_ES5.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES5.js] +var x = (_a = { + p1: 10 + }, + Object.defineProperty(_a, 1 + 1, { + get: function () { + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + set: function () { + // just throw + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "foo", { + get: function () { + if (1 == 1) { + return 10; + } + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "foo", { + get: function () { + if (1 == 1) { + return 10; + } + }, + enumerable: true, + configurable: true + }), + _a.p2 = 20, + _a +); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt new file mode 100644 index 00000000000..276f7fb17be --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(10,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.js b/tests/baselines/reference/computedPropertyNames49_ES6.js new file mode 100644 index 00000000000..d1b5fe26e9d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames49_ES6.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES6.js] +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt new file mode 100644 index 00000000000..63832dbed0c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js new file mode 100644 index 00000000000..1d73938553e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -0,0 +1,71 @@ +//// [computedPropertyNames50_ES5.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES5.js] +var x = (_a = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + } + }, + Object.defineProperty(_a, 1 + 1, { + get: function () { + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + set: function () { + // just throw + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "foo", { + get: function () { + if (1 == 1) { + return 10; + } + }, + enumerable: true, + configurable: true + }), + _a.p2 = 20, + _a +); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt new file mode 100644 index 00000000000..db61444a697 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(12,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.js b/tests/baselines/reference/computedPropertyNames50_ES6.js new file mode 100644 index 00000000000..24b0c8af1f5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames50_ES6.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES6.js] +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index 5b2537742d8..c97b7c5b1f8 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -15,9 +15,9 @@ foo({ //// [computedPropertyNamesContextualType6_ES5.js] foo((_a = { - p: "", - 0: function () { } -}, + p: "", + 0: function () { } + }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 71f336d9db1..9ca7e826aa7 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -15,9 +15,9 @@ foo({ //// [computedPropertyNamesContextualType7_ES5.js] foo((_a = { - p: "", - 0: function () { } -}, + p: "", + 0: function () { } + }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts new file mode 100644 index 00000000000..611d6a7d30f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts new file mode 100644 index 00000000000..58f97a80feb --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts new file mode 100644 index 00000000000..f7411e7cb4f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts new file mode 100644 index 00000000000..c599477c2e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file