MustAddExplicitTypeCast registers the given explicit type cast. Panics if an error occurs.
(builtInCasts map[id.Cast]casts.Cast, cast TypeCast)
| 32 | |
| 33 | // MustAddExplicitTypeCast registers the given explicit type cast. Panics if an error occurs. |
| 34 | func MustAddExplicitTypeCast(builtInCasts map[id.Cast]casts.Cast, cast TypeCast) { |
| 35 | castID := id.NewCast(cast.FromType.ID, cast.ToType.ID) |
| 36 | if _, ok := builtInCasts[castID]; ok { |
| 37 | panic("duplicate built-in cast") |
| 38 | } |
| 39 | builtInCasts[castID] = casts.Cast{ |
| 40 | ID: castID, |
| 41 | CastType: casts.CastType_Explicit, |
| 42 | Function: id.NullFunction, |
| 43 | BuiltIn: cast.Function, |
| 44 | UseInOut: false, |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | // MustAddAssignmentTypeCast registers the given assignment type cast. Panics if an error occurs. |
| 49 | func MustAddAssignmentTypeCast(builtInCasts map[id.Cast]casts.Cast, cast TypeCast) { |
no test coverage detected