mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Accepted baselines.
This commit is contained in:
56
tests/baselines/reference/underscoreThisInDerivedClass01.js
Normal file
56
tests/baselines/reference/underscoreThisInDerivedClass01.js
Normal 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));
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user