Skip to content

Commit

Permalink
Merge pull request #2783 from m-Peter/refine-test-framework-api
Browse files Browse the repository at this point in the history
Refine API of the testing framework
  • Loading branch information
SupunS authored Sep 27, 2023
2 parents b9b9568 + 20a58ec commit 368d7e3
Show file tree
Hide file tree
Showing 7 changed files with 577 additions and 524 deletions.
14 changes: 12 additions & 2 deletions runtime/sema/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,11 @@ func (t *CompositeType) GetMembers() map[string]MemberResolver {
}

func (t *CompositeType) initializeMemberResolvers() {
t.memberResolversOnce.Do(func() {
t.memberResolversOnce.Do(t.initializerMemberResolversFunc())
}

func (t *CompositeType) initializerMemberResolversFunc() func() {
return func() {
memberResolvers := MembersMapAsResolvers(t.Members)

// Check conformances.
Expand All @@ -4313,7 +4317,13 @@ func (t *CompositeType) initializeMemberResolvers() {
})

t.memberResolvers = withBuiltinMembers(t, memberResolvers)
})
}
}

func (t *CompositeType) ResolveMembers() {
if t.Members.Len() != len(t.GetMembers()) {
t.initializerMemberResolversFunc()()
}
}

func (t *CompositeType) FieldPosition(name string, declaration ast.CompositeLikeDeclaration) ast.Position {
Expand Down
Loading

0 comments on commit 368d7e3

Please sign in to comment.