mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
//// [tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts] ////
|
|
|
|
//// [collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts]
|
|
class Foo2 {
|
|
constructor(_this: number) { //Error
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
}
|
|
}
|
|
}
|
|
|
|
class Foo3 {
|
|
constructor(private _this: number) { // Error
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
}
|
|
}
|
|
}
|
|
|
|
class Foo4 {
|
|
constructor(_this: number); // No code gen - no error
|
|
constructor(_this: string); // No code gen - no error
|
|
constructor(_this: any) { // Error
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
}
|
|
}
|
|
}
|
|
|
|
class Foo5 {
|
|
constructor(_this: number); // No code gen - no error
|
|
constructor(_this: string); // No code gen - no error
|
|
constructor(private _this: any) { // Error
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
}
|
|
}
|
|
}
|
|
|
|
//// [collisionThisExpressionAndPropertyNameAsConstuctorParameter.js]
|
|
"use strict";
|
|
class Foo2 {
|
|
constructor(_this) {
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
};
|
|
}
|
|
}
|
|
class Foo3 {
|
|
constructor(_this) {
|
|
this._this = _this;
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
};
|
|
}
|
|
}
|
|
class Foo4 {
|
|
constructor(_this) {
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
};
|
|
}
|
|
}
|
|
class Foo5 {
|
|
constructor(_this) {
|
|
this._this = _this;
|
|
var lambda = () => {
|
|
return x => this; // New scope. So should inject new _this capture
|
|
};
|
|
}
|
|
}
|