From 42a64f679c056459d5bf82435fa13e80e7b8246b Mon Sep 17 00:00:00 2001 From: ahmed7p Date: Tue, 6 Oct 2026 00:00:40 +0300 Subject: [PATCH 1/2] resolve dotted paths in cnew --- polymod/hscript/_internal/Interp.hx | 39 ++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/polymod/hscript/_internal/Interp.hx b/polymod/hscript/_internal/Interp.hx index 00b36fc4..a7469f67 100644 --- a/polymod/hscript/_internal/Interp.hx +++ b/polymod/hscript/_internal/Interp.hx @@ -233,7 +233,31 @@ class Interp error(EBlacklistedModule(importedClass.fullPath)); } - // Don't try to resolve classes without a valid import. + // resolve via dotted path + if (!PolymodScriptClass.interfaceImpls.exists(cl)) + { + var ref = resolveDottedPath(cl); + if (ref is Class) + { + return Type.createInstance(ref, args); + } + else if (ref is PolymodStaticAbstractReference) + { + try + { + return ref.instantiate(args); + } + catch (e) + { + error(EInvalidModule(cl)); + } + } + else if (ref is PolymodStaticClassReference) + { + return tryBuildClass(ref, args); + } + } + error(EInvalidModule(cl)); return null; @@ -1229,7 +1253,7 @@ class Interp } } - if(getClassDecl() != null) + if (getClassDecl() != null) { var importedClass:ClassImport = getClassDecl().imports.get(id); if (importedClass != null && importedClass.field) @@ -2131,7 +2155,16 @@ class Interp checkTypeForDeprecation(name); return PolymodEnum.tryBuild(name, f); } - return get(fieldTarget(e), f); + try + { + return get(fieldTarget(e), f); + } + catch (er:Error) + { + var ref = resolveDottedPath('${dottedPath(e)}.$f'); + if (ref == null) throw er; + return ref; + } case EBinop(op, e1, e2): var fop = binops.get(op); if (fop == null) error(EInvalidOp(op)); From fb0ba2f253271ffbc3c2745fcb3f4065b448d869 Mon Sep 17 00:00:00 2001 From: ahmed7p Date: Tue, 6 Oct 2026 00:14:40 +0300 Subject: [PATCH 2/2] handle generics in new instantiation --- polymod/hscript/_internal/Parser.hx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/polymod/hscript/_internal/Parser.hx b/polymod/hscript/_internal/Parser.hx index 314fb657..fd87a216 100644 --- a/polymod/hscript/_internal/Parser.hx +++ b/polymod/hscript/_internal/Parser.hx @@ -926,6 +926,30 @@ class Parser { case TDot: a.push(getIdent()); + case TOp("<"): + if (allowTypes) + { + var params = []; + while (true) + { + params.push(parseType()); + var t = token(); + switch (t) + { + case TComma: + continue; + case TOp(op) if (op == ">" || op.charCodeAt(0) == ">".code): + break; + default: + unexpected(t); + break; + } + } + } + else + { + unexpected(tk); + } case TPOpen: break; default: