Skip to content

Commit 9438355

Browse files
committed
Merge pull request #2989 from Microsoft/fixHelpersForStrict
Fixes helpers in strict mode
2 parents 892bc6d + 60ae9bd commit 9438355

File tree

558 files changed

+576
-574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+576
-574
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ scripts/*.js.map
4646
coverage/
4747
internal/
4848
**/.DS_Store
49+
.settings/

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ scripts
44
src
55
tests
66
Jakefile
7-
.travis.yml
7+
.travis.yml
8+
.settings/

src/compiler/emitter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module ts {
1818
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
1919
// emit output for the __extends helper function
2020
const extendsHelper = `
21-
var __extends = this.__extends || function (d, b) {
21+
var __extends = (this && this.__extends) || function (d, b) {
2222
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2323
function __() { this.constructor = d; }
2424
__.prototype = b.prototype;
@@ -27,7 +27,7 @@ var __extends = this.__extends || function (d, b) {
2727

2828
// emit output for the __decorate helper function
2929
const decorateHelper = `
30-
if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) {
30+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3131
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
3232
switch (arguments.length) {
3333
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
@@ -38,13 +38,13 @@ if (typeof __decorate !== "function") __decorate = function (decorators, target,
3838

3939
// emit output for the __metadata helper function
4040
const metadataHelper = `
41-
if (typeof __metadata !== "function") __metadata = function (k, v) {
41+
var __metadata = (this && this.__metadata) || function (k, v) {
4242
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4343
};`;
4444

4545
// emit output for the __param helper function
4646
const paramHelper = `
47-
if (typeof __param !== "function") __param = function (paramIndex, decorator) {
47+
var __param = (this && this.__param) || function (paramIndex, decorator) {
4848
return function (target, key) { decorator(target, key, paramIndex); }
4949
};`;
5050

tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module A {
2121

2222

2323
//// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js]
24-
var __extends = this.__extends || function (d, b) {
24+
var __extends = (this && this.__extends) || function (d, b) {
2525
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2626
function __() { this.constructor = d; }
2727
__.prototype = b.prototype;

tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module A {
2525

2626

2727
//// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js]
28-
var __extends = this.__extends || function (d, b) {
28+
var __extends = (this && this.__extends) || function (d, b) {
2929
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3030
function __() { this.constructor = d; }
3131
__.prototype = b.prototype;

tests/baselines/reference/accessOverriddenBaseClassMember1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ColoredPoint extends Point {
1616

1717

1818
//// [accessOverriddenBaseClassMember1.js]
19-
var __extends = this.__extends || function (d, b) {
19+
var __extends = (this && this.__extends) || function (d, b) {
2020
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2121
function __() { this.constructor = d; }
2222
__.prototype = b.prototype;

tests/baselines/reference/accessors_spec_section-4.5_inference.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LanguageSpec_section_4_5_inference {
2525
}
2626

2727
//// [accessors_spec_section-4.5_inference.js]
28-
var __extends = this.__extends || function (d, b) {
28+
var __extends = (this && this.__extends) || function (d, b) {
2929
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3030
function __() { this.constructor = d; }
3131
__.prototype = b.prototype;

tests/baselines/reference/aliasUsageInAccessorsOfClass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var Model = (function () {
3535
})();
3636
exports.Model = Model;
3737
//// [aliasUsage1_moduleA.js]
38-
var __extends = this.__extends || function (d, b) {
38+
var __extends = (this && this.__extends) || function (d, b) {
3939
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
4040
function __() { this.constructor = d; }
4141
__.prototype = b.prototype;

tests/baselines/reference/aliasUsageInArray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var Model = (function () {
2929
})();
3030
exports.Model = Model;
3131
//// [aliasUsageInArray_moduleA.js]
32-
var __extends = this.__extends || function (d, b) {
32+
var __extends = (this && this.__extends) || function (d, b) {
3333
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3434
function __() { this.constructor = d; }
3535
__.prototype = b.prototype;

tests/baselines/reference/aliasUsageInFunctionExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var Model = (function () {
2828
})();
2929
exports.Model = Model;
3030
//// [aliasUsageInFunctionExpression_moduleA.js]
31-
var __extends = this.__extends || function (d, b) {
31+
var __extends = (this && this.__extends) || function (d, b) {
3232
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3333
function __() { this.constructor = d; }
3434
__.prototype = b.prototype;

0 commit comments

Comments
 (0)