Created
May 20, 2020 21:21
-
-
Save verdverm/3455a4bdc1e8232f55ab8522f523f60f to your computer and use it in GitHub Desktop.
Attributes function patch for Cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (v Value) Attributes() map[string]Attribute { | |
attrs := map[string]Attribute{} | |
// return empty | |
if v.path == nil || v.path.attrs == nil { | |
return attrs | |
} | |
// collect attribues | |
for _, a := range v.path.attrs.attr { | |
A := Attribute{internal.ParseAttrBody(token.NoPos, a.body())} | |
attrs[a.key()] = A | |
} | |
return attrs | |
} |
This should actually be returning a cue.Value, and when it does, it will be added into Cue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should go into the cue/test.go file, I put it next to the singular version of the function.