StructTypeOptionaArgs returns type arguments of a StructType.
(tpe ast.BaseTerm)
| 198 | |
| 199 | // StructTypeOptionaArgs returns type arguments of a StructType. |
| 200 | func StructTypeOptionaArgs(tpe ast.BaseTerm) ([]ast.BaseTerm, error) { |
| 201 | if debug && !IsStructTypeExpression(tpe) { |
| 202 | return nil, fmt.Errorf("not a struct type expression: %v", tpe) |
| 203 | } |
| 204 | var optional []ast.BaseTerm |
| 205 | for _, arg := range typeArgs(tpe) { |
| 206 | if IsOptional(arg) { |
| 207 | optional = append(optional, arg) |
| 208 | } |
| 209 | } |
| 210 | return optional, nil |
| 211 | } |
| 212 | |
| 213 | // StructTypeField returns field type for given field. |
| 214 | func StructTypeField(tpe ast.BaseTerm, field ast.Constant) (ast.BaseTerm, error) { |