espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.73k stars 741 forks source link

JIT: Creating objects which reference a parameter value does not work #2480

Closed halemmerich closed 2 months ago

halemmerich commented 3 months ago

BangleJS2 2v21.69

I'm trying to let a jit'ed method create and return an object which in some cases directly contains values given to the method as parameters. Some properties are then missing.

Minimal example:

print((v) => {
  "jit";
  return { t: v };
}(123));

print((v) => {
  "jit";
  return { t: v+0 };
}(123));

print((v) => {
  "jit";
  return v;
}(123));

print((v) => {
  return { t: v };
}(123));

results in:

{  }
{ "t": 123 }
123
{ "t": 123 }

The first seems wrong to me, the other three work as expected.