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

Discuss if simplification. #29

Open
jordwalke opened this issue Dec 21, 2019 · 1 comment
Open

Discuss if simplification. #29

jordwalke opened this issue Dec 21, 2019 · 1 comment

Comments

@jordwalke
Copy link
Owner

jordwalke commented Dec 21, 2019

@robz

As I understand it, the flag --disable simplify_ifdecl was added to remove this following simplification:

-var y =
-  0 === x__0
-    ? ((caml_check_bound(a, 0)[1] = 42), 0)
-    : ((caml_check_bound(a, 0)[1] = 43), 0);
+
+if (0 === x__0) {
+  caml_check_bound(a, 0)[1] = 42;
+  var y = 0;
+} else {
+  caml_check_bound(a, 0)[1] = 43;
+  var y = 0;
+}

For posterity, what was the reason for this again?

(See commits a110716857 and a110716857^)

@jordwalke jordwalke changed the title Restore simpl_decl with php operator ? : Discuss if simplification. Dec 21, 2019
@robz
Copy link
Collaborator

robz commented Dec 22, 2019

Disabling declarations like "x = 3" within ternaries is required for Hack, since they removed "assignments-as-expressions" from the language. I believe I added the flag to retain jsoo's prior behavior with JS and potentially PHP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants