157 lines
2.7 KiB
Go
157 lines
2.7 KiB
Go
package fourslash_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
|
|
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
|
|
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
|
|
)
|
|
|
|
func TestGetOccurrencesThis2(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
|
const content = `this;
|
|
this;
|
|
|
|
function f() {
|
|
[|this|];
|
|
[|this|];
|
|
() => [|this|];
|
|
() => {
|
|
if ([|this|]) {
|
|
[|this|];
|
|
}
|
|
else {
|
|
[|t/**/his|].this;
|
|
}
|
|
}
|
|
function inside() {
|
|
this;
|
|
(function (_) {
|
|
this;
|
|
})(this);
|
|
}
|
|
}
|
|
|
|
module m {
|
|
function f() {
|
|
this;
|
|
this;
|
|
() => this;
|
|
() => {
|
|
if (this) {
|
|
this;
|
|
}
|
|
else {
|
|
this.this;
|
|
}
|
|
}
|
|
function inside() {
|
|
this;
|
|
(function (_) {
|
|
this;
|
|
})(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
class A {
|
|
public b = this.method1;
|
|
|
|
public method1() {
|
|
this;
|
|
this;
|
|
() => this;
|
|
() => {
|
|
if (this) {
|
|
this;
|
|
}
|
|
else {
|
|
this.this;
|
|
}
|
|
}
|
|
function inside() {
|
|
this;
|
|
(function (_) {
|
|
this;
|
|
})(this);
|
|
}
|
|
}
|
|
|
|
private method2() {
|
|
this;
|
|
this;
|
|
() => this;
|
|
() => {
|
|
if (this) {
|
|
this;
|
|
}
|
|
else {
|
|
this.this;
|
|
}
|
|
}
|
|
function inside() {
|
|
this;
|
|
(function (_) {
|
|
this;
|
|
})(this);
|
|
}
|
|
}
|
|
|
|
public static staticB = this.staticMethod1;
|
|
|
|
public static staticMethod1() {
|
|
this;
|
|
this;
|
|
() => this;
|
|
() => {
|
|
if (this) {
|
|
this;
|
|
}
|
|
else {
|
|
this.this;
|
|
}
|
|
}
|
|
function inside() {
|
|
this;
|
|
(function (_) {
|
|
this;
|
|
})(this);
|
|
}
|
|
}
|
|
|
|
private static staticMethod2() {
|
|
this;
|
|
this;
|
|
() => this;
|
|
() => {
|
|
if (this) {
|
|
this;
|
|
}
|
|
else {
|
|
this.this;
|
|
}
|
|
}
|
|
function inside() {
|
|
this;
|
|
(function (_) {
|
|
this;
|
|
})(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
var x = {
|
|
f() {
|
|
this;
|
|
},
|
|
g() {
|
|
this;
|
|
}
|
|
}`
|
|
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
|
f.VerifyBaselineDocumentHighlights(t, nil /*preferences*/, ToAny(f.Ranges())...)
|
|
}
|