Skip to content

Commit

Permalink
Avoid unnecessary default-func delegator generation for interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Feb 3, 2025
1 parent 0ee77c8 commit 64afc44
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions bbq/compiler/desugar.go
Original file line number Diff line number Diff line change
Expand Up @@ -1231,17 +1231,6 @@ func (d *Desugar) VisitInterfaceDeclaration(declaration *ast.InterfaceDeclaratio
d.modifiedDeclarations = append(d.modifiedDeclarations, desugaredMember)
}

// Add inherited default functions.
existingFunctions := declaration.Members.FunctionsByIdentifier()
inheritedDefaultFuncs := d.inheritedDefaultFunctions(
interfaceType,
existingFunctions,
declaration.StartPos,
declaration.Range,
)

d.modifiedDeclarations = append(d.modifiedDeclarations, inheritedDefaultFuncs...)

// TODO: Optimize: If none of the existing members got updated or,
// if there are no inherited members, then return the same declaration as-is.

Expand Down

0 comments on commit 64afc44

Please sign in to comment.