blob: a68a7a6913ff14936df699b9f64557318aef798b [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package summarize
import (
"go.fuchsia.dev/fuchsia/tools/fidl/lib/fidlgen"
)
// alias represents an element corresponding to a FIDL alias declaration.
type alias struct {
named
notMember
}
const aliasType Kind = "alias"
// String implements Element.
func (a alias) String() string {
return a.Serialize().String()
}
func (a alias) Serialize() ElementStr {
e := a.named.Serialize()
e.Kind = aliasType
return e
}
// addAliases adds the aliases from the declaration map.
func (s *summarizer) addAliases(decls fidlgen.DeclMap) {
for d, t := range decls {
// Aliases only make an appearance in the decls section, where they are
// registered as "type_alias".
if t != "type_alias" {
continue
}
s.addElement(alias{
named: named{name: Name(d)},
})
}
}