return result;
}
public Object evaluateMacro(AttributeRef attributeRef) {
Macro macro = getMacro(attributeRef.getMethodName());
if (macro == null) {
throw new LajaException("Could not find macro '" + attributeRef.getMethodName() + "'");
}
getTemplateTextWriter().pushTextWriter();
if (attributeRef.getMethodArguments() != null) {
macro.populateDataArguments(attributeRef.getMethodArguments().getArguments());
}
Object result = null;
if (macro.getBlock() != null) {
if (macro.isFunction()) {
if (macro.getBlock() == null) {
throw new LajaException("Missing return statement for function '" + macro.getName() + "'");
} else {
result = macro.getBlock().generate();
if (!macro.getBlock().hasReturnBeenExecuted()) {
throw new LajaException("No value was returned from macro '" + macro.getName() + "'");
}
getTemplateTextWriter().popTextWriter();
return result;
}
} else {
macro.getBlock().generate();
result = getTemplateTextWriter().popTextWriter();
}
}
return result;