mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
34 lines
1.5 KiB
Plaintext
34 lines
1.5 KiB
Plaintext
//// [tests/cases/compiler/collisionThisExpressionAndNameResolution.ts] ////
|
|
|
|
=== collisionThisExpressionAndNameResolution.ts ===
|
|
var console : {
|
|
>console : Symbol(console, Decl(collisionThisExpressionAndNameResolution.ts, 0, 3))
|
|
|
|
log(message: any);
|
|
>log : Symbol(log, Decl(collisionThisExpressionAndNameResolution.ts, 0, 15))
|
|
>message : Symbol(message, Decl(collisionThisExpressionAndNameResolution.ts, 1, 8))
|
|
}
|
|
class Foo {
|
|
>Foo : Symbol(Foo, Decl(collisionThisExpressionAndNameResolution.ts, 2, 1))
|
|
|
|
x() {
|
|
>x : Symbol(Foo.x, Decl(collisionThisExpressionAndNameResolution.ts, 3, 11))
|
|
|
|
var _this = 10; // Local var. No this capture in x(), so no conflict.
|
|
>_this : Symbol(_this, Decl(collisionThisExpressionAndNameResolution.ts, 5, 11))
|
|
|
|
function inner() {
|
|
>inner : Symbol(inner, Decl(collisionThisExpressionAndNameResolution.ts, 5, 23))
|
|
|
|
console.log(_this); // Error as this doesnt not resolve to user defined _this
|
|
>console.log : Symbol(log, Decl(collisionThisExpressionAndNameResolution.ts, 0, 15))
|
|
>console : Symbol(console, Decl(collisionThisExpressionAndNameResolution.ts, 0, 3))
|
|
>log : Symbol(log, Decl(collisionThisExpressionAndNameResolution.ts, 0, 15))
|
|
>_this : Symbol(_this, Decl(collisionThisExpressionAndNameResolution.ts, 5, 11))
|
|
|
|
return x => this; // New scope. So should inject new _this capture into function inner
|
|
>x : Symbol(x, Decl(collisionThisExpressionAndNameResolution.ts, 8, 18))
|
|
}
|
|
}
|
|
}
|