use of lucee.transformer.bytecode.statement.HasBodies in project Lucee by lucee.
the class SourceLastModifiedClassAdapter method getImports.
private static void getImports(List<String> list, Body body) throws TransformerException {
if (ASMUtil.isEmpty(body))
return;
Statement stat;
List stats = body.getStatements();
int len = stats.size();
for (int i = 0; i < len; i++) {
stat = (Statement) stats.get(i);
// IFunction
if (stat instanceof TagImport && !StringUtil.isEmpty(((TagImport) stat).getPath(), true)) {
ImportDefintion id = ImportDefintionImpl.getInstance(((TagImport) stat).getPath(), null);
if (id != null && (!list.contains(id.toString()) && !list.contains(id.getPackage() + ".*"))) {
list.add(id.toString());
}
stats.remove(i);
len--;
i--;
} else if (stat instanceof HasBody)
getImports(list, ((HasBody) stat).getBody());
else if (stat instanceof HasBodies) {
Body[] bodies = ((HasBodies) stat).getBodies();
for (int y = 0; y < bodies.length; y++) {
getImports(list, bodies[y]);
}
}
}
}
Aggregations