sortedNamedAttributes returns object fields sorted by attribute name. Union naming uses NameScope uniqueness, so callers that discover unions while traversing objects must use a deterministic field order to avoid oscillating generated identifiers across runs.
(attrs []*expr.NamedAttributeExpr)
| 2859 | // traversing objects must use a deterministic field order to avoid oscillating |
| 2860 | // generated identifiers across runs. |
| 2861 | func sortedNamedAttributes(attrs []*expr.NamedAttributeExpr) []*expr.NamedAttributeExpr { |
| 2862 | if len(attrs) < 2 { |
| 2863 | return attrs |
| 2864 | } |
| 2865 | sorted := slices.Clone(attrs) |
| 2866 | sort.Slice(sorted, func(i, j int) bool { |
| 2867 | return sorted[i].Name < sorted[j].Name |
| 2868 | }) |
| 2869 | return sorted |
| 2870 | } |
| 2871 | |
| 2872 | func (sds *ServicesData) attributeTypeData(ut expr.UserType, req, ptr, server bool, rd *ServiceData) *TypeData { |
| 2873 | if ut == expr.Empty { |
no outgoing calls
no test coverage detected