isCFC = ASMUtil.getAncestorPage(tag).isComponent();
} catch (BytecodeException e) {}
Attribute attrName = tag.getAttribute("name");
if(attrName!=null) {
Expression expr = attrName.getValue();
if(expr instanceof LitString && !isCFC){
checkFunctionName(((LitString)expr).getString(),flibs);
}
}
// attribute modifier
Attribute attrModifier = tag.getAttribute("modifier");
if(attrModifier!=null) {
ExprString expr = CastString.toExprString(attrModifier.getValue());
if(!(expr instanceof Literal))
throw new EvaluatorException("Attribute modifier of the Tag Function, must be one of the following literal string values: [abstract] or [final]");
String modifier=StringUtil.emptyIfNull(((Literal)expr).getString()).trim();
if(!StringUtil.isEmpty(modifier) && !"abstract".equalsIgnoreCase(modifier) && !"final".equalsIgnoreCase(modifier))
throw new EvaluatorException("Attribute modifier of the Tag Function, must be one of the following literal string values: [abstract] or [final]");
boolean abstr = "abstract".equalsIgnoreCase(modifier);
if(abstr)throwIfNotEmpty(tag);
}
// cachedWithin
Attribute attrCachedWithin = tag.getAttribute("cachedwithin");
if(attrCachedWithin!=null) {
Expression val = attrCachedWithin.getValue();
tag.addAttribute(new Attribute(attrCachedWithin.isDynamicType(), attrCachedWithin.getName(), LitLong.toExpr(ASMUtil.timeSpanToLong(val), null, null), "numeric"));
}
// Attribute localMode
Attribute attrLocalMode = tag.getAttribute("localmode");
if(attrLocalMode!=null) {
Expression expr = attrLocalMode.getValue();
String str = ASMUtil.toString(expr,null);
if(!StringUtil.isEmpty(str) && AppListenerUtil.toLocalMode(str, -1)==-1)
throw new EvaluatorException("Attribute localMode of the Tag Function, must be a literal value (modern, classic, true or false)");
//boolean output = ((LitBoolean)expr).getBooleanValue();
//if(!output) ASMUtil.removeLiterlChildren(tag, true);
}
// Attribute Output
// "output=true" wird in "railo.transformer.cfml.attributes.impl.Function" geh�ndelt
Attribute attrOutput = tag.getAttribute("output");
if(attrOutput!=null) {
Expression expr = CastBoolean.toExprBoolean(attrOutput.getValue());
if(!(expr instanceof LitBoolean))
throw new EvaluatorException("Attribute output of the Tag Function, must be a literal boolean value (true or false, yes or no)");
//boolean output = ((LitBoolean)expr).getBooleanValue();
//if(!output) ASMUtil.removeLiterlChildren(tag, true);
}
Attribute attrBufferOutput = tag.getAttribute("bufferoutput");
if(attrBufferOutput!=null) {
Expression expr = CastBoolean.toExprBoolean(attrBufferOutput.getValue());
if(!(expr instanceof LitBoolean))
throw new EvaluatorException("Attribute bufferOutput of the Tag Function, must be a literal boolean value (true or false, yes or no)");
//boolean output = ((LitBoolean)expr).getBooleanValue();
//if(!output) ASMUtil.removeLiterlChildren(tag, true);
}