Skip to content

Commit

Permalink
Remove workaround with compositeType.ResolveMembers()
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Oct 12, 2023
1 parent e69d6bb commit 1458dcf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
14 changes: 2 additions & 12 deletions runtime/sema/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4294,11 +4294,7 @@ func (t *CompositeType) GetMembers() map[string]MemberResolver {
}

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

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

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

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
1 change: 0 additions & 1 deletion runtime/stdlib/test_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,6 @@ func newTestContractType() *TestContractType {
ty.expectFailureFunction = newTestTypeExpectFailureFunction(
expectFailureFunctionType,
)
compositeType.ResolveMembers()

return ty
}
Expand Down

0 comments on commit 1458dcf

Please sign in to comment.