// only try to compile if there are no parse errors
if ( !hasErrors() ) {
if ( !packageDescr.getFunctions().isEmpty() ) {
for ( final Iterator it = packageDescr.getFunctions().iterator(); it.hasNext(); ) {
FunctionDescr functionDescr = (FunctionDescr) it.next();
if ( isEmpty( functionDescr.getNamespace() ) ) {
// make sure namespace is set on components
functionDescr.setNamespace( packageDescr.getNamespace() );
}
if ( isEmpty( functionDescr.getDialect() ) ) {
// make sure namespace is set on components
functionDescr.setDialect( pkgRegistry.getDialect() );
}
preCompileAddFunction( functionDescr );
}
// iterate and compile
for ( final Iterator it = packageDescr.getFunctions().iterator(); it.hasNext(); ) {
// inherit the dialect from the package
FunctionDescr functionDescr = (FunctionDescr) it.next();
addFunction( functionDescr );
}
// We need to compile all the functions now, so scripting
// languages like mvel can find them
compileAll();
for ( final Iterator it = packageDescr.getFunctions().iterator(); it.hasNext(); ) {
FunctionDescr functionDescr = (FunctionDescr) it.next();
postCompileAddFunction( functionDescr );
}
}
// iterate and compile