meson-plus-plus icon indicating copy to clipboard operation
meson-plus-plus copied to clipboard

dealing with subdir()

Open dcbaker opened this issue 3 years ago • 0 comments

subdir is a pain. Ideally, we'd deal with it entirely at the AST level, because you'd have subdir('foo'). No variables, no keywords, just a basic "here is a subdir". We don't. we have two annoying cases that make handling it at the AST level really, really, really hard:

x = 'foo'
if host_machine.system() == 'windows'
    x = 'bar'
endif
subdir(x)

This cannot be handled at the AST level, because we can't know what X is until we get to the MIR passes that check host machine and lower away dead variables.

Second, we need to handle the subdir('foo', if_found : bar). This can be handled at the AST level.

So, I have two choices. Do as much of the lowering in the AST as possible, but then do some of it at the MIR level. Or, I move it all to the MIR level and deal with that annoyance.

dcbaker avatar Nov 30 '22 21:11 dcbaker