vineflower icon indicating copy to clipboard operation
vineflower copied to clipboard

Doesn't rename "this" parameter

Open Gaming32 opened this issue 2 years ago • 0 comments

If a parameter is named this, QuiltFlower doesn't rename it, leading to syntax errors.

Original source (my language):

def extension var echo(String) {
    println(this);
}
def extension var concat2(String, String a, String b) {
    return this.concat(a).concat(b);
}
def var hello = "Hello, ";
hello.concat2("World", "!").echo();

CFR decompilation:

@ExtensionMethod
private static void echo(@NonNull String this_) {
    ModuleBuiltin.println((String)this_);
}

@ExtensionMethod
@NonNull
private static String concat2(@NonNull String this_, @NonNull String a, @NonNull String b) {
    return this_.concat(a).concat(b);
}

public static void main(String[] stringArray) {
    String hello = "Hello, ";
    ModuleExample.echo(ModuleExample.concat2(hello, "World", "!"));
}

QuiltFlower decompilation:

@ExtensionMethod
private static void echo(@NonNull final String this) {
   ModuleBuiltin.println(this);
}

@ExtensionMethod
@NonNull
private static String concat2(@NonNull final String this, @NonNull String a, @NonNull String b) {
   return this.concat(a).concat(b);
}

public static void main(String[] args) {
   String hello = "Hello, ";
   echo(concat2(hello, "World", "!"));
}

Here's the original class file: ModuleExample.zip

Gaming32 avatar May 07 '22 01:05 Gaming32