Priority
P2 — dominant legacy error-handling idiom.
Context
Single-line If is everywhere in Access legacy code:
If Err.Number <> 0 Then GestionarError
If Not IsNull(x) Then ProcesarDato x, True Else LimpiarDato
Current behavior
detectStatementCall / detectQualifiedStatementCall (src/extraction/vba-extractor.ts ~1617 / ~1690) only inspect the start of the line. The leading identifier is If (blacklisted), so statement-form calls after Then / Else are silently dropped. Paren-form calls on the same line are caught by CALL_RE (it scans the whole line), which makes the gap inconsistent as well as lossy.
Expected behavior
Statement-form calls in the Then and Else clauses of a single-line If produce the same calls edges they would on their own line.
Implementation sketch
- In the statement-call section of
sweepCallsAndSql (~1353), when the masked line matches /^\s*If\b.*\bThen\s+(\S.*)$/i (i.e. something follows Then — a block If has nothing after it), split the remainder on a top-level Else (case-insensitive, not inside parens) and run detectStatementCall + detectQualifiedStatementCall on each clause.
- Also handle colon-separated statements inside each clause (
Then DoA: DoB) by splitting on : — colons cannot appear inside the masked string content.
- Guard:
Then GoTo label, Then Exit Sub, Then Resume Next, Then Err.Raise ... must not emit — GoTo, Exit, Resume need to be respected (add GoTo to CALL_KEYWORD_BLACKLIST if missing; Exit/Resume/Error are already there).
ElseIf lines are block-form (nothing to do).
Acceptance criteria
Validation
Index C:\Proyectos\dysflow\E2E_testing\src; count new same-file calls edges; sample for precision (no GoTo targets or keywords as callees).
Priority
P2 — dominant legacy error-handling idiom.
Context
Single-line
Ifis everywhere in Access legacy code:Current behavior
detectStatementCall/detectQualifiedStatementCall(src/extraction/vba-extractor.ts~1617 / ~1690) only inspect the start of the line. The leading identifier isIf(blacklisted), so statement-form calls afterThen/Elseare silently dropped. Paren-form calls on the same line are caught byCALL_RE(it scans the whole line), which makes the gap inconsistent as well as lossy.Expected behavior
Statement-form calls in the
ThenandElseclauses of a single-lineIfproduce the samecallsedges they would on their own line.Implementation sketch
sweepCallsAndSql(~1353), when the masked line matches/^\s*If\b.*\bThen\s+(\S.*)$/i(i.e. something followsThen— a blockIfhas nothing after it), split the remainder on a top-levelElse(case-insensitive, not inside parens) and rundetectStatementCall+detectQualifiedStatementCallon each clause.Then DoA: DoB) by splitting on:— colons cannot appear inside the masked string content.Then GoTo label,Then Exit Sub,Then Resume Next,Then Err.Raise ...must not emit —GoTo,Exit,Resumeneed to be respected (addGoTotoCALL_KEYWORD_BLACKLISTif missing;Exit/Resume/Errorare already there).ElseIflines are block-form (nothing to do).Acceptance criteria
If x Then Fooemitscalls→ localFoo.If x Then Foo Else Baremits both edges.If x Then obj.Metodo argfollows the qualified-call policy (gating per the qualified-call issue).If x Then GoTo fin/Then Exit Subemit nothing.Then DoA: DoBemits both.Validation
Index
C:\Proyectos\dysflow\E2E_testing\src; count new same-filecallsedges; sample for precision (noGoTotargets or keywords as callees).