( expr: CELExpr, negative: boolean = false )
| 198 | }; |
| 199 | |
| 200 | const resolveStringExpr = ( |
| 201 | expr: CELExpr, |
| 202 | negative: boolean = false |
| 203 | ): StringExpr => { |
| 204 | const callExpr = |
| 205 | expr.exprKind?.case === "callExpr" ? expr.exprKind.value : null; |
| 206 | if (!callExpr) |
| 207 | throw new Error(`Expected callExpr but got ${expr.exprKind?.case}`); |
| 208 | let operator = callExpr.function as StringOperator; |
| 209 | if (negative && operator === "contains") { |
| 210 | operator = "@not_contains"; |
| 211 | } |
| 212 | const factor = getFactorName(callExpr.target!); |
| 213 | const value = callExpr.args[0]; |
| 214 | return { |
| 215 | type: ExprType.Condition, |
| 216 | operator, |
| 217 | args: [factor as StringFactor, getConstantStringValue(value)], |
| 218 | }; |
| 219 | }; |
| 220 | |
| 221 | const resolveCollectionExpr = ( |
| 222 | expr: CELExpr, |
no test coverage detected