From 81ce1f8209f17f4572a9bc16d49734733e93daad Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 2 Mar 2023 18:25:14 -0800 Subject: [PATCH] pr feedback --- d2compiler/compile.go | 3 +-- d2format/format.go | 8 -------- d2ir/compile.go | 2 +- d2ir/d2ir.go | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 6be93af4e..27aaadb61 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -781,9 +781,8 @@ func hasBoard(root *d2graph.Graph, ida []string) bool { return hasBoard(b, ida[i+1:]) } } - default: - break } + break } return false } diff --git a/d2format/format.go b/d2format/format.go index 3279fb069..e979a6fea 100644 --- a/d2format/format.go +++ b/d2format/format.go @@ -409,11 +409,3 @@ func KeyPath(kp *d2ast.KeyPath) (ida []string) { } return ida } - -func IDA(ida []string) *d2ast.KeyPath { - kp := &d2ast.KeyPath{} - for _, s := range ida { - kp.Path = append(kp.Path, d2ast.MakeValueBox(d2ast.RawString(s, true)).StringBox()) - } - return kp -} diff --git a/d2ir/compile.go b/d2ir/compile.go index 2a8e3a8af..41e54dadc 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -197,7 +197,7 @@ func (c *compiler) compileLink(refctx *RefContext) { // Create the absolute path by appending scope path with value specified scopeIDA = append(scopeIDA, linkIDA...) - kp := d2format.IDA(scopeIDA) + kp := d2ast.MakeKeyPath(scopeIDA) refctx.Key.Value = d2ast.MakeValueBox(d2ast.RawString(d2format.Format(kp), true)) } diff --git a/d2ir/d2ir.go b/d2ir/d2ir.go index aa6a4734c..8a687bbdf 100644 --- a/d2ir/d2ir.go +++ b/d2ir/d2ir.go @@ -1053,7 +1053,7 @@ func BoardIDA(n Node) (ida []string) { } } -// IDA returns the absolute path to n from the nearest board root. +// IDA returns the absolute path to n. func IDA(n Node) (ida []string) { for { f, ok := n.(*Field)