mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Fix bug: FunctionDeclaration may have missing name (#20618)
This commit is contained in:
parent
f2f17454af
commit
b629ff4204
@ -658,11 +658,10 @@ namespace ts.refactor.extractSymbol {
|
||||
case SyntaxKind.Constructor:
|
||||
return "constructor";
|
||||
case SyntaxKind.FunctionExpression:
|
||||
return scope.name
|
||||
? `function expression '${scope.name.text}'`
|
||||
: "anonymous function expression";
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return `function '${scope.name.text}'`;
|
||||
return scope.name
|
||||
? `function '${scope.name.text}'`
|
||||
: "anonymous function";
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return "arrow function";
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////export default function() {
|
||||
//// /*start*/0/*end*/
|
||||
////}
|
||||
|
||||
goTo.select('start', 'end')
|
||||
edit.applyRefactor({
|
||||
refactorName: "Extract Symbol",
|
||||
actionName: "function_scope_0",
|
||||
actionDescription: "Extract to inner function in anonymous function",
|
||||
newContent:
|
||||
`export default function() {
|
||||
/*RENAME*/newFunction();
|
||||
|
||||
function newFunction() {
|
||||
0;
|
||||
}
|
||||
}`
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user