cherriesandmochi / gdmaim

GDMaim is a GDScript obfuscation plugin for the Godot Engine.
MIT License
145 stars 13 forks source link

Obfuscation breaking with two lambdas #13

Closed Nukiloco closed 2 months ago

Nukiloco commented 6 months ago

It seems like when obfuscating code, having code with something on the lines of this:

var lambda1 = func():
    # "test value" here will not get obfuscated
    var test_value = some_global_class.fruits.map(func(a): return a)
    # however "test value" here will get obfuscated, which will break the project
    print(test_value)

will break the code

Nukiloco commented 6 months ago

Even with turning off the obfuscation for the line, it seems like it gets ignored and any variable containing that variable name still gets obfuscated.

cherriesandmochi commented 6 months ago

Thanks! Nested lambdas don't work very well at the moment. I do already have a rework for the way scope is being handled in mind, which should fix issues like this, but haven't started working on it yet.

Nukiloco commented 6 months ago

Here is a reproduction project for the issue! gdmaim_lambda_issue_1.zip

cherriesandmochi commented 2 months ago

Fixed by 7faaac7. Thanks for the bug report!