Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18343 from amcasey/InsertionPosition
Improve insertion position of extracted methods (cherry picked from commit 40e4591)
- Loading branch information
Showing
10 changed files
with
313 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/baselines/reference/extractMethod/extractMethod23.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// ==ORIGINAL== | ||
namespace NS { | ||
function M1() { } | ||
function M2() { | ||
return 1; | ||
} | ||
function M3() { } | ||
} | ||
// ==SCOPE::function 'M2'== | ||
namespace NS { | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
|
||
function newFunction() { | ||
return 1; | ||
} | ||
} | ||
function M3() { } | ||
} | ||
// ==SCOPE::namespace 'NS'== | ||
namespace NS { | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
function newFunction() { | ||
return 1; | ||
} | ||
|
||
function M3() { } | ||
} | ||
// ==SCOPE::global scope== | ||
namespace NS { | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
function M3() { } | ||
} | ||
function newFunction() { | ||
return 1; | ||
} |
43 changes: 43 additions & 0 deletions
43
tests/baselines/reference/extractMethod/extractMethod24.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// ==ORIGINAL== | ||
function Outer() { | ||
function M1() { } | ||
function M2() { | ||
return 1; | ||
} | ||
function M3() { } | ||
} | ||
// ==SCOPE::function 'M2'== | ||
function Outer() { | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
|
||
function newFunction() { | ||
return 1; | ||
} | ||
} | ||
function M3() { } | ||
} | ||
// ==SCOPE::function 'Outer'== | ||
function Outer() { | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
function newFunction() { | ||
return 1; | ||
} | ||
|
||
function M3() { } | ||
} | ||
// ==SCOPE::global scope== | ||
function Outer() { | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
function M3() { } | ||
} | ||
function newFunction() { | ||
return 1; | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/extractMethod/extractMethod25.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// ==ORIGINAL== | ||
function M1() { } | ||
function M2() { | ||
return 1; | ||
} | ||
function M3() { } | ||
// ==SCOPE::function 'M2'== | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
|
||
function newFunction() { | ||
return 1; | ||
} | ||
} | ||
function M3() { } | ||
// ==SCOPE::global scope== | ||
function M1() { } | ||
function M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
function newFunction() { | ||
return 1; | ||
} | ||
|
||
function M3() { } |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/extractMethod/extractMethod26.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// ==ORIGINAL== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return 1; | ||
} | ||
M3() { } | ||
} | ||
// ==SCOPE::class 'C'== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return this./*RENAME*/newFunction(); | ||
} | ||
private newFunction() { | ||
return 1; | ||
} | ||
|
||
M3() { } | ||
} | ||
// ==SCOPE::global scope== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
M3() { } | ||
} | ||
function newFunction() { | ||
return 1; | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/extractMethod/extractMethod27.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// ==ORIGINAL== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return 1; | ||
} | ||
constructor() { } | ||
M3() { } | ||
} | ||
// ==SCOPE::class 'C'== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return this./*RENAME*/newFunction(); | ||
} | ||
constructor() { } | ||
private newFunction() { | ||
return 1; | ||
} | ||
|
||
M3() { } | ||
} | ||
// ==SCOPE::global scope== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
constructor() { } | ||
M3() { } | ||
} | ||
function newFunction() { | ||
return 1; | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/extractMethod/extractMethod28.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// ==ORIGINAL== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return 1; | ||
} | ||
M3() { } | ||
constructor() { } | ||
} | ||
// ==SCOPE::class 'C'== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return this./*RENAME*/newFunction(); | ||
} | ||
private newFunction() { | ||
return 1; | ||
} | ||
|
||
M3() { } | ||
constructor() { } | ||
} | ||
// ==SCOPE::global scope== | ||
class C { | ||
M1() { } | ||
M2() { | ||
return /*RENAME*/newFunction(); | ||
} | ||
M3() { } | ||
constructor() { } | ||
} | ||
function newFunction() { | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters