File tree 3 files changed +28
-10
lines changed
crates/oxc_isolated_declarations
3 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -313,14 +313,15 @@ impl<'a> IsolatedDeclarations<'a> {
313
313
)
314
314
} )
315
315
. name ;
316
- if last_function_name. as_ref ( ) . is_some_and ( |last_name| last_name == name)
317
- && func. body . is_some ( )
318
- {
319
- None
316
+
317
+ if func. body . is_some ( ) {
318
+ if last_function_name. as_ref ( ) . is_some_and ( |last_name| last_name == name) {
319
+ return None ;
320
+ }
320
321
} else {
321
322
last_function_name = Some ( name. clone ( ) ) ;
322
- Some ( stmt)
323
323
}
324
+ Some ( stmt)
324
325
}
325
326
Statement :: ExportNamedDeclaration ( ref decl) => {
326
327
if let Some ( Declaration :: FunctionDeclaration ( ref func) ) = decl. declaration {
@@ -333,14 +334,14 @@ impl<'a> IsolatedDeclarations<'a> {
333
334
)
334
335
} )
335
336
. name ;
336
- if last_function_name . as_ref ( ) . is_some_and ( |last_name| last_name == name )
337
- && func . body . is_some ( )
338
- {
339
- None
337
+ if func . body . is_some ( ) {
338
+ if last_function_name . as_ref ( ) . is_some_and ( |last_name| last_name == name ) {
339
+ return None ;
340
+ }
340
341
} else {
341
342
last_function_name = Some ( name. clone ( ) ) ;
342
- Some ( stmt)
343
343
}
344
+ Some ( stmt)
344
345
} else {
345
346
Some ( stmt)
346
347
}
Original file line number Diff line number Diff line change
1
+ function a ( a : number ) : number ;
2
+ function a ( a : string ) : string ;
3
+ function a ( a : any ) : any { }
4
+
5
+
6
+ function b ( a : number ) : number { } ;
7
+ function b ( a : string ) : string { } ;
Original file line number Diff line number Diff line change
1
+ -- -
2
+ source : crates / oxc_isolated_declarations / tests / mod .rs
3
+ input_file : crates / oxc_isolated_declarations / tests / fixtures / function -overloads.ts
4
+ ---
5
+ ==================== .D.TS ====================
6
+
7
+ declare function a(a : number ): number ;
8
+ declare function a(a : string ): string ;
9
+ declare function b(a : number ): number ;
10
+ declare function b(a : string ): string ;
You can’t perform that action at this time.
0 commit comments