| 166 | } |
| 167 | |
| 168 | func matchInConstantList(a *ast.AST) ast.ExprMatcher { |
| 169 | return func(e ast.NavigableExpr) bool { |
| 170 | if e.Kind() != ast.CallKind { |
| 171 | return false |
| 172 | } |
| 173 | call := e.AsCall() |
| 174 | if call.FunctionName() != operators.In { |
| 175 | return false |
| 176 | } |
| 177 | aggregateVal := call.Args()[1] |
| 178 | if aggregateVal.Kind() != ast.ListKind { |
| 179 | return false |
| 180 | } |
| 181 | listVal := aggregateVal.AsList() |
| 182 | for _, elem := range listVal.Elements() { |
| 183 | if r, found := a.ReferenceMap()[elem.ID()]; found { |
| 184 | if r.Value != nil { |
| 185 | continue |
| 186 | } |
| 187 | } |
| 188 | if elem.Kind() != ast.LiteralKind { |
| 189 | return false |
| 190 | } |
| 191 | lit := elem.AsLiteral() |
| 192 | if !(lit.Type() == cel.StringType || lit.Type() == cel.IntType || |
| 193 | lit.Type() == cel.UintType || lit.Type() == cel.BoolType) { |
| 194 | return false |
| 195 | } |
| 196 | } |
| 197 | return true |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | func setsIntersects(listA, listB ref.Val) ref.Val { |
| 202 | lA := listA.(traits.Lister) |