(expr ast.Expr)
| 121 | } |
| 122 | |
| 123 | func (un *unparser) visit(expr ast.Expr) error { |
| 124 | if expr == nil { |
| 125 | return errors.New("unsupported expression") |
| 126 | } |
| 127 | visited, err := un.visitMaybeMacroCall(expr) |
| 128 | if visited || err != nil { |
| 129 | return err |
| 130 | } |
| 131 | switch expr.Kind() { |
| 132 | case ast.CallKind: |
| 133 | return un.visitCall(expr) |
| 134 | case ast.LiteralKind: |
| 135 | return un.visitConst(expr) |
| 136 | case ast.IdentKind: |
| 137 | return un.visitIdent(expr) |
| 138 | case ast.ListKind: |
| 139 | return un.visitList(expr) |
| 140 | case ast.MapKind: |
| 141 | return un.visitStructMap(expr) |
| 142 | case ast.SelectKind: |
| 143 | return un.visitSelect(expr) |
| 144 | case ast.StructKind: |
| 145 | return un.visitStructMsg(expr) |
| 146 | default: |
| 147 | return fmt.Errorf("unsupported expression: %v", expr) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func (un *unparser) visitCall(expr ast.Expr) error { |
| 152 | c := expr.AsCall() |
no test coverage detected