fixes
This commit is contained in:
+4
-8
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import signal
|
||||
import json
|
||||
import ast
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import logging
|
||||
@@ -1551,6 +1551,9 @@ def parse_rust_file_cached(filepath_str: str, file_hash: str) -> tuple:
|
||||
# `tools/src/target/release/rust_parser` – it is *always* shipped
|
||||
# with the release.
|
||||
rust_helper = Path("./tools/src/target/release/rust_parser")
|
||||
if not rust_helper.is_file():
|
||||
logger.warning(f"Rust parser binary not found: {rust_helper}. Skipping Rust file {filepath}")
|
||||
return tuple()
|
||||
|
||||
# Always use the helper; if it is missing, the whole Rust parsing
|
||||
# step will simply return an empty tuple, which is the safest
|
||||
@@ -1561,14 +1564,7 @@ def parse_rust_file_cached(filepath_str: str, file_hash: str) -> tuple:
|
||||
code = filepath.read_text(encoding="utf-8")
|
||||
lines = code.splitlines(keepends=True)
|
||||
|
||||
# Capture the import paths for each file – they are specific to the file
|
||||
# and will be attached to every chunk emitted for this file.
|
||||
import_paths = []
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, ItemUse):
|
||||
import_paths.append(use_tree_to_string(node.tree))
|
||||
|
||||
metadata["imports"] = import_paths
|
||||
|
||||
# Run the Rust binary.
|
||||
proc = subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user