MCPcopy Create free account
hub / github.com/goadesign/goa / hasAnyType

Function hasAnyType

grpc/codegen/service_data.go:1465–1493  ·  view source on GitHub ↗

hasAnyType recursively checks if the given attribute uses the Any type.

(att *expr.AttributeExpr)

Source from the content-addressed store, hash-verified

1463
1464// hasAnyType recursively checks if the given attribute uses the Any type.
1465func hasAnyType(att *expr.AttributeExpr) bool {
1466 if att == nil {
1467 return false
1468 }
1469 if att.Type.Kind() == expr.AnyKind {
1470 return true
1471 }
1472 switch dt := att.Type.(type) {
1473 case expr.UserType:
1474 return hasAnyType(dt.Attribute())
1475 case *expr.Object:
1476 for _, nat := range *dt {
1477 if hasAnyType(nat.Attribute) {
1478 return true
1479 }
1480 }
1481 case *expr.Array:
1482 return hasAnyType(dt.ElemType)
1483 case *expr.Map:
1484 return hasAnyType(dt.KeyType) || hasAnyType(dt.ElemType)
1485 case *expr.Union:
1486 for _, nat := range dt.Values {
1487 if hasAnyType(nat.Attribute) {
1488 return true
1489 }
1490 }
1491 }
1492 return false
1493}

Callers 5

clientTypeFunction · 0.85
endpointParserFunction · 0.85
payloadBuildersFunction · 0.85
TestHasAnyTypeFunction · 0.85
serverTypeFunction · 0.85

Calls 2

KindMethod · 0.65
AttributeMethod · 0.65

Tested by 1

TestHasAnyTypeFunction · 0.68