Priority
P3 — robustness. Today's fixtures pass, but the failure mode is silent loss of ACTIVE code.
Context
preprocessConditionalCompilation (src/extraction/vba-preprocess.ts ~198) blanks inactive #If/#ElseIf/#Else/#End If branches, evaluating expressions with VBA7=true, Win64=true, Mac=false and a strict character whitelist; anything unrecognized evaluates to false — which blanks the branch and silently drops real symbols.
Current gaps
Win32 / Win16 unmapped — #If Win32 Then (very common legacy guard; Win32 is True on all modern Windows VBA) evaluates false and its ACTIVE branch is blanked.
True maps to JS true, not VBA's -1 — numeric comparisons diverge: real VBA evaluates #If Win64 = -1 Then as True; the whitelist also rejects -1 outright (no - allowed), so the branch blanks.
- No
#Const support — #Const MODO_DEBUG = True + #If MODO_DEBUG Then blanks the branch even though the user set it True (the identifier fails the whitelist). The #Const line itself also passes through to the sweeps as a normal line (harmless today, but inconsistent).
Expected behavior
Win32 → true (-1), Win16 → false (0) alongside the existing three constants.
- Truth values evaluate numerically as
-1/0 so = -1, = 0, = 1 comparisons match genuine VBA semantics; whitelist accepts unary minus.
- A file-scoped
#Const NAME = <literal or const-expression> table, consulted before the unknown-identifier fallback; #Const lines are blanked like other directives.
- Unknown identifiers still evaluate false (unchanged, conservative).
Implementation sketch
- Build the eval on integers: substitute constants with
-1/0, translate And/Or/Not/<>/= as bitwise/comparison on numbers (VBA CC operators are logical on True=-1 — document the chosen simplification), extend the whitelist with -.
- Parse
#Const in the main directive loop (before the generic line pass), storing into a per-call map; evaluate its RHS with the same evaluator.
- Keep the hard guarantee: line-count parity and "never throw" (fall back to false on any evaluation error).
Acceptance criteria
Validation
Re-index C:\Proyectos\dysflow\E2E_testing\src (uses #If Win64 = 1, #ElseIf VBA7, #If Mac); node counts must not regress; any delta must be explainable as newly-active branches.
Priority
P3 — robustness. Today's fixtures pass, but the failure mode is silent loss of ACTIVE code.
Context
preprocessConditionalCompilation(src/extraction/vba-preprocess.ts~198) blanks inactive#If/#ElseIf/#Else/#End Ifbranches, evaluating expressions withVBA7=true, Win64=true, Mac=falseand a strict character whitelist; anything unrecognized evaluates to false — which blanks the branch and silently drops real symbols.Current gaps
Win32/Win16unmapped —#If Win32 Then(very common legacy guard; Win32 is True on all modern Windows VBA) evaluates false and its ACTIVE branch is blanked.Truemaps to JStrue, not VBA's-1— numeric comparisons diverge: real VBA evaluates#If Win64 = -1 Thenas True; the whitelist also rejects-1outright (no-allowed), so the branch blanks.#Constsupport —#Const MODO_DEBUG = True+#If MODO_DEBUG Thenblanks the branch even though the user set it True (the identifier fails the whitelist). The#Constline itself also passes through to the sweeps as a normal line (harmless today, but inconsistent).Expected behavior
Win32 → true (-1),Win16 → false (0)alongside the existing three constants.-1/0so= -1,= 0,= 1comparisons match genuine VBA semantics; whitelist accepts unary minus.#Const NAME = <literal or const-expression>table, consulted before the unknown-identifier fallback;#Constlines are blanked like other directives.Implementation sketch
-1/0, translateAnd/Or/Not/<>/=as bitwise/comparison on numbers (VBA CC operators are logical on True=-1 — document the chosen simplification), extend the whitelist with-.#Constin the main directive loop (before the generic line pass), storing into a per-call map; evaluate its RHS with the same evaluator.Acceptance criteria
#If Win32 Then / <code> / #End Ifkeeps<code>.#Const X = True+#If X Thenkeeps the branch;#Const X = Falseblanks it.#If Win64 = -1 Thenkeeps the branch.extraction-vba-preprocess.test.tscases green; line-count parity preserved.Validation
Re-index
C:\Proyectos\dysflow\E2E_testing\src(uses#If Win64 = 1,#ElseIf VBA7,#If Mac); node counts must not regress; any delta must be explainable as newly-active branches.