@@ -169,7 +169,7 @@ function getReactFunctionType(id: t.Identifier | null): ReactFunctionType {
169
169
return 'Other' ;
170
170
}
171
171
172
- function getFunctionName (
172
+ function getFunctionIdentifier (
173
173
fn :
174
174
| NodePath < t . FunctionDeclaration >
175
175
| NodePath < t . ArrowFunctionExpression >
@@ -183,7 +183,7 @@ function getFunctionName(
183
183
}
184
184
185
185
let count = 0 ;
186
- function makeIdentifier ( id : t . Identifier | null ) : t . Identifier {
186
+ function withIdentifier ( id : t . Identifier | null ) : t . Identifier {
187
187
if ( id != null && id . name != null ) {
188
188
return id ;
189
189
} else {
@@ -214,7 +214,7 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
214
214
const config = parseConfigPragma ( pragma ) ;
215
215
216
216
for ( const fn of parseFunctions ( source , language ) ) {
217
- const id = getFunctionName ( fn ) ;
217
+ const id = withIdentifier ( getFunctionIdentifier ( fn ) ) ;
218
218
for ( const result of run (
219
219
fn ,
220
220
{
@@ -227,7 +227,7 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
227
227
null ,
228
228
null ,
229
229
) ) {
230
- const fnName = id ? .name ?? '(anonymous)' ;
230
+ const fnName = id . name ;
231
231
switch ( result . kind ) {
232
232
case 'ast' : {
233
233
upsert ( {
@@ -236,7 +236,7 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
236
236
name : result . name ,
237
237
value : {
238
238
type : 'FunctionDeclaration' ,
239
- id : makeIdentifier ( result . value . id ) ,
239
+ id,
240
240
async : result . value . async ,
241
241
generator : result . value . generator ,
242
242
body : result . value . body ,
0 commit comments