Skip to content

Commit

Permalink
Clean walkedNodes everytime it walks. (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen authored Jun 21, 2023
1 parent 5c572ea commit 54d71de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Megrez/2_Walker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public extension Megrez.Compositor {
/// - Returns: 爬軌結果+該過程是否順利執行。
@discardableResult mutating func walk() -> [Megrez.Node] {
defer { Self.reinitVertexNetwork() }
walkedNodes.removeAll()
sortAndRelax()
guard !spans.isEmpty else { return [] }
var iterated: Megrez.Node? = Megrez.Node.leadingNode
walkedNodes.removeAll()
while let itPrev = iterated?.prev {
// 此處必須得是 Copy,讓組字器外部對此的操作影響不到組字器內部的節點。
walkedNodes.insert(itPrev.copy, at: 0)
Expand Down

0 comments on commit 54d71de

Please sign in to comment.