public PType caseATypeExport(ATypeExport exp, TypeCheckInfo question) throws AnalysisException { ILexNameToken name = exp.getName(); ITypeCheckerAssistantFactory af = question.assistantFactory; ModuleEnvironment menv = (ModuleEnvironment)question.env; PDefinition def = af.createPDefinitionListAssistant().findType(menv.getDefinitions(), name, name.getModule()); if (def == null) { TypeCheckerErrors.report(3187, "Exported type " + name + " not defined in module", name.getLocation(), exp); } else { if (exp.getStruct()) { PType type = af.createPDefinitionAssistant().getType(def); if (!(type instanceof ANamedInvariantType) && !(type instanceof ARecordInvariantType)) { TypeCheckerErrors.report(67, "Exported type " + name + " not structured", name.getLocation(), exp); } } } return null; }
public PType caseAOperationExport(AOperationExport exp, TypeCheckInfo question) throws AnalysisException { ITypeCheckerAssistantFactory af = question.assistantFactory; ModuleEnvironment menv = (ModuleEnvironment)question.env; for (ILexNameToken name : exp.getNameList()) { PDefinition def = af.createPDefinitionListAssistant().findName(menv.getDefinitions(), name, NameScope.NAMES); if (def == null) { TypeCheckerErrors.report(3185, "Exported operation " + name + " not defined in module", name.getLocation(), exp); } else { PType act = def.getType(); PType type = question.assistantFactory.createPTypeAssistant().typeResolve(exp.getExportType(), null, THIS, question); exp.setExportType(type); if (act != null && !af.createPTypeAssistant().equals(act, type)) { TypeCheckerErrors.report(3186, "Exported operation type does not match actual type", name.getLocation(), exp); TypeCheckerErrors.detail2("Exported", type, "Actual", act); } } } return null; }
PDefinition def = af.createPDefinitionListAssistant().findName(menv.getDefinitions(), name, NameScope.NAMES);
PDefinition def = af.createPDefinitionListAssistant().findName(menv.getDefinitions(), name, NameScope.NAMES);