Skip to content

Add template strings#28

Merged
colinator27 merged 6 commits into
UnderminersTeam:mainfrom
natroute:main
Jul 1, 2026
Merged

Add template strings#28
colinator27 merged 6 commits into
UnderminersTeam:mainfrom
natroute:main

Conversation

@natroute

Copy link
Copy Markdown
Contributor

This adds support for template string syntax to the compiler and decompiler.

Specifically, FunctionCallNodes with @@string@@ are rewritten as TemplateStringNodes in the cleanup step if applicable. For any cases that seem problematic (e.g. malformed calls with extra arguments, not enough arguments), it falls back to generating a regular function call.

Since this might break any projects that rely on the old behavior, a feature flag has been added to IDecompileOptions (on by default). This also changes the public API.

There are also some new tests.

@setupwitch

Copy link
Copy Markdown
Contributor

Very cool

@colinator27 colinator27 linked an issue Jun 30, 2026 that may be closed by this pull request
@colinator27

Copy link
Copy Markdown
Member

Did a touch-up pass across the PR. Everything was great on the whole, aside some minor details which I've corrected now. Also, I added support for regular string handling, before @@string@@ was added.

The biggest thing I've changed is in the decompiler logic... as in, I pretty much rewrote it to no longer allocate memory, and to be more efficient and less bug-prone. I added some additional test cases, too.

I think this might be good to merge soon, but I am wondering if we can come up with any test cases that fail still.

@colinator27 colinator27 merged commit 10f32e5 into UnderminersTeam:main Jul 1, 2026
2 checks passed
@colinator27

Copy link
Copy Markdown
Member

Merging for now, and will probably make any additional corrections separately!

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.

Handle 2024.14 code generation for string interpolation

3 participants