avoid breaking const declarations using iotas
With the -literals flag, we try to convert some const declarations to vars, as long as that doesn't break typechecking. We really only do that for typed constant strings, really. There was a quirk: if a numerical constant had a type and used iota, we would not obfuscate its value, but we would still convert the declaration from const to var. Since iotas only work within const declarations, that would break compilation: > garble -literals build [stderr] # test/main FeWE3zwi.go:19: undefined: iota exit status 2 To fix the problem, make the logic more conservative: only obfuscate constant declarations where the values are typed strings, meaning that any numerical constants are left entirely untouched. This fixes the build of google.golang.org/protobuf/runtime/protoiface with -literals turned on.pull/367/head
parent
c1672cdc0d
commit
691a44cecb
Loading…
Reference in New Issue