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

Function isCELStringLiteral

modules/caddyhttp/fileserver/matcher.go:646–658  ·  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

644
645// isCELStringLiteral returns whether the expression is a CEL string literal.
646func isCELStringLiteral(e ast.Expr) bool {
647 switch e.Kind() {
648 case ast.LiteralKind:
649 constant := e.AsLiteral()
650 switch constant.Type() {
651 case types.StringType:
652 return true
653 }
654 case ast.UnspecifiedExprKind, ast.CallKind, ast.ComprehensionKind, ast.IdentKind, ast.ListKind, ast.MapKind, ast.SelectKind, ast.StructKind:
655 // appeasing the linter :)
656 }
657 return false
658}
659
660// isCELCaddyPlaceholderCall returns whether the expression is a caddy placeholder call.
661func isCELCaddyPlaceholderCall(e ast.Expr) bool {

Callers 3

isCELTryFilesLiteralFunction · 0.70
isCELStringExprFunction · 0.70

Calls 1

TypeMethod · 0.45

Tested by

no test coverage detected