MCPcopy Create free account
hub / github.com/coder/guts / simplifyUnionLiterals

Function simplifyUnionLiterals

bindings/declarations.go:82–99  ·  view source on GitHub ↗
(union *UnionType)

Source from the content-addressed store, hash-verified

80}
81
82func simplifyUnionLiterals(union *UnionType) *UnionType {
83 types := []ExpressionType{}
84 literalSet := map[string]bool{}
85 for _, arg := range union.Types {
86 switch v := arg.(type) {
87 case *LiteralKeyword:
88 key := v.String()
89 if _, ok := literalSet[key]; !ok {
90 literalSet[key] = true
91 types = append(types, arg)
92 }
93 default:
94 types = append(types, arg)
95 }
96 }
97 union.Types = types
98 return union
99}
100
101// VariableStatement is a top level declaration of a variable
102// var foo: string = "bar"

Callers 1

SimplifyFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…