// Validator for template(...) private void ValidateTemplateFunction(Expression expression) { ExpressionFunctions.ValidateAtLeastOne(expression); var children0 = expression.Children[0]; if ((children0.ReturnType & ReturnType.Object) == 0 && (children0.ReturnType & ReturnType.String) == 0) { throw new Exception(TemplateErrors.InvalidTemplateName); } // Validate more if the name is string constant if (children0.Type == ExpressionType.Constant) { var templateName = (children0 as Constant).Value.ToString(); CheckTemplateReference(templateName, expression.Children.Skip(1)); } }