isCELStringListLiteral returns whether the expression resolves to a list literal containing only string constants or a placeholder call.
(e ast.Expr)
| 790 | // isCELStringListLiteral returns whether the expression resolves to a list literal |
| 791 | // containing only string constants or a placeholder call. |
| 792 | func 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 |
no test coverage detected