MCPcopy
hub / github.com/google/mangle / StructTypeOptionaArgs

Function StructTypeOptionaArgs

symbols/typeexprs.go:200–211  ·  view source on GitHub ↗

StructTypeOptionaArgs returns type arguments of a StructType.

(tpe ast.BaseTerm)

Source from the content-addressed store, hash-verified

198
199// StructTypeOptionaArgs returns type arguments of a StructType.
200func 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.
214func StructTypeField(tpe ast.BaseTerm, field ast.Constant) (ast.BaseTerm, error) {

Callers 3

HasTypeMethod · 0.85
TypeConformsFunction · 0.85
TestAccessFunction · 0.85

Calls 3

IsStructTypeExpressionFunction · 0.85
typeArgsFunction · 0.85
IsOptionalFunction · 0.85

Tested by 1

TestAccessFunction · 0.68