StructTypeRequiredArgs returns type arguments of a StructType.
(tpe ast.BaseTerm)
| 184 | |
| 185 | // StructTypeRequiredArgs returns type arguments of a StructType. |
| 186 | func StructTypeRequiredArgs(tpe ast.BaseTerm) ([]ast.BaseTerm, error) { |
| 187 | if debug && !IsStructTypeExpression(tpe) { |
| 188 | return nil, fmt.Errorf("not a struct type expression: %v", tpe) |
| 189 | } |
| 190 | var required []ast.BaseTerm |
| 191 | for _, arg := range typeArgs(tpe) { |
| 192 | if !IsOptional(arg) { |
| 193 | required = append(required, arg) |
| 194 | } |
| 195 | } |
| 196 | return required, nil |
| 197 | } |
| 198 | |
| 199 | // StructTypeOptionaArgs returns type arguments of a StructType. |
| 200 | func StructTypeOptionaArgs(tpe ast.BaseTerm) ([]ast.BaseTerm, error) { |