refactor(tpv): 简化 BuildTopoSortedIndices 队列循环为 for range - StubMergerTopo.vp 中 while q_head < q_tail + 手动 q_head += 1 改为 for q_head in range(q_tail),逻辑等价、消除冗余变量

This commit is contained in:
TermiNexus committed 2026-08-23 14:03:27 +08:00
1 parent 60afcf1168
commit 6cd8adc54c
1 file changed
+1 -3
+1 -3
View File
@@ -112,7 +112,6 @@ def BuildTopoSortedIndices(store_count: int, store_sha1_arr: bytes,
if dsha1 is not None and StubMergerCollect._is_in_sha1_set(dsha1, reachable_set, reachable_count) != 0:
indegree[si] = indegree[si] + 1
# Kahn:入度为 0(不依赖任何可达模块)者先出 → 最先编译
q_head: int = 0
q_tail: int = 0
for i_r in range(rel_count):
si2: int = rel_idx[i_r]
@@ -120,9 +119,8 @@ def BuildTopoSortedIndices(store_count: int, store_sha1_arr: bytes,
queue[q_tail] = si2
q_tail += 1
out_count: int = 0
while q_head < q_tail:
for q_head in range(q_tail):
m: int = queue[q_head]
q_head += 1
sorted_idx[out_count] = m
out_count += 1
# 对依赖 m 的可达模块减入度