Skip to content

Commit

Permalink
next
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jul 27, 2024
1 parent 32ece4a commit e0d3938
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
- Fix importing a file with nested boards [#1998](https://github.com/terrastruct/d2/pull/1998)
- Fix importing a file with underscores in links [#1999](https://github.com/terrastruct/d2/pull/1999)
- Replace a panic with an error message resulting from invalid `link` usage [#2011](https://github.com/terrastruct/d2/pull/2011)
- Fix globs not applying to scenarios on keys that were applied in earlier scenarios [#2021](https://github.com/terrastruct/d2/pull/2021)
24 changes: 11 additions & 13 deletions d2ir/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ type globContext struct {
appliedEdges map[string]struct{}
}

func (g *globContext) copyApplied(from *globContext) {
g.appliedFields = make(map[string]struct{})
for k, v := range from.appliedFields {
g.appliedFields[k] = v
}
g.appliedEdges = make(map[string]struct{})
for k, v := range from.appliedEdges {
g.appliedEdges[k] = v
}
}

type compiler struct {
err *d2parser.ParseError

Expand Down Expand Up @@ -390,13 +379,22 @@ func (c *compiler) overlay(base *Map, f *Field) {
func (g *globContext) copy() *globContext {
g2 := *g
g2.refctx = g.root.refctx.Copy()

return &g2
}

func (g *globContext) copyApplied(from *globContext) {
g.appliedFields = make(map[string]struct{})
for k, v := range from.appliedFields {
g.appliedFields[k] = v
}
g.appliedEdges = make(map[string]struct{})
for k, v := range from.appliedEdges {
g.appliedEdges[k] = v
}
}

func (g *globContext) prefixed(dst *Map) *globContext {
g2 := g.copy()

prefix := d2ast.MakeKeyPath(RelIDA(g2.refctx.ScopeMap, dst))
g2.refctx.Key = g2.refctx.Key.Copy()
if g2.refctx.Key.Key != nil {
Expand Down

0 comments on commit e0d3938

Please sign in to comment.