Skip to content

Commit

Permalink
refactor: remove ResolvedReference struct
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjarosch committed Feb 15, 2024
1 parent a31e569 commit 8f46330
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ func (ref Reference) Name() string {
return fmt.Sprintf("${%s}", strings.ReplaceAll(ref.TargetPath.String(), ".", ":"))
}

type ResolvedReference struct {
Reference
// TargetValue is the value to which the TargetPath points to.
// If TargetReference is not nil, this value must be [data.NilValue].
TargetValue data.Value
// TargetReference is non-nil if the Reference points to another [ResolvedReference]
// If the Reference just points to a scalar value, this will be nil.
TargetReference *ResolvedReference
}

type ReferenceSourceWalker interface {
WalkValues(func(path data.Path, value data.Value) error) error
}
Expand Down
4 changes: 2 additions & 2 deletions reference_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ func TestResolveReferencesSimple(t *testing.T) {
// Test: resolve all valid references which have a direct TargetValue
resolved, err := ResolveReferences(expectedReferencesSimple, class)
assert.NoError(t, err)
assert.Len(t, resolved, len(expectedReferencesSimple), "Every Reference should emit a ResolveReference")
assert.Len(t, resolved, len(expectedReferencesSimple))
for _, resolved := range resolved {
assert.Contains(t, expectedReferencesSimple, resolved, "ResolvedReference should be returned")
assert.Contains(t, expectedReferencesSimple, resolved)
}

// Test: references with invalid TargetPath
Expand Down

0 comments on commit 8f46330

Please sign in to comment.