Commit 9b0fa79
committed
fix(workspace): restore short-circuit order in memFS.dirEntries seen-check
The previous commit changed `if name != "" && !seen[name]` to
`if _, ok := seen[name]; name != "" && !ok`. In Go's `if init; cond`
form the init statement always executes before the condition, so the
map probe ran unconditionally — even when `name == ""` — reversing
the original short-circuit semantics.
Restore the guard-first order by nesting the membership check inside
an explicit `if name != ""` block, matching the original evaluation
order and preventing any wasted probe on empty segment paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjbjBieiWMBKURdKVNnPvy1 parent 6715194 commit 9b0fa79
1 file changed
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
279 | | - | |
280 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
281 | 283 | | |
282 | 284 | | |
283 | 285 | | |
284 | | - | |
285 | | - | |
286 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
0 commit comments