Add support for external classes when compiling to hlc. - #12948
Open
qlambert-pro wants to merge 1 commit into
Open
Add support for external classes when compiling to hlc.#12948qlambert-pro wants to merge 1 commit into
qlambert-pro wants to merge 1 commit into
Conversation
qlambert-pro
force-pushed
the
bugfix/issue10627
branch
from
June 23, 2026 18:45
f682413 to
7ccbbc7
Compare
Author
|
I moved the test I had prepared from I could use some pointers to set that up, if that is an option. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims at supporting
externclasses when compiling to hlc, it doesn't coverexternclass methods, as it looked to me like they had been dropped beforegenhl.Here are some additional notes:
src/generators/genhl.ml:3507looks very fragile but I couldn't figure out how to differentiate between builtinexterns and userexterns.In
hl2c,ftableis used for lookups during codegen, andfunctionsto generate the function declarations and definitions.In other words,
ftablecontainsexternclass methods butfunctionsdoes not. As a result the index inftable, which is duplicated asfe_indexdoesn't correspond to the index in the generatedccode anymore, hence the need for conversion.I tried to include a unit test to capture the new behaviour but was unsure how to setup external
ccode. I initially, developed this patch on top of 4.3.7 and was able to get a failing test there but ran into a lot of unrelated failing tests on top ofdevelopment. (EDIT: as expected the test is failing)The PR works on the small example, but I wasn't able to test the fix on a larger project yet, because I was unable to use the development version of the compiler to compile my project. I will look into that last part now.