(other Expr)
| 390 | } |
| 391 | |
| 392 | func (e *expr) SetKindCase(other Expr) { |
| 393 | if e == nil { |
| 394 | return |
| 395 | } |
| 396 | if other == nil { |
| 397 | e.exprKindCase = nil |
| 398 | return |
| 399 | } |
| 400 | switch other.Kind() { |
| 401 | case CallKind: |
| 402 | c := other.AsCall() |
| 403 | e.exprKindCase = &baseCallExpr{ |
| 404 | function: c.FunctionName(), |
| 405 | target: c.Target(), |
| 406 | args: c.Args(), |
| 407 | isMember: c.IsMemberFunction(), |
| 408 | } |
| 409 | case ComprehensionKind: |
| 410 | c := other.AsComprehension() |
| 411 | e.exprKindCase = &baseComprehensionExpr{ |
| 412 | iterRange: c.IterRange(), |
| 413 | iterVar: c.IterVar(), |
| 414 | iterVar2: c.IterVar2(), |
| 415 | accuVar: c.AccuVar(), |
| 416 | accuInit: c.AccuInit(), |
| 417 | loopCond: c.LoopCondition(), |
| 418 | loopStep: c.LoopStep(), |
| 419 | result: c.Result(), |
| 420 | } |
| 421 | case IdentKind: |
| 422 | e.exprKindCase = baseIdentExpr(other.AsIdent()) |
| 423 | case ListKind: |
| 424 | l := other.AsList() |
| 425 | optIndexMap := make(map[int32]struct{}, len(l.OptionalIndices())) |
| 426 | for _, idx := range l.OptionalIndices() { |
| 427 | optIndexMap[idx] = struct{}{} |
| 428 | } |
| 429 | e.exprKindCase = &baseListExpr{ |
| 430 | elements: l.Elements(), |
| 431 | optIndices: l.OptionalIndices(), |
| 432 | optIndexMap: optIndexMap, |
| 433 | } |
| 434 | case LiteralKind: |
| 435 | e.exprKindCase = &baseLiteral{Val: other.AsLiteral()} |
| 436 | case MapKind: |
| 437 | e.exprKindCase = &baseMapExpr{ |
| 438 | entries: other.AsMap().Entries(), |
| 439 | } |
| 440 | case SelectKind: |
| 441 | s := other.AsSelect() |
| 442 | e.exprKindCase = &baseSelectExpr{ |
| 443 | operand: s.Operand(), |
| 444 | field: s.FieldName(), |
| 445 | testOnly: s.IsTestOnly(), |
| 446 | } |
| 447 | case StructKind: |
| 448 | s := other.AsStruct() |
| 449 | e.exprKindCase = &baseStructExpr{ |
nothing calls this directly
no test coverage detected