use of org.erlide.engine.model.erlang.IErlImport in project erlide_eclipse by erlang.
the class ModelInternalUtils method getImportsAsList.
@Override
public List<OtpErlangObject> getImportsAsList(final IErlModule mod) {
if (mod == null) {
return ModelInternalUtils.NO_IMPORTS;
}
final Collection<IErlImport> imports = mod.getImports();
if (imports.isEmpty()) {
return ModelInternalUtils.NO_IMPORTS;
}
final List<OtpErlangObject> result = new ArrayList<>(imports.size());
for (final IErlImport i : imports) {
final Collection<ErlangFunction> functions = i.getFunctions();
final OtpErlangObject[] funsT = new OtpErlangObject[functions.size()];
int j = 0;
for (final ErlangFunction f : functions) {
funsT[j] = f.getNameArityTuple();
j++;
}
final OtpErlangTuple modFunsT = new OtpErlangTuple(new OtpErlangObject[] { new OtpErlangAtom(i.getImportModule()), new OtpErlangList(funsT) });
result.add(modFunsT);
}
return result;
}
use of org.erlide.engine.model.erlang.IErlImport in project erlide_eclipse by erlang.
the class ErlParser method addImportAttribute.
private IErlImport addImportAttribute(final IErlModule module, final OtpErlangObject pos, final OtpErlangObject val) {
final OtpErlangTuple t = (OtpErlangTuple) val;
if (t.elementAt(0) instanceof OtpErlangAtom && t.elementAt(1) instanceof OtpErlangList) {
final OtpErlangAtom importModule = (OtpErlangAtom) t.elementAt(0);
final OtpErlangList functionList = (OtpErlangList) t.elementAt(1);
final ErlImport imp = new ErlImport(module, importModule.atomValue(), functionList);
setPos(imp, pos);
return imp;
}
return null;
}
Aggregations