d2ir: Explain EnsureField misnomer

This commit is contained in:
Anmol Sethi 2023-07-29 16:45:30 -07:00
parent ff47a00abf
commit 82663f0445
No known key found for this signature in database
GPG key ID: 8CEF1878FF10ADEB

View file

@ -653,6 +653,7 @@ func (m *Map) getField(ida []string) *Field {
return nil
}
// EnsureField is a bit of a misnomer. It's more of a Query/Ensure combination function at this point.
func (m *Map) EnsureField(kp *d2ast.KeyPath, refctx *RefContext, create bool) ([]*Field, error) {
i := 0
for kp.Path[i].Unbox().ScalarString() == "_" {