Literals: Skip constants with inferred values.

Obfuscating literals broke constants
with values inferred via iota before,
because it would be moved to a variable declaration instead.
pull/260/head
lu4p 3 years ago committed by Andrew LeFevre
parent b03cd08c09
commit a397a8e94e

@ -47,6 +47,11 @@ func Obfuscate(files []*ast.File, info *types.Info, fset *token.FileSet, ignoreO
return false
}
if len(spec.Values) == 0 {
// skip constants with inferred values
return false
}
for _, name := range spec.Names {
obj := info.ObjectOf(name)

@ -235,6 +235,13 @@ func stringTypeFunc(s stringType) stringType {
println(s)
return "stringType return" // skip
}
// obfuscating this broke before
const (
iota0 uint8 = iota
iota1
)
-- main.stderr --
Lorem true
First Line

Loading…
Cancel
Save