isUnionMessage returns true if the given attribute is a union message.
(at *expr.AttributeExpr)
| 1120 | |
| 1121 | // isUnionMessage returns true if the given attribute is a union message. |
| 1122 | func isUnionMessage(at *expr.AttributeExpr) bool { |
| 1123 | ut, ok := at.Type.(expr.UserType) |
| 1124 | if !ok { |
| 1125 | return false |
| 1126 | } |
| 1127 | obj := expr.AsObject(ut.Attribute().Type) |
| 1128 | if obj == nil { |
| 1129 | return false |
| 1130 | } |
| 1131 | for _, nat := range *obj { |
| 1132 | if expr.IsUnion(nat.Attribute.Type) { |
| 1133 | return true |
| 1134 | } |
| 1135 | } |
| 1136 | return false |
| 1137 | } |
| 1138 | |
| 1139 | // dupTransformAttrs returns a shallow copy of the given transformAttrs. |
| 1140 | func dupTransformAttrs(ta *transformAttrs) *transformAttrs { |
no test coverage detected