(mef cel.MacroExprFactory, arg0, arg1 ast.Expr)
| 399 | } |
| 400 | |
| 401 | func extractIterVars(mef cel.MacroExprFactory, arg0, arg1 ast.Expr) (string, string, *cel.Error) { |
| 402 | iterVar1, err := extractIterVar(mef, arg0) |
| 403 | if err != nil { |
| 404 | return "", "", err |
| 405 | } |
| 406 | iterVar2, err := extractIterVar(mef, arg1) |
| 407 | if err != nil { |
| 408 | return "", "", err |
| 409 | } |
| 410 | if iterVar1 == iterVar2 { |
| 411 | return "", "", mef.NewError(arg1.ID(), fmt.Sprintf("duplicate variable name: %s", iterVar1)) |
| 412 | } |
| 413 | if iterVar1 == mef.AccuIdentName() || iterVar1 == parser.AccumulatorName { |
| 414 | return "", "", mef.NewError(arg0.ID(), "iteration variable overwrites accumulator variable") |
| 415 | } |
| 416 | if iterVar2 == mef.AccuIdentName() || iterVar2 == parser.AccumulatorName { |
| 417 | return "", "", mef.NewError(arg1.ID(), "iteration variable overwrites accumulator variable") |
| 418 | } |
| 419 | return iterVar1, iterVar2, nil |
| 420 | } |
| 421 | |
| 422 | func extractIterVar(mef cel.MacroExprFactory, target ast.Expr) (string, *cel.Error) { |
| 423 | iterVar, found := extractIdent(target) |
no test coverage detected