Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conditional compilation from AssetsMacro class. #1764

Merged
merged 7 commits into from
Feb 28, 2024

Conversation

player-03
Copy link
Contributor

A recent change to the macro context seems to prevent us from using some conditional compilation flags. I have only ever relied on #if macro working during a macro context, and suspect it was a fluke that #if html5 ever worked.

In fact, it seems that #if hl never worked. ddd19af adds the check but prefers to call embedBytesHL() instead, so it doesn't get checked. Similarly, #if js and Haxe-provided flags never work in macros; only Lime's flags ever stood a chance.

This PR switches to a more future-proof approach, and also tries to make the code more readable. I believe this closes #1763 (unless more errors get revealed once these are fixed).

And while I'm at it, the `if` statement doesn't need to span the whole function. It can be a simple guard clause.
Sure they're private, but even then they shouldn't be writable.
This was likely added when `#if hl` began to fail, hiding the problem. With the issue fixed, there's no more need for a workaround.
@player-03
Copy link
Contributor Author

player-03 commented Feb 25, 2024

The tests aren't going to check this, since none of the sample projects embed their assets. But I tested it on my machine at least.

@player-03 player-03 merged commit d0e2a34 into openfl:develop Feb 28, 2024
23 checks passed
@player-03 player-03 deleted the AssetsMacro branch February 28, 2024 00:05
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.

Nightly Haxe issues
1 participant