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

nested target promotion #42

Open dcbaker opened 3 years ago

dcbaker commented 3 years ago

We really want to have all of our targets at the top level, so if we come across code like:

test(
  'mytest',
  executable(...),
)

we need to transform it into something like, like

___mesonpp_generated_target_for_mytest = executable(...)
test('mytest', ___mesonpp_generated_target_for_mytest)

This simplifies the backend's ability to generate rules.

In reality, we probably don't need to generate the assignment, just move the executable, then create a reference to it in the test.

This likely needs to run in a late set of passes. It's also possible that this will undo something that constant-combining has done, and still creates a position where the backend needs to know about assignments, something I'm not sure it does.

dcbaker commented 2 weeks ago

I'm not exactly sure what the end result of this needs to be. It may be fine to just leave a reference to the target at the top level and nested. Needs more thought.