Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Jan 24, 2025
1 parent 1212aa2 commit 5c1c4c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions bbq/compiler/desugar.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package compiler

import (
"fmt"

"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/bbq/commons"
"github.com/onflow/cadence/common"
Expand Down Expand Up @@ -288,10 +289,9 @@ func (d *Desugar) desugarConditions(
desugaredConditions = append(desugaredConditions, invocation)
}
}
} else {
if funcBlock != nil {
conditions = funcBlock.PostConditions
}
} else if funcBlock != nil {
// Post conditions
conditions = funcBlock.PostConditions
}

// Desugar self-defined pre/post conditions
Expand Down Expand Up @@ -345,20 +345,25 @@ func (d *Desugar) desugarConditions(

// Otherwise, i.e: if this is an interface function with only pre/post conditions,
// (thus not a default function), then generate a separate function for the conditions.
d.generateConditionsFunction(enclosingFuncName, kind, pos, conditions, desugaredConditions, list)
d.generateConditionsFunction(
enclosingFuncName,
kind,
conditions,
desugaredConditions,
list,
)

return nil
}

func (d *Desugar) generateConditionsFunction(
enclosingFuncName string,
kind ast.ConditionKind,
pos ast.Position,
conditions *ast.Conditions,
desugaredConditions []ast.Statement,
list *ast.ParameterList,
) {
pos = conditions.StartPos
pos := conditions.StartPos

desugaredConditions = append(
desugaredConditions,
Expand Down Expand Up @@ -650,7 +655,7 @@ func (d *Desugar) inheritedFunctionsWithConditions(compositeType *sema.Composite
interfaceDecl := elaboration.InterfaceTypeDeclaration(interfaceType)
functions := interfaceDecl.Members.FunctionsByIdentifier()

for name, functionDecl := range functions {
for name, functionDecl := range functions { // nolint:maprange
if !functionDecl.FunctionBlock.HasConditions() {
continue
}
Expand All @@ -674,7 +679,7 @@ func (d *Desugar) inheritedDefaultFunctions(compositeType *sema.CompositeType, d

inheritedMembers := make([]ast.Declaration, 0)

for memberName, resolver := range allMembers {
for memberName, resolver := range allMembers { // nolint:maprange
if directMembers.Contains(memberName) {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion bbq/vm/test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func parseCheckAndCompileCodeWithOptions(
return program
}

func parseAndCheck(
func parseAndCheck( // nolint:unused
t testing.TB,
code string,
location common.Location,
Expand Down

0 comments on commit 5c1c4c0

Please sign in to comment.