Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2016-09-06 11:33:40 -07:00
parent b476815f76
commit 230737fb95
3 changed files with 123 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
//// [underscoreThisInDerivedClass01.ts]
// @target es5
// Original test intent:
// When arrow functions capture 'this', the lexical 'this' owner
// currently captures 'this' using a variable named '_this'.
// That means that '_this' becomes a reserved identifier in certain places.
//
// Constructors have adopted the same identifier name ('_this')
// for capturing any potential return values from super calls,
// so we expect the same behavior.
class C {
constructor() {
return {};
}
}
class D extends C {
constructor() {
var _this = "uh-oh?";
super();
}
}
//// [underscoreThisInDerivedClass01.js]
// @target es5
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
// Original test intent:
// When arrow functions capture 'this', the lexical 'this' owner
// currently captures 'this' using a variable named '_this'.
// That means that '_this' becomes a reserved identifier in certain places.
//
// Constructors have adopted the same identifier name ('_this')
// for capturing any potential return values from super calls,
// so we expect the same behavior.
var C = (function () {
function C() {
return {};
}
return C;
}());
var D = (function (_super) {
__extends(D, _super);
function D() {
var _this;
var _this = "uh-oh?";
_this = _super.call(this) || this;
return _this;
}
return D;
}(C));

View File

@@ -0,0 +1,32 @@
=== tests/cases/compiler/underscoreThisInDerivedClass01.ts ===
// @target es5
// Original test intent:
// When arrow functions capture 'this', the lexical 'this' owner
// currently captures 'this' using a variable named '_this'.
// That means that '_this' becomes a reserved identifier in certain places.
//
// Constructors have adopted the same identifier name ('_this')
// for capturing any potential return values from super calls,
// so we expect the same behavior.
class C {
>C : Symbol(C, Decl(underscoreThisInDerivedClass01.ts, 0, 0))
constructor() {
return {};
}
}
class D extends C {
>D : Symbol(D, Decl(underscoreThisInDerivedClass01.ts, 15, 1))
>C : Symbol(C, Decl(underscoreThisInDerivedClass01.ts, 0, 0))
constructor() {
var _this = "uh-oh?";
>_this : Symbol(_this, Decl(underscoreThisInDerivedClass01.ts, 19, 11))
super();
>super : Symbol(C, Decl(underscoreThisInDerivedClass01.ts, 0, 0))
}
}

View File

@@ -0,0 +1,35 @@
=== tests/cases/compiler/underscoreThisInDerivedClass01.ts ===
// @target es5
// Original test intent:
// When arrow functions capture 'this', the lexical 'this' owner
// currently captures 'this' using a variable named '_this'.
// That means that '_this' becomes a reserved identifier in certain places.
//
// Constructors have adopted the same identifier name ('_this')
// for capturing any potential return values from super calls,
// so we expect the same behavior.
class C {
>C : C
constructor() {
return {};
>{} : {}
}
}
class D extends C {
>D : D
>C : C
constructor() {
var _this = "uh-oh?";
>_this : string
>"uh-oh?" : string
super();
>super() : void
>super : typeof C
}
}