(expr ast.Expr)
| 85 | } |
| 86 | |
| 87 | func (un *unparser) visit(expr ast.Expr) error { |
| 88 | if expr == nil { |
| 89 | return errors.New("unsupported expression") |
| 90 | } |
| 91 | visited, err := un.visitMaybeMacroCall(expr) |
| 92 | if visited || err != nil { |
| 93 | return err |
| 94 | } |
| 95 | switch expr.Kind() { |
| 96 | case ast.CallKind: |
| 97 | return un.visitCall(expr) |
| 98 | case ast.LiteralKind: |
| 99 | return un.visitConst(expr) |
| 100 | case ast.IdentKind: |
| 101 | return un.visitIdent(expr) |
| 102 | case ast.ListKind: |
| 103 | return un.visitList(expr) |
| 104 | case ast.MapKind: |
| 105 | return un.visitStructMap(expr) |
| 106 | case ast.SelectKind: |
| 107 | return un.visitSelect(expr) |
| 108 | case ast.StructKind: |
| 109 | return un.visitStructMsg(expr) |
| 110 | default: |
| 111 | return fmt.Errorf("unsupported expression: %v", expr) |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | func (un *unparser) visitCall(expr ast.Expr) error { |
| 116 | c := expr.AsCall() |
no test coverage detected