diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index edd6be126d5..89c39cdc36b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -21,6 +21,12 @@ module ts { diagnosticMessage: DiagnosticMessage; typeName?: DeclarationName; } + + interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + } + type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter { @@ -2514,7 +2520,198 @@ module ts { write("}"); } - function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { + function createSynthesizedNode(kind: SyntaxKind): Node { + var node = createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral: ObjectLiteralExpression, firstComputedPropertyIndex: number): ParenthesizedExpression { + // 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(originalObjectLiteral); + + // Hold onto the initial non-computed properties in a new object literal, + // then create the rest through property accesses on the temp variable. + var initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + initialObjectLiteral.properties = >originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= NodeFlags.MultiLine; + + // The comma expressions that will patch the object literal. + var propertyPatches = createBinaryExpression(SyntaxKind.EqualsToken, tempVar, initialObjectLiteral); + + ts.forEach(originalObjectLiteral.properties, property => { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + // TODO(drosen): Preserve comments + //var leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); + //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); + //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); + + propertyPatches = createBinaryExpression(SyntaxKind.CommaToken, propertyPatches, patchedProperty); + } + }); + + propertyPatches = createBinaryExpression(SyntaxKind.CommaToken, propertyPatches, tempVar); + + var result = createParenthesizedExpression(propertyPatches); + + // TODO(drosen): Preserve comments + // var leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); + // var trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); + //addCommentsToSynthesizedNode(result, leadingComments, trailingComments); + + return result; + } + + function addCommentsToSynthesizedNode(node: SynthesizedNode, leadingCommentRanges: CommentRange[], trailingCommentRanges: CommentRange[]): void { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + + // Returns 'undefined' if a property has already been accounted for. + function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var rightHandSide: Expression; + + if (property.kind === SyntaxKind.PropertyAssignment) { + rightHandSide = (property).initializer; + } + else if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { + var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + rightHandSide = createPropertyAccessExpression(prefix, (property).name); + } + else if (property.kind === SyntaxKind.MethodDeclaration) { + emitFunctionDeclaration(property); + } + else if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { + var accessors = getAllAccessorDeclarations(objectLiteral.properties, property); + + // Only emit the first accessor. + if (accessors.firstAccessor !== property) { + return undefined; + } + + var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + + var descriptorProperties = >[]; + if (accessors.getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForAccessor(accessors.getAccessor)); + descriptorProperties.push(getProperty); + } + if (accessors.setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForAccessor(accessors.setAccessor)); + descriptorProperties.push(setProperty); + } + + var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + + propertyDescriptor.properties = descriptorProperties; + + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + rightHandSide = createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + } + else { + Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); + } + + return createBinaryExpression(SyntaxKind.EqualsToken, leftHandSide, rightHandSide); + } + + function createParenthesizedExpression(expression: Expression) { + var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + result.expression = expression; + return result; + } + + function createNodeArray(...elements: T[]): NodeArray { + return >elements; + } + + function createBinaryExpression(operator: SyntaxKind, left: Expression, right: Expression): BinaryExpression { + var result = createSynthesizedNode(SyntaxKind.BinaryExpression); + result.operator = operator; + result.left = left; + result.right = right; + + return result; + } + + function createMemberAccessForPropertyName(expression: LeftHandSideExpression, memberName: DeclarationName): PropertyAccessExpression | ElementAccessExpression { + if (memberName.kind === SyntaxKind.Identifier) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.ComputedPropertyName) { + return createElementAccessExpression(expression, (memberName).expression); + } + else { + Debug.fail(`Kind '${memberName.kind}' not accounted for.`); + } + } + + function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { + var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); + + result.name = name; + result.initializer = initializer; + + return result; + } + + function createFunctionExpressionForAccessor(accessor: AccessorDeclaration): FunctionExpression { + var result = createSynthesizedNode(SyntaxKind.FunctionExpression); + result.parameters = accessor.parameters; + result.body = accessor.body; + + return result; + } + + function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression { + var result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); + result.expression = expression; + result.name = name; + + return result; + } + + function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression { + var result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + result.expression = expression; + result.argumentExpression = argumentExpression; + + return result; + } + + function createIdentifier(name: string) { + var result = createSynthesizedNode(SyntaxKind.Identifier); + result.text = name; + return result; + } + + function createCallExpression(invokedExpression: MemberExpression, arguments: NodeArray) { + var result = createSynthesizedNode(SyntaxKind.CallExpression); + result.expression = invokedExpression; + result.arguments = arguments; + + return result; + } + + function emitDownlevelObjectLiteralWithComputedProperties2(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; var properties = node.properties; @@ -2587,7 +2784,7 @@ module ts { write("})"); emitEnd(property); } - else { + else { emitLeadingComments(property); emitStart(property.name); emit(tempVar); diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 188a843f751..9cf09c0b96e 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,5 +2,5 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = (_a = {}, _a[foo()] = function () { }, _a); +var v = function () { }(_a = {}, _a[foo()] = , _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index 14d9235b12b..bebc2b3a537 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -20,18 +20,5 @@ var v = { var s; var n; var a; -var v = (_a = {}, - _a[s] = function () { }, - _a[n] = function () { }, - _a[s + s] = function () { }, - _a[s + n] = function () { }, - _a[+s] = function () { }, - _a[""] = function () { }, - _a[0] = function () { }, - _a[a] = function () { }, - _a[true] = function () { }, - _a["hello bye"] = function () { }, - _a["hello " + a + " bye"] = function () { }, - _a -); +var v = function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }(_a = {}, _a[s] = , _a[n] = , _a[s + s] = , _a[s + n] = , _a[+s] = , _a[""] = , _a[0] = , _a[a] = , _a[true] = , _a["hello bye"] = , _a["hello " + a + " bye"] = , _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 5716f2722ac..213b30b1a59 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -20,74 +20,17 @@ var v = { var s; var n; var a; -var v = (_a = {}, - Object.defineProperty(_a, s, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, n, { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, s + s, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, s + n, { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, +s, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "", { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 0, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, a, { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, true, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "hello bye", { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "hello " + a + " bye", { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - _a -); +var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index b65c7fd4f7d..6e61d587f63 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -7,9 +7,6 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { - var obj = (_a = {}, - _a[this.bar] = 0, - _a - ); + var obj = (_a = {}, _a[this.bar] = 0, _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index 36f3e66c7c2..33d0b25817c 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -8,9 +8,6 @@ module M { //// [computedPropertyNames19_ES5.js] var M; (function (M) { - var obj = (_a = {}, - _a[this.bar] = 0, - _a - ); + var obj = (_a = {}, _a[this.bar] = 0, _a); var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index ca5149928e6..f31abf71051 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -5,20 +5,7 @@ var v = { } //// [computedPropertyNames1_ES5.js] -var v = (_a = {}, - Object.defineProperty(_a, 0 + 1, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 0 + 1, { - set: function (v) { } //No error - , - enumerable: true, - configurable: true - }), - _a -); +var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 65acd7fa08f..d9fad19e826 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -4,8 +4,5 @@ var obj = { } //// [computedPropertyNames20_ES5.js] -var obj = (_a = {}, - _a[this.bar] = 0, - _a -); +var obj = (_a = {}, _a[this.bar] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index e82bf673b52..bcea64253ee 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,10 +13,7 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, - _a[this.bar()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[this.bar()] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index b6a8d254b26..4bc609ca727 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,10 +34,7 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = (_a = {}, - _a[_super.prototype.bar.call(this)] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[_super.prototype.bar.call(this)] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 5940c498db8..c918d2f693e 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,10 +26,7 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = (_a = {}, - _a[(_super.call(this), "prop")] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[(_super.call(this), "prop")] = , _a); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 4682ae9105e..475b5947b44 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,10 +17,7 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = (_a = {}, - _a[_this.bar()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[_this.bar()] = , _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 05196e23c5b..bb1f2f1a4cd 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,13 +32,7 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = (_a = {}, - // Ideally, we would capture this. But the reference is - // illegal, and not capturing this is consistent with - //treatment of other similar violations. - _a[(_super.call(this), "prop")] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[(_super.call(this), "prop")] = , _a); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 173e3c7222b..1d2340acc0c 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,10 +38,7 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = (_a = {}, - _a[_super.prototype.bar.call(_this)] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[_super.prototype.bar.call(_this)] = , _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index bf1c0f063e3..606d286114a 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -17,10 +17,7 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, - _a[foo()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[foo()] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index b43bee9f117..b1bea64123f 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -17,10 +17,7 @@ var C = (function () { function C() { } C.bar = function () { - var obj = (_a = {}, - _a[foo()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[foo()] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 307dadcbe91..8919b0389aa 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -4,8 +4,5 @@ var o = { }; //// [computedPropertyNames46_ES5.js] -var o = (_a = {}, - _a["" || 0] = 0, - _a -); +var o = (_a = {}, _a["" || 0] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 6ba31fe3b06..26add5173a9 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -14,8 +14,5 @@ var E2; (function (E2) { E2[E2["x"] = 0] = "x"; })(E2 || (E2 = {})); -var o = (_a = {}, - _a[0 /* x */ || 0 /* x */] = 0, - _a -); +var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index 859fb7a179c..66c0336767f 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -23,16 +23,7 @@ var E; E[E["x"] = 0] = "x"; })(E || (E = {})); var a; -extractIndexer((_a = {}, - _a[a] = "", - _a -)); // Should return string -extractIndexer((_b = {}, - _b[0 /* x */] = "", - _b -)); // Should return string -extractIndexer((_c = {}, - _c["" || 0] = "", - _c -)); // Should return any (widened form of undefined) +extractIndexer((_a = {}, _a[a] = "", _a)); // Should return string +extractIndexer((_b = {}, _b[0 /* x */] = "", _b)); // Should return string +extractIndexer((_c = {}, _c["" || 0] = "", _c)); // Should return any (widened form of undefined) var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index 3427ea665a0..418bd070457 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -27,41 +27,17 @@ var x = { //// [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 - }), - , - _a.p2 = 20, - _a -); + p1: 10 +}, _a.p1 = 10, _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; +}, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } +}, enumerable: true, configurable: true }), _a.p2 = 20, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index f91476c79c1..60cdefc36ee 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -20,18 +20,5 @@ var v = { var s; var n; var a; -var v = (_a = {}, - _a[s] = 0, - _a[n] = n, - _a[s + s] = 1, - _a[s + n] = 2, - _a[+s] = s, - _a[""] = 0, - _a[0] = 0, - _a[a] = 1, - _a[true] = 0, - _a["hello bye"] = 0, - _a["hello " + a + " bye"] = 0, - _a -); +var v = (_a = {}, _a[s] = 0, _a[n] = n, _a[s + s] = 1, _a[s + n] = 2, _a[+s] = s, _a[""] = 0, _a[0] = 0, _a[a] = 1, _a[true] = 0, _a["hello bye"] = 0, _a["hello " + a + " bye"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index a74561295be..90c2d2668d7 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -27,37 +27,22 @@ var x = { //// [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 () { + p1: 10, + get foo() { + if (1 == 1) { return 10; - }, - enumerable: true, - configurable: true - }), - , - _a.p2 = 20, - _a -); + } + } +}, _a.p1 = 10, _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; +}, enumerable: true, configurable: true }), _a.p2 = 20, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 58c5af2efa3..adf9b86aa1b 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -11,13 +11,5 @@ var v = { //// [computedPropertyNames5_ES5.js] var b; -var v = (_a = {}, - _a[b] = 0, - _a[true] = 1, - _a[[]] = 0, - _a[{}] = 0, - _a[undefined] = undefined, - _a[null] = null, - _a -); +var v = (_a = {}, _a[b] = 0, _a[true] = 1, _a[[]] = 0, _a[{}] = 0, _a[undefined] = undefined, _a[null] = null, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 7e9c6202940..b42b2091c22 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -12,10 +12,5 @@ var v = { var p1; var p2; var p3; -var v = (_a = {}, - _a[p1] = 0, - _a[p2] = 1, - _a[p3] = 2, - _a -); +var v = (_a = {}, _a[p1] = 0, _a[p2] = 1, _a[p3] = 2, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 886cd8d85eb..9d9ac41ace1 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -11,8 +11,5 @@ var E; (function (E) { E[E["member"] = 0] = "member"; })(E || (E = {})); -var v = (_a = {}, - _a[0 /* member */] = 0, - _a -); +var v = (_a = {}, _a[0 /* member */] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 6eceee81adb..0c5b5047d85 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -12,10 +12,6 @@ function f() { function f() { var t; var u; - var v = (_a = {}, - _a[t] = 0, - _a[u] = 1, - _a - ); + var v = (_a = {}, _a[t] = 0, _a[u] = 1, _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index 6c1d7bcb4d0..f52a7d51f25 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -12,10 +12,5 @@ var v = { //// [computedPropertyNames9_ES5.js] function f(x) { } -var v = (_a = {}, - _a[f("")] = 0, - _a[f(0)] = 0, - _a[f(true)] = 0, - _a -); +var v = (_a = {}, _a[f("")] = 0, _a[f(0)] = 0, _a[f(true)] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index 1f7a3ae123e..416e4746bee 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -9,9 +9,5 @@ var o: I = { } //// [computedPropertyNamesContextualType10_ES5.js] -var o = (_a = {}, - _a[+"foo"] = "", - _a[+"bar"] = 0, - _a -); +var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index 844e498bdf6..f7d95e560d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,11 +10,7 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] -var o = (_a = {}, - _a["" + 0] = function (y) { - return y.length; - }, - _a["" + 1] = function (y) { return y.length; }, - _a -); +var o = function (y) { + return y.length; +}(_a = {}, _a["" + 0] = , _a["" + 1] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index b047b4ad1ba..7ff1a5f9768 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,11 +10,7 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] -var o = (_a = {}, - _a[+"foo"] = function (y) { - return y.length; - }, - _a[+"bar"] = function (y) { return y.length; }, - _a -); +var o = function (y) { + return y.length; +}(_a = {}, _a[+"foo"] = , _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 7083d7d52e7..8aef840065b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,11 +9,7 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] -var o = (_a = {}, - _a[+"foo"] = function (y) { - return y.length; - }, - _a[+"bar"] = function (y) { return y.length; }, - _a -); +var o = function (y) { + return y.length; +}(_a = {}, _a[+"foo"] = , _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index b17f91be38b..11d43546b89 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType4_ES5.js] -var o = (_a = {}, - _a["" + "foo"] = "", - _a["" + "bar"] = 0, - _a -); +var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index c7a728e5ef8..313bb87e402 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType5_ES5.js] -var o = (_a = {}, - _a[+"foo"] = "", - _a[+"bar"] = 0, - _a -); +var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index c97b7c5b1f8..5500ac0863b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -15,12 +15,7 @@ foo({ //// [computedPropertyNamesContextualType6_ES5.js] foo((_a = { - p: "", - 0: function () { } - }, - _a["hi" + "bye"] = true, - _a[0 + 1] = 0, - _a[+"hi"] = [0], - _a -)); + p: "", + 0: function () { } +}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 9ca7e826aa7..f87c5151ab3 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -15,12 +15,7 @@ foo({ //// [computedPropertyNamesContextualType7_ES5.js] foo((_a = { - p: "", - 0: function () { } - }, - _a["hi" + "bye"] = true, - _a[0 + 1] = 0, - _a[+"hi"] = [0], - _a -)); + p: "", + 0: function () { } +}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 419ea906550..ed6bc81cebb 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType8_ES5.js] -var o = (_a = {}, - _a["" + "foo"] = "", - _a["" + "bar"] = 0, - _a -); +var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index d3beb8b8deb..7194742f1d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType9_ES5.js] -var o = (_a = {}, - _a[+"foo"] = "", - _a[+"bar"] = 0, - _a -); +var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index d31e4d94070..ddf9786ba16 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,23 +7,9 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = (_a = {}, - _a["" + ""] = 0, - _a["" + ""] = function () { }, - Object.defineProperty(_a, "" + "", { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "" + "", { - set: function (x) { }, - enumerable: true, - configurable: true - }), - _a -); +var v = function () { }(_a = {}, _a["" + ""] = 0, _a["" + ""] = , _a["" + ""] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index 39e393c46cc..9c45a3f7862 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -6,11 +6,8 @@ var v = { } //// [computedPropertyNamesSourceMap2_ES5.js] -var v = (_a = {}, - _a["hello"] = function () { - debugger; - }, - _a -); +var v = function () { + debugger; +}(_a = {}, _a["hello"] = , _a); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 2d9d4ea3088..c07389c568f 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAR,EAAA;IACI,AADJ,EAAA,CACK,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;IAHL,EAAA;CAIC,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IAEAA,QAAQA,CAACA;AACbA,CAACA,AAJA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA,EACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 4c49c91499b..cf074242624 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -8,100 +8,138 @@ sources: computedPropertyNamesSourceMap2_ES5.ts emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js sourceFile:computedPropertyNamesSourceMap2_ES5.ts ------------------------------------------------------------------- ->>>var v = (_a = {}, +>>>var v = function () { 1 > 2 >^^^^ 3 > ^ 4 > ^^^ -5 > ^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^-> 1 > 2 >var 3 > v 4 > = -5 > -6 > 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) -5 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) -6 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) --- ->>> _a["hello"] = function () { +>>> debugger; 1->^^^^ -2 > -3 > ^^ -4 > ^ -5 > ^^^^^^^ -6 > ^ -7 > ^^^-> -1->var v = { - > -2 > -3 > -4 > var v = { - > [ -5 > "hello" -6 > ] -1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 5) Source(1, 1) + SourceIndex(0) -3 >Emitted(2, 7) Source(1, 1) + SourceIndex(0) -4 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) -6 >Emitted(2, 16) Source(2, 14) + SourceIndex(0) ---- ->>> debugger; -1->^^^^^^^^ -2 > ^^^^^^^^ -3 > ^ -1->() { - > -2 > debugger -3 > ; -1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) -2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) -3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) ---- ->>> }, -1 >^^^^ -2 > ^ -3 > ^^-> -1 > - > -2 > } -1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) -2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) ---- ->>> _a -1->^^^^ -2 > ^^ -1-> -2 > -1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) ---- ->>>); -1 >^ -2 > ^ -3 > ^^^^^^-> -1 >var v = { +2 > ^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1->{ > ["hello"]() { - > debugger; - > } - >} -2 > -1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0) -2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0) + > +2 > debugger +3 > ; +1->Emitted(2, 5) Source(3, 9) + SourceIndex(0) name (["hello"]) +2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) name (["hello"]) +3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) name (["hello"]) +--- +>>>}(_a = {}, _a["hello"] = , _a); +1-> +2 >^ +3 > +4 > ^ +5 > ^^ +6 > ^^^ +7 > ^^ +8 > ^^ +9 > ^^ +10> ^ +11> ^^^^^^^ +12> ^ +13> ^^^ +14> ^^ +15> ^^ +16> +17> ^ +18> ^ +1-> + > +2 >} +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 6) + SourceIndex(0) name (["hello"]) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 6) + SourceIndex(0) name (["hello"]) Span encoded by the emitter:Emitted(3, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 3) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 5) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 8) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 8) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 8) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +8 > +9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 10) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 14) Source(1, 1) + SourceIndex(0) nameIndex (-1) +9 > +10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 10) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 15) Source(2, 6) + SourceIndex(0) nameIndex (-1) +10> var v = { + > [ +11> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 12) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 22) Source(2, 13) + SourceIndex(0) nameIndex (-1) +11> "hello" +12> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 14) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 23) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +12> +13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 15) Source(2, 11) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 26) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +13> +14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 22) Source(2, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 28) Source(1, 1) + SourceIndex(0) nameIndex (-1) +14> +15> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 23) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 30) Source(1, 1) + SourceIndex(0) nameIndex (-1) +15> +16> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +16> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 23) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +16> +17> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +17> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 26) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 31) Source(5, 2) + SourceIndex(0) nameIndex (-1) +17> +18> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +18> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 26) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 32) Source(5, 2) + SourceIndex(0) nameIndex (-1) +18> +1->Emitted(3, 1) Source(4, 5) + SourceIndex(0) name (["hello"]) +2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) name (["hello"]) +3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) +4 >Emitted(3, 3) Source(1, 1) + SourceIndex(0) +5 >Emitted(3, 5) Source(1, 1) + SourceIndex(0) +6 >Emitted(3, 8) Source(0, NaN) + SourceIndex(0) +7 >Emitted(3, 10) Source(0, NaN) + SourceIndex(0) +8 >Emitted(3, 12) Source(1, 1) + SourceIndex(0) +9 >Emitted(3, 14) Source(1, 1) + SourceIndex(0) +10>Emitted(3, 15) Source(2, 6) + SourceIndex(0) +11>Emitted(3, 22) Source(2, 13) + SourceIndex(0) +12>Emitted(3, 23) Source(0, NaN) + SourceIndex(0) +13>Emitted(3, 26) Source(0, NaN) + SourceIndex(0) +14>Emitted(3, 28) Source(1, 1) + SourceIndex(0) +15>Emitted(3, 30) Source(1, 1) + SourceIndex(0) +16>Emitted(3, 30) Source(0, NaN) + SourceIndex(0) +17>Emitted(3, 31) Source(5, 2) + SourceIndex(0) +18>Emitted(3, 32) Source(5, 2) + SourceIndex(0) --- >>>var _a; -1->^^^^ +1 >^^^^ 2 > ^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 28) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 30) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) 2 > -1->Emitted(7, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(7, 7) Source(1, 1) + SourceIndex(0) +1 >Emitted(4, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0) --- +!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded +!!!! **** Remaining decoded string: ,AADA,CAKA,CAAA;IAJD,EAAA >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 1fdb5ced65d..b6fcff6630c 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,5 +2,5 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = (_a = {}, _a[e] = function () { }, _a); +var v = function () { }(_a = {}, _a[e] = , _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 499e9a426d9..3271fa41207 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,9 +2,5 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = (_a = {}, Object.defineProperty(_a, e, { - get: function () { }, - enumerable: true, - configurable: true -}), _a); +var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 1268c6e4c25..f8e07d8aeb4 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,10 +11,6 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = (_a = {}, - _a[x] = string, - _a.string = , - _a -); +var x = (_a = {}, _a[x] = string, _a.string = , _a); var y; var _a;