Conditional compile directives (#if, #const, #error, etc.) are now part of the AST, and as such, the branches of the condition compiles can be walked.
There is one concession with this: #if blocks are treated as any other block, and everything in them must be self contained, or will cause a diagnostic.
That means that even though this is allowed in Brightscript:
sub foo()
# if true
end sub
#end if
it will cause some diagnostics, because the sub foo() is partially inside and outside the #if statement
[x] TODO - Add some walk mode options that allow walking the tree based on true/false const values.
Conditional compile directives (
#if
,#const
,#error
, etc.) are now part of the AST, and as such, the branches of the condition compiles can be walked.There is one concession with this:
#if
blocks are treated as any other block, and everything in them must be self contained, or will cause a diagnostic.That means that even though this is allowed in Brightscript:
it will cause some diagnostics, because the
sub foo()
is partially inside and outside the#if
statement[x] TODO - Add some walk mode options that allow walking the tree based on true/false const values.
[x] Support
#if not <bs_const>
#1158Addresses #1023