MCPcopy
hub / github.com/caddyserver/caddy / isCELStringListLiteral

Function isCELStringListLiteral

modules/caddyhttp/celmatcher.go:792–806  ·  view source on GitHub ↗

isCELStringListLiteral returns whether the expression resolves to a list literal containing only string constants or a placeholder call.

(e ast.Expr)

Source from the content-addressed store, hash-verified

790// isCELStringListLiteral returns whether the expression resolves to a list literal
791// containing only string constants or a placeholder call.
792func isCELStringListLiteral(e ast.Expr) bool {
793 switch e.Kind() {
794 case ast.ListKind:
795 list := e.AsList()
796 for _, elem := range list.Elements() {
797 if !isCELStringExpr(elem) {
798 return false
799 }
800 }
801 return true
802 case ast.UnspecifiedExprKind, ast.CallKind, ast.ComprehensionKind, ast.IdentKind, ast.LiteralKind, ast.MapKind, ast.SelectKind, ast.StructKind:
803 // appeasing the linter :)
804 }
805 return false
806}
807
808// Variables used for replacing Caddy placeholders in CEL
809// expressions with a proper CEL function call; this is

Callers 1

Calls 1

isCELStringExprFunction · 0.70

Tested by

no test coverage detected