Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] The operation cache does not propagate correctly on if else braches #171

Open
JeanJPNM opened this issue Apr 30, 2023 · 0 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@JeanJPNM
Copy link
Collaborator

In the following example we can see that the assignment to a in the if branch prevents the else branch from reusing the cached operation a + 1.

let a = Math.rand(10)

print(a + 1)

if (a > 5) {
  a = 2
} else {
  print(a + 1)
}

printFlush()

Output:

op rand &t0 10
op floor a:1:4 &t0
op add &t1 a:1:4 1
print &t1
jump 7 lessThanEq a:1:4 5
set a:1:4 5
jump 9 always
op add &t2 a:1:4 1
print &t2
printflush message1

Version: latest (cd75edd)

@JeanJPNM JeanJPNM added the bug Something isn't working label May 2, 2023
@JeanJPNM JeanJPNM added this to the v0.7 milestone Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant