isCELStringLiteral returns whether the expression is a CEL string literal.
(e ast.Expr)
| 736 | |
| 737 | // isCELStringLiteral returns whether the expression is a CEL string literal. |
| 738 | func 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. |
| 753 | func isCELCaddyPlaceholderCall(e ast.Expr) bool { |