Skip to content

Commit

Permalink
chore: optimize numNames check
Browse files Browse the repository at this point in the history
Co-authored-by: Mikael VALLENET <mikael.vallenetpro@gmail.com>
  • Loading branch information
hthieu1110 and MikaelVallenet authored Oct 26, 2024
1 parent b050dc6 commit 81b6be5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gnovm/pkg/gnolang/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -2373,8 +2373,8 @@ func defineOrDecl(

// Generate the placeholders for types, typeValues, nameExprs for all vars
func prepareTypeVals(n Node, numNames int) ([]Type, []TypedValue, NameExprs) {
if numNames == 0 {
panic("cannot assign to 0 name")
if numNames < 1 {
panic("must have at least one name to assign")

Check warning on line 2377 in gnovm/pkg/gnolang/preprocess.go

View check run for this annotation

Codecov / codecov/patch

gnovm/pkg/gnolang/preprocess.go#L2377

Added line #L2377 was not covered by tests
}

nameExprs := make(NameExprs, numNames)
Expand Down

0 comments on commit 81b6be5

Please sign in to comment.