mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-08 02:46:15 -05:00
Added test for '_this'.
This commit is contained in:
23
tests/cases/compiler/underscoreThisInDerivedClass01.ts
Normal file
23
tests/cases/compiler/underscoreThisInDerivedClass01.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// @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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user