Skip to content

Commit

Permalink
Plumb through set rather than converting to slice
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Nov 5, 2024
1 parent 727ef91 commit ccf4d79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/composableschemadsl/compiler/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type translationContext struct {
mapper input.PositionMapper
schemaString string
skipValidate bool
existingNames []string
existingNames *mapz.Set[string]
sourceFolder string
}

Expand Down Expand Up @@ -51,7 +51,9 @@ func translate(tctx translationContext, root *dslNode) (*CompiledSchema, error)
var objectDefinitions []*core.NamespaceDefinition
var caveatDefinitions []*core.CaveatDefinition

names := mapz.NewSet(tctx.existingNames...)
// Copy the name set so that we're not mutating the parent's context
// as we do our walk
names := tctx.existingNames.Copy()

for _, topLevelNode := range root.GetChildren() {
switch topLevelNode.GetType() {
Expand Down

0 comments on commit ccf4d79

Please sign in to comment.