Skip to content

Commit

Permalink
stop passing ignoreObjects to literals.Obfuscate
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mvdan authored and capnspacehook committed Jan 10, 2022
1 parent c506f02 commit d25e718
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/literals/literals.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit d25e718

Please sign in to comment.