Repository navigation
Conversation
…ne Haxe generates. hxcpp hands a cppia class without a `new` its base's constructor only when that base is a cppia class. Over a host class it had none: `new` skipped the host's constructor, and a subclass's `super()` crashed the cppia link. Such a class now gets the forwarding constructor a class with member initialisers already got; over a script base nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A script class that declares no constructor, directly over a host class, now gets the constructor Haxe generates for it.
hxcpp hands a cppia class without a
newits base's constructor only when that base is a cppia class too (CppiaClassInfo::linkTypes). Haxe's own cppia never relies on that, since it always writes the inherited constructor. The emitter did not, so forclass Mid extends HostBase {}:new Mid()never ran the host's constructor: every field it sets read null or zero, silently;super(), explicit or the implicit one an initialiser brings, dereferenced the null constructor while linking (CallMember::linkSuperCall) and ended the process, with or without the JIT.settleImplicitConstructorsnow also gives such a class the forwarding constructor it already wrote for a class with member initialisers. Only a class whose direct base is a host class gets one: over a script class, hxcpp's inherited constructor is already right, so no call is added there.new Mid().made(set byHostBase's constructor)nullhostnew Sub(),Sub extends Midwithnew() super()hostnew Sub(),Sub extends Midwith an initialiserhost5A host base whose constructor shape is unknown refuses the module, as it already did for a class with initialisers; the message no longer mentions initialisers.
Tests
madefield on theHostBasefixture, set by its constructor. Without the fix, the first fails in the cppia suite (cppia gave null, interpreter gave host) and the second ends it.test/run.sh eval cppon hxcppmaster: 421 / 421 / 454. Conformance columns are unchanged apart from the three new rows, compiled in both cppia columns.Playground,Shapes) as the baseline.