Test different parameters on classes and methods

This commit is contained in:
Andrew Casey 2017-08-17 14:54:25 -07:00
parent 01d7f0b699
commit e08dce2c21
3 changed files with 64 additions and 0 deletions

View file

@ -586,6 +586,20 @@ namespace A {
testExtractMethod("extractMethod16",
`function F<T>() {
const array: T[] = [#|[]|];
}`);
// Class type parameter
testExtractMethod("extractMethod17",
`class C<T1, T2> {
M(t1: T1, t2: T2) {
[#|t1.toString()|];
}
}`);
// Method type parameter
testExtractMethod("extractMethod18",
`class C {
M<T1, T2>(t1: T1, t2: T2) {
[#|t1.toString()|];
}
}`);
});

View file

@ -0,0 +1,25 @@
// ==ORIGINAL==
class C<T1, T2> {
M(t1: T1, t2: T2) {
t1.toString();
}
}
// ==SCOPE::class 'C'==
class C<T1, T2> {
M(t1: T1, t2: T2) {
this.newFunction(t1);
}
private newFunction(t1: T1) {
t1.toString();
}
}
// ==SCOPE::global scope==
class C<T1, T2> {
M(t1: T1, t2: T2) {
newFunction<T1>(t1);
}
}
function newFunction<T1>(t1: T1) {
t1.toString();
}

View file

@ -0,0 +1,25 @@
// ==ORIGINAL==
class C {
M<T1, T2>(t1: T1, t2: T2) {
t1.toString();
}
}
// ==SCOPE::class 'C'==
class C {
M<T1, T2>(t1: T1, t2: T2) {
this.newFunction<T1>(t1);
}
private newFunction<T1>(t1: T1) {
t1.toString();
}
}
// ==SCOPE::global scope==
class C {
M<T1, T2>(t1: T1, t2: T2) {
newFunction<T1>(t1);
}
}
function newFunction<T1>(t1: T1) {
t1.toString();
}