stop passing ignoreObjects to literals.Obfuscate

Literal obfuscation uses constant folding now,
so it no longer needs to record identifiers to ignore.
Remove the parameter and the outdated bit of docs.
pull/457/head
Daniel Martí 3 years ago committed by Andrew LeFevre
parent c506f02763
commit d25e718d0c

@ -35,7 +35,7 @@ func randObfuscator() obfuscator {
}
// Obfuscate replaces literals with obfuscated anonymous functions.
func Obfuscate(file *ast.File, info *types.Info, fset *token.FileSet, ignoreObj map[types.Object]bool) *ast.File {
func Obfuscate(file *ast.File, info *types.Info, fset *token.FileSet) *ast.File {
pre := func(cursor *astutil.Cursor) bool {
switch x := cursor.Node().(type) {
case *ast.GenDecl:

@ -1270,7 +1270,6 @@ type transformer struct {
// So far, it records:
//
// * Types which are used for reflection.
// * Identifiers used in constant expressions.
// * Declarations exported via "//export".
// * Types or variables from external packages which were not obfuscated.
ignoreObjects map[types.Object]bool
@ -1366,7 +1365,7 @@ func (tf *transformer) transformGo(file *ast.File) *ast.File {
// Only obfuscate the literals here if the flag is on
// and if the package in question is to be obfuscated.
if flagLiterals && curPkg.ToObfuscate {
file = literals.Obfuscate(file, tf.info, fset, tf.ignoreObjects)
file = literals.Obfuscate(file, tf.info, fset)
}
pre := func(cursor *astutil.Cursor) bool {

Loading…
Cancel
Save