Skip to content

Commit bbbc7eb

Browse files
committed
Merge #1362: Speed up ReferenceFinder._find_reexports by 14%
2 parents 3dedc59 + 0b055cc commit bbbc7eb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

codeflash/languages/javascript/find_references.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,18 @@ def _find_reexports(
651651
652652
"""
653653
references: list[Reference] = []
654+
export_name = exported.export_name or exported.function_name
655+
656+
# Skip expensive parsing if export name not in source
657+
if export_name not in source_code:
658+
return references
659+
654660
exports = analyzer.find_exports(source_code)
655661
lines = source_code.splitlines()
656662

657663
for exp in exports:
658664
if not exp.is_reexport:
659665
continue
660-
661-
# Check if this re-exports our function
662-
export_name = exported.export_name or exported.function_name
663666
for name, alias in exp.exported_names:
664667
if name == export_name:
665668
# This is a re-export of our function

0 commit comments

Comments
 (0)