feat(ast): ElementKind list to keep track of all possible ast elements

This is will be useful for being able to marshal and unmarshal the ast,
since we can't easily know what implementation of the Element interface
is supposed to be used.
This commit is contained in:
Guz
2025-05-16 15:12:02 -03:00
parent b9cb8948fc
commit f1912240a0

View File

@@ -186,3 +186,11 @@ func ensureIsolated(e Element) {
type ElementKind string
var elementKindList = map[ElementKind]Element{}
func NewElementKind(name string, t Element) ElementKind {
k := ElementKind(name)
elementKindList[k] = t
return k
}