Skip to content
Open
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
20 changes: 11 additions & 9 deletions polymod/hscript/_internal/PolymodInterpEx.hx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class PolymodInterpEx extends Interp
continue;
}

Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not import ${imp.fullPath}', clsPath);
Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not import ${imp.fullPath}. Check to ensure the module exists and is spelled correctly.', clsPath);
}

// Check if the scripted classes extend the right type.
Expand All @@ -338,15 +338,15 @@ class PolymodInterpEx extends Interp
case CTPath(path, params):
if (params != null && params.length > 0)
{
Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not extend ${superClassPath}, do not include type parameters in super class name', clsPath);
Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not extend ${superClassPath}, do not include type parameters in super class name.', clsPath);
}

default:
// Other error handling?
}

// Default
Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not extend ${superClassPath}, is the type imported?', clsPath);
Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not extend ${superClassPath}. Make sure the type to extend has been imported.', clsPath);
}
else
{
Expand Down Expand Up @@ -1852,8 +1852,14 @@ class PolymodInterpEx extends Interp
} else if (PolymodScriptClass.abstractClassImpls.exists(importedClass.fullPath)) {
// We used a macro to map each abstract to its implementation.
importedClass.cls = PolymodScriptClass.abstractClassImpls.get(importedClass.fullPath);
trace('RESOLVED ABSTRACT CLASS ${importedClass.fullPath} -> ${Type.getClassName(importedClass.cls)}');
trace(Type.getClassFields(importedClass.cls));

if (importedClass.cls == null) {
Polymod.warning(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Abstract type ${importedClass.fullPath} could not be resolved. Try using the underlying type instead.', origin);
} else {
// trace('RESOLVED ABSTRACT CLASS ${importedClass.fullPath} -> ${Type.getClassName(importedClass.cls)}');
// trace(Type.getClassFields(importedClass.cls));
}

} else if (_scriptEnumDescriptors.exists(importedClass.fullPath)) {
// do nothing
} else {
Expand All @@ -1866,7 +1872,6 @@ class PolymodInterpEx extends Interp

// If the class is still not found, skip this import entirely.
if (resultCls == null && resultEnm == null) {
//Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not import class ${importedClass.fullPath}', origin);
// this could be a scripted class or enum that hasn't been registered yet
importsToValidate.set(importedClass.name, importedClass);
continue;
Expand Down Expand Up @@ -1908,16 +1913,13 @@ class PolymodInterpEx extends Interp
} else if (PolymodScriptClass.abstractClassImpls.exists(importedClass.fullPath)) {
// We used a macro to map each abstract to its implementation.
importedClass.cls = PolymodScriptClass.abstractClassImpls.get(importedClass.fullPath);
trace('RESOLVED ABSTRACT CLASS ${importedClass.fullPath} -> ${Type.getClassName(importedClass.cls)}');
trace(Type.getClassFields(importedClass.cls));
} else if (_scriptEnumDescriptors.exists(importedClass.fullPath)) {
// do nothing
} else {
var resultCls:Class<Dynamic> = Type.resolveClass(importedClass.fullPath);

// If the class is still not found, skip this import entirely.
if (resultCls == null) {
//Polymod.error(SCRIPT_CLASS_MODULE_NOT_FOUND, 'Could not import class ${importedClass.fullPath}', origin);
// this could be a scripted class that hasn't been registered yet
importsToValidate.set(importedClass.name, importedClass);
continue;
Expand Down
Loading