dcbaker / meson-plus-plus

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

Handle `subdir_done()` #4

Open dcbaker opened 3 years ago

dcbaker commented 3 years ago

Because I want a complete AST from the frontend, and then to prune it down later, we need to do something with subdir_done() at the AST level. I have a couple of ideas. One idea is to insert a "label" after each subdir() call then replace the subdir_done() call with a goto of that label. This is conceptually simple, a stack is pushed each time a subdir is encountered with the label, and popped after the subdir is left. It does make the flow control more complex, however.

Another option is to rewrite the code so that the subdir_done() is removed. This is simply in some cases:

if host_machine.system() == 'sunos'
  subdir_done()

<code>

to

if not host_machine.system() == 'sunos'
  <code moved here>

but I'm sure that are complex cases where that might be hard (inside a foreach loop, for example)

For now I'm punting on this, but it needs to be handled.