Skip to content

Refuse constructors that initialise unreachable field types - #18

Open
Tutez64 wants to merge 1 commit into
MeguminBOT:mainfrom
Tutez64:feat/scripted-private-field-init
Open

Tutez64 wants to merge 1 commit into
MeguminBOT:mainfrom
Tutez64:feat/scripted-private-field-init

Conversation

@Tutez64

@Tutez64 Tutez64 commented Sep 19, 2026

Copy link
Copy Markdown

Member initialisers are lifted into hxscript.wired. var jobs:Jobs = new Jobs() where Jobs is private in the native module then fails with Cannot access private type Jobs. lime.system.ThreadPool's JobArray fields are this shape.

If any initialiser's type is not reachable from generated code, the constructor is unreemittable and Haxe constructs the native class, initialisers included.

Repro: Host with var jobs:Jobs = new Jobs() and private class Jobs. Stock fails to compile the bridge; with this change Haxe constructs Host.
hxscript-scripted-private-init.zip

Member initialisers are lifted into hxscript.wired. A private type in
the native module (ThreadPool's JobArray) then fails with Cannot
access private type. Treat those constructors as unreemittable so
Haxe constructs the native class, initialisers included.
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