Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b629ff4

Browse filesBrowse files
author
Andy
authored
Fix bug: FunctionDeclaration may have missing name (microsoft#20618)
1 parent f2f1745 commit b629ff4
Copy full SHA for b629ff4

2 files changed

+23-4Lines changed: 23 additions & 4 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/services/refactors/extractSymbol.ts‎

Copy file name to clipboardExpand all lines: src/services/refactors/extractSymbol.ts
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,10 @@ namespace ts.refactor.extractSymbol {
658658
case SyntaxKind.Constructor:
659659
return "constructor";
660660
case SyntaxKind.FunctionExpression:
661-
return scope.name
662-
? `function expression '${scope.name.text}'`
663-
: "anonymous function expression";
664661
case SyntaxKind.FunctionDeclaration:
665-
return `function '${scope.name.text}'`;
662+
return scope.name
663+
? `function '${scope.name.text}'`
664+
: "anonymous function";
666665
case SyntaxKind.ArrowFunction:
667666
return "arrow function";
668667
case SyntaxKind.MethodDeclaration:
Collapse file
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////export default function() {
4+
//// /*start*/0/*end*/
5+
////}
6+
7+
goTo.select('start', 'end')
8+
edit.applyRefactor({
9+
refactorName: "Extract Symbol",
10+
actionName: "function_scope_0",
11+
actionDescription: "Extract to inner function in anonymous function",
12+
newContent:
13+
`export default function() {
14+
/*RENAME*/newFunction();
15+
16+
function newFunction() {
17+
0;
18+
}
19+
}`
20+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.