use of org.absmodels.abs.plugin.internal.TypecheckInternalException in project abstools by abstools.
the class AbsNature method addPackagesForTypeChecking.
/**
* Add ABS package dependencies to {@link AbsNature#modelbuilder} for type checking
* @throws TypecheckInternalException
*/
private void addPackagesForTypeChecking() throws TypecheckInternalException {
try {
Main m = new Main();
m.setWithStdLib(true);
List<CompilationUnit> units = new ArrayList<CompilationUnit>();
for (PackageEntry entry : packageContainer.getPackages()) {
File file = new File(entry.getPath());
if (isABSPackage(file)) {
units.addAll(m.parseABSPackageFile(file));
}
}
modelbuilder.addCompilationUnits(units);
} catch (IOException e) {
throw new TypecheckInternalException(e);
} catch (NoModelException e) {
// ignore
}
}
use of org.absmodels.abs.plugin.internal.TypecheckInternalException in project abstools by abstools.
the class AbsNature method typeCheckModel.
/**
* takes the properties from the project preference store for location type checking and location type precision. Typeckecks
* the current model in the current model builder.
* Note that your model must be sufficiently "complete" and not have any semantic errors .
* @param monitor
* @throws CoreException {@link IResource#deleteMarkers(String, boolean, int)} does not handle exceptions thrown by
* #createMarker(SemanticError) and #createMarker(TypecheckInternalException)
*/
void typeCheckModel(IProgressMonitor monitor) throws CoreException {
getProject().deleteMarkers(TYPECHECK_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
getProject().deleteMarkers(LOCATION_TYPE_INFERENCE_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
boolean dolocationtypecheck = getProjectPreferenceStore().getBoolean(LOCATION_TYPECHECK);
String defaultlocationtype = getProjectPreferenceStore().getString(DEFAULT_LOCATION_TYPE);
String defaultlocationtypeprecision = getProjectPreferenceStore().getString(LOCATION_TYPE_PRECISION);
boolean checkProducts = getProjectPreferenceStore().getBoolean(PRODUCT_TYPECHECK);
try {
addPackagesForTypeChecking();
final SemanticConditionList typeerrors = modelbuilder.typeCheckModel(monitor, dolocationtypecheck, defaultlocationtype, defaultlocationtypeprecision, checkProducts);
createMarkers(typeerrors);
if (dolocationtypecheck) {
createLocationTypeInferenceMarker();
}
} catch (NoModelException e) {
// ignore
return;
} catch (TypecheckInternalException e) {
/* Internal error caught. Log, and turn into an error marker */
Activator.logException(e);
createMarker(e);
return;
}
}
Aggregations