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)
| 1217 | // traversing objects must use a deterministic field order to avoid oscillating |
| 1218 | // generated identifiers across runs. |
| 1219 | func sortedNamedAttributes(attrs []*expr.NamedAttributeExpr) []*expr.NamedAttributeExpr { |
| 1220 | if len(attrs) < 2 { |
| 1221 | return attrs |
| 1222 | } |
| 1223 | sorted := slices.Clone(attrs) |
| 1224 | sort.Slice(sorted, func(i, j int) bool { |
| 1225 | return sorted[i].Name < sorted[j].Name |
| 1226 | }) |
| 1227 | return sorted |
| 1228 | } |
| 1229 | |
| 1230 | // primitiveAliasGoType resolves the native Go type for a primitive alias branch. |
| 1231 | // It uses expr.IsPrimitive to enforce the type contract and then unwraps aliases. |
no outgoing calls
no test coverage detected