Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions polymod/hscript/_internal/Interp.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1229,7 +1253,7 @@ class Interp
}
}

if(getClassDecl() != null)
if (getClassDecl() != null)
{
var importedClass:ClassImport = getClassDecl().imports.get(id);
if (importedClass != null && importedClass.field)
Expand Down Expand Up @@ -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));
Expand Down
24 changes: 24 additions & 0 deletions polymod/hscript/_internal/Parser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading