Exemple #1
0
 private static IErlElement findLocalCall(
     final IErlModule module,
     final Backend backend,
     final IErlProject erlProject,
     final OpenResult res,
     final IProject project,
     final IErlElement element,
     final boolean checkAllProjects)
     throws ErlModelException, BackendException {
   if (ErlModelUtils.isTypeDefOrRecordDef(element)) {
     return ModelUtils.findTypespec(module, res.getFun());
   }
   final IErlFunction foundElement = ModelUtils.findFunction(module, res.getFunction());
   if (foundElement != null) {
     return foundElement;
   }
   // not local imports
   OtpErlangObject res2 = null;
   String moduleName = null;
   if (module != null) {
     final IErlImport ei = module.findImport(res.getFunction());
     if (ei != null) {
       moduleName = ei.getImportModule();
       final IErlModel model = ErlangCore.getModel();
       res2 =
           ErlideOpen.getSourceFromModule(
               backend, model.getPathVars(), moduleName, model.getExternalModules(erlProject));
     }
   }
   if (res2 instanceof OtpErlangString && moduleName != null) {
     final OtpErlangString otpErlangString = (OtpErlangString) res2;
     final String modulePath = otpErlangString.stringValue();
     return ErlModelUtils.findExternalFunction(
         moduleName, res.getFunction(), modulePath, project, checkAllProjects, module);
   } else {
     return ErlModelUtils.findExternalFunction(
         moduleName, res.getFunction(), null, project, checkAllProjects, module);
   }
 }