@@ -125,10 +125,7 @@ func (fb *flowBuilder) addIfStatement(s *ast.IfStmt) model.ID {
125125 // Destination: prefer the first statement's own @anchor(to: ...) if it
126126 // has one; otherwise fall back to trueBranchAnchor.To.
127127 flow := newHorizontalFlowWithCase (splitID , actID , "true" )
128- applyUserAnchors (flow , trueBranchAnchor , trueBranchAnchor )
129- if thisAnchor != nil && thisAnchor .To != ast .AnchorSideUnset {
130- flow .DestinationConnectionIndex = int (thisAnchor .To )
131- }
128+ applyUserAnchors (flow , trueBranchAnchor , branchDestinationAnchor (trueBranchAnchor , thisAnchor ))
132129 fb .flows = append (fb .flows , flow )
133130 } else {
134131 flow := newHorizontalFlow (lastThenID , actID )
@@ -180,10 +177,7 @@ func (fb *flowBuilder) addIfStatement(s *ast.IfStmt) model.ID {
180177 // First statement in ELSE - connect from split going down (false path).
181178 // Same compositional rule as the THEN branch.
182179 flow := newDownwardFlowWithCase (splitID , actID , "false" )
183- applyUserAnchors (flow , falseBranchAnchor , falseBranchAnchor )
184- if thisAnchor != nil && thisAnchor .To != ast .AnchorSideUnset {
185- flow .DestinationConnectionIndex = int (thisAnchor .To )
186- }
180+ applyUserAnchors (flow , falseBranchAnchor , branchDestinationAnchor (falseBranchAnchor , thisAnchor ))
187181 fb .flows = append (fb .flows , flow )
188182 } else {
189183 flow := newHorizontalFlow (lastElseID , actID )
@@ -241,10 +235,7 @@ func (fb *flowBuilder) addIfStatement(s *ast.IfStmt) model.ID {
241235 if lastThenID == "" {
242236 // First statement in THEN - connect from split going down with "true" case
243237 flow := newDownwardFlowWithCase (splitID , actID , "true" )
244- applyUserAnchors (flow , trueBranchAnchor , trueBranchAnchor )
245- if thisAnchor != nil && thisAnchor .To != ast .AnchorSideUnset {
246- flow .DestinationConnectionIndex = int (thisAnchor .To )
247- }
238+ applyUserAnchors (flow , trueBranchAnchor , branchDestinationAnchor (trueBranchAnchor , thisAnchor ))
248239 fb .flows = append (fb .flows , flow )
249240 } else {
250241 flow := newHorizontalFlow (lastThenID , actID )
0 commit comments