Skip to content

Commit

Permalink
Merge pull request #10 from pyroscope-io/fix/resolve-constants-eargerly
Browse files Browse the repository at this point in the history
fix: resolve constants eagerly to avoid infinite loops.
  • Loading branch information
abeaumont authored Apr 6, 2022
2 parents 8042bcd + 7317521 commit 1423737
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ func resolveConstants(classes ClassMap, cpools PoolMap, constants *[]constant, r
if *resolved {
return nil
}
*constants = nil
*resolved = true
for _, c := range *constants {
if err := ResolveConstants(classes, cpools, int(c.classID)); err != nil {
return fmt.Errorf("unable to resolve contants: %w", err)
Expand All @@ -146,8 +148,6 @@ func resolveConstants(classes ClassMap, cpools PoolMap, constants *[]constant, r
return fmt.Errorf("unable to resolve constants for field %s: %w", c.field, err)
}
}
*constants = nil
*resolved = true
return nil
}

Expand Down

0 comments on commit 1423737

Please sign in to comment.