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

Function isCELStringLiteral

modules/caddyhttp/celmatcher.go:738–750  ·  view source on GitHub ↗

isCELStringLiteral returns whether the expression is a CEL string literal.

(e ast.Expr)

Source from the content-addressed store, hash-verified

736
737// isCELStringLiteral returns whether the expression is a CEL string literal.
738func isCELStringLiteral(e ast.Expr) bool {
739 switch e.Kind() {
740 case ast.LiteralKind:
741 constant := e.AsLiteral()
742 switch constant.Type() {
743 case types.StringType:
744 return true
745 }
746 case ast.UnspecifiedExprKind, ast.CallKind, ast.ComprehensionKind, ast.IdentKind, ast.ListKind, ast.MapKind, ast.SelectKind, ast.StructKind:
747 // appeasing the linter :)
748 }
749 return false
750}
751
752// isCELCaddyPlaceholderCall returns whether the expression is a caddy placeholder call.
753func isCELCaddyPlaceholderCall(e ast.Expr) bool {

Callers 1

isCELStringExprFunction · 0.70

Calls 1

TypeMethod · 0.45

Tested by

no test coverage detected