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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user