jmc icon indicating copy to clipboard operation
jmc copied to clipboard

[BUG] If statements break return statements and function macros

Open OguzhanUmutlu opened this issue 8 months ago • 1 comments

Describe the bug

If statements break into new functions inside private folder which breaks both /return and function macros

To Reproduce

Example code that breaks /return:

$a = 1;
function test() {
 if ($a == 1) {
    say "hi";
    return 1;
 }
 return 0;
}

$b = test();

tellraw @a $b.toString();

Example code that breaks function macros:

$x = 1;

function test() {
 if ($x == 1) {
  say "hi";
  $tellraw @a $(a);
 }
}

test({a: 10});

Expected behavior

First one should print out "hi" and "1", but instead it prints out "hi" and "0"

Second one should print out "hi" and "10", but instead it prints out nothing

Desktop

  • OS: Windows 11
  • JMC Version: Latest(1.2.17)

OguzhanUmutlu avatar Jul 02 '24 08:07 OguzhanUmutlu