ReType ensures that the given numeric expression evaluates to the requested type, inserting a cast if necessary.
(expr TypedExpr, wantedType *types.T)
| 975 | // ReType ensures that the given numeric expression evaluates |
| 976 | // to the requested type, inserting a cast if necessary. |
| 977 | func ReType(expr TypedExpr, wantedType *types.T) TypedExpr { |
| 978 | if expr.ResolvedType().Equivalent(wantedType) { |
| 979 | return expr |
| 980 | } |
| 981 | res := &CastExpr{Expr: expr, Type: wantedType} |
| 982 | res.typ = wantedType |
| 983 | return res |
| 984 | } |
no test coverage detected
searching dependent graphs…