Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
336 changes: 154 additions & 182 deletions src/compiler/emitter.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tests/baselines/reference/ES5SymbolProperty1.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ obj[Symbol.foo];
var Symbol;
var obj = (_a = {},
_a[Symbol.foo] = 0,
_a);
_a
);
obj[Symbol.foo];
var _a;
4 changes: 1 addition & 3 deletions tests/baselines/reference/FunctionDeclaration8_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
var v = { [yield]: foo }

//// [FunctionDeclaration8_es6.js]
var v = (_a = {},
_a[yield] = foo,
_a);
var v = (_a = {}, _a[yield] = foo, _a);
var _a;
4 changes: 1 addition & 3 deletions tests/baselines/reference/FunctionDeclaration9_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ function * foo() {

//// [FunctionDeclaration9_es6.js]
function foo() {
var v = (_a = {},
_a[] = foo,
_a);
var v = (_a = {}, _a[] = foo, _a);
var _a;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
var v = { *[foo()]() { } }

//// [FunctionPropertyAssignments5_es6.js]
var v = (_a = {},
_a[foo()] = function () { },
_a);
var v = (_a = {}, _a[foo()] = function () { }, _a);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames10_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ var v = (_a = {},
_a[true] = function () { },
_a["hello bye"] = function () { },
_a["hello " + a + " bye"] = function () { },
_a);
_a
);
var _a;
69 changes: 57 additions & 12 deletions tests/baselines/reference/computedPropertyNames11_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,61 @@ var s;
var n;
var 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);
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 _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames18_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function foo() {
function foo() {
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
}
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames19_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var M;
(function (M) {
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
})(M || (M = {}));
16 changes: 13 additions & 3 deletions tests/baselines/reference/computedPropertyNames1_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ var v = {

//// [computedPropertyNames1_ES5.js]
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);
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 _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames20_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ var obj = {
//// [computedPropertyNames20_ES5.js]
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames22_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ var C = (function () {
C.prototype.bar = function () {
var obj = (_a = {},
_a[this.bar()] = function () { },
_a);
_a
);
return 0;
var _a;
};
Expand Down
4 changes: 1 addition & 3 deletions tests/baselines/reference/computedPropertyNames23_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ var C = (function () {
C.prototype.bar = function () {
return 0;
};
C.prototype[(_a = {},
_a[this.bar()] = 1,
_a)[0]] = function () { };
C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { };
return C;
var _a;
})();
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames25_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ var C = (function (_super) {
C.prototype.foo = function () {
var obj = (_a = {},
_a[_super.prototype.bar.call(this)] = function () { },
_a);
_a
);
return 0;
var _a;
};
Expand Down
4 changes: 1 addition & 3 deletions tests/baselines/reference/computedPropertyNames26_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ var C = (function (_super) {
function C() {
_super.apply(this, arguments);
}
C.prototype[(_a = {},
_a[_super.bar.call(this)] = 1,
_a)[0]] = function () { };
C.prototype[(_a = {}, _a[_super.bar.call(this)] = 1, _a)[0]] = function () { };
return C;
var _a;
})(Base);
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames28_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ var C = (function (_super) {
_super.call(this);
var obj = (_a = {},
_a[(_super.call(this), "prop")] = function () { },
_a);
_a
);
var _a;
}
return C;
Expand Down
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames29_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ var C = (function () {
(function () {
var obj = (_a = {},
_a[_this.bar()] = function () { },
_a);
_a
);
var _a;
});
return 0;
Expand Down
6 changes: 5 additions & 1 deletion tests/baselines/reference/computedPropertyNames30_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ var C = (function (_super) {
_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);
_a
);
var _a;
});
}
Expand Down
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames31_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ var C = (function (_super) {
(function () {
var obj = (_a = {},
_a[_super.prototype.bar.call(_this)] = function () { },
_a);
_a
);
var _a;
});
return 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames33_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var C = (function () {
C.prototype.bar = function () {
var obj = (_a = {},
_a[foo()] = function () { },
_a);
_a
);
return 0;
var _a;
};
Expand Down
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames34_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var C = (function () {
C.bar = function () {
var obj = (_a = {},
_a[foo()] = function () { },
_a);
_a
);
return 0;
var _a;
};
Expand Down
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames46_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ var o = {
//// [computedPropertyNames46_ES5.js]
var o = (_a = {},
_a["" || 0] = 0,
_a);
_a
);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames47_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ var E2;
})(E2 || (E2 = {}));
var o = (_a = {},
_a[E1.x || E2.x] = 0,
_a);
_a
);
var _a;
9 changes: 6 additions & 3 deletions tests/baselines/reference/computedPropertyNames48_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ var E;
var a;
extractIndexer((_a = {},
_a[a] = "",
_a)); // Should return string
_a
)); // Should return string
extractIndexer((_b = {},
_b[E.x] = "",
_b)); // Should return string
_b
)); // Should return string
extractIndexer((_c = {},
_c["" || 0] = "",
_c)); // Should return any (widened form of undefined)
_c
)); // Should return any (widened form of undefined)
var _a, _b, _c;
41 changes: 29 additions & 12 deletions tests/baselines/reference/computedPropertyNames49_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,41 @@ var x = {

//// [computedPropertyNames49_ES5.js]
var x = (_a = {
p1: 10
},
_a.p1 = 10,
_a[1 + 1] = Object.defineProperty({ get: function () {
p1: 10
},
Object.defineProperty(_a, 1 + 1, {
get: function () {
throw 10;
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ get: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 1 + 1, {
get: function () {
return 10;
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ set: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 1 + 1, {
set: function () {
// just throw
throw 10;
}, enumerable: true, configurable: true }),
_a.foo = Object.defineProperty({ get: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "foo", {
get: function () {
if (1 == 1) {
return 10;
}
}, enumerable: true, configurable: true }),
},
enumerable: true,
configurable: true
}),
,
_a.p2 = 20,
_a);
_a
);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames4_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ var v = (_a = {},
_a[true] = 0,
_a["hello bye"] = 0,
_a["hello " + a + " bye"] = 0,
_a);
_a
);
var _a;
Loading