dcbaker / meson-plus-plus

An experimental and incomplete implementation of Meson in C++, for solving Meson's bootstrapping issue.
Apache License 2.0
50 stars 7 forks source link

dealing with subdir() #120

Open dcbaker opened 1 year ago

dcbaker commented 1 year ago

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.