isCELStringLiteral returns whether the expression is a CEL string literal.
(e ast.Expr)
| 644 | |
| 645 | // isCELStringLiteral returns whether the expression is a CEL string literal. |
| 646 | func 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. |
| 661 | func isCELCaddyPlaceholderCall(e ast.Expr) bool { |
no test coverage detected