Skip to content

nitls: accept -m and support conditional imports - #2868

Open
xymus wants to merge 3 commits into
nitlang:masterfrom
xymus:nitls-mixin
Open

xymus wants to merge 3 commits into
nitlang:masterfrom
xymus:nitls-mixin

Conversation

@xymus

@xymus xymus commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Without knowledge of -m, nitls would parse it as a module name and fail silently when building the dependencies of a Makefile. The module name after the -m was used as a target module but wouldn't trigger conditional imports as it was treated as a different entry point.

Allow nitls to support conditional imports by making it aware of -m and have it build the fictive main module when needed. This replicates the behavior of nitc, applying the mixin modules to each main entrypoint.

xymus added 3 commits November 4, 2026 12:30
This allows tools to import only the `-m` option without `-D`.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Extract `combine_main_module` out of `make_main_module` to be used from
nitls. This service builds the main module of a program, importing all
its modules and applying the conditional importations. The service
`make_main_module` remains to be shared by the different engines and run
the phases on the newly created fictive main module.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Without knowledge of -m, nitls would parse it as a module name and
fail silently when used to build the dependencies of a Makefile.
The module name after the `-m` was used as a target module but wouldn't
trigger conditional imports as it was treated as a different entrypoint.

Allow nitls to support conditional imports by making it aware of `-m`
and have it build the fictive main module when needed.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Test Results

    67 files     337 suites   12m 19s ⏱️
14 350 tests 13 820 ✅ 530 💤 0 ❌
14 817 runs  14 257 ✅ 560 💤 0 ❌

Results for commit 3b7bedd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant