Skip to content

Commit 6365030

Browse files
lemz1EliteMasterEric
authored andcommitted
ability to import scripted classes
1 parent 3e85940 commit 6365030

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

polymod/hscript/_internal/PolymodInterpEx.hx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ class PolymodInterpEx extends Interp
6969
var clsRef = PolymodStaticClassReference.tryBuild(cl);
7070
if (clsRef != null) return clsRef.instantiate(args);
7171

72+
@:privateAccess
73+
if (getClassDecl().imports != null && getClassDecl().imports.exists(cl))
74+
{
75+
var clsRef = PolymodStaticClassReference.tryBuild(getClassDecl().imports.get(cl).fullPath);
76+
if (clsRef != null) return clsRef.instantiate(args);
77+
}
78+
7279
@:privateAccess
7380
if (getClassDecl()?.pkg != null)
7481
{
@@ -242,6 +249,12 @@ class PolymodInterpEx extends Interp
242249

243250
for (key => imp in cls.importsToValidate)
244251
{
252+
if (_scriptClassDescriptors.exists(imp.fullPath))
253+
{
254+
cls.imports.set(key, imp);
255+
continue;
256+
}
257+
245258
if (_scriptEnumDescriptors.exists(imp.fullPath))
246259
{
247260
cls.imports.set(key, imp);

0 commit comments

Comments
 (0)