Skip to content

Salvage our logic #51

Description

@neimanpinchas

Hi

Sorry for not following your recommendation about avoiding Reflaxe — the selling points were too compelling, so I decided I'd just have to live with (and fix) its issues.

I've been struggling with expressions being incorrectly discriminated and swept out of the generated C++. After a while a pattern emerged, and with some AI assistance I believe I've tracked down the root cause.

I'm posting the diff below. Since I can't quickly figure out how to re-fork after I inadvertently tangled things on my GitHub account with one Reflaxe implementation, I'm hoping this is still useful to the community as an early share.

I think that looking at your excellent code function doc blocks, the thesis is right.

Author: pinchasn-on-pc <pinchasn@ctop.group>  2026-06-08 11:03:47
Committer: pinchasn-on-pc <pinchasn@ctop.group>  2026-06-08 11:03:47
Parent: 73a983112e039daad46b37912ab238df6bf0cf53 (Make `RemovePureExpressionsImpl`'s style more consistent with the rest of Reflaxe)
Branch: main
Follows: v3.0.0
Precedes: 

    inverse logic that removed inPure ifs only
    inverse logic that remove everything from and after continue statements without mercy

---- src/reflaxe/preprocessors/implementations/RemovePureExpressionsImpl.hx ----
index ee39c97..f8276e1 100644
@@ -216,5 +216,5 @@ private class OptimizerTexpr {
 					}
 				});
-				return isPure;
+				return !isPure;
 			}
 			case _: {
@@ -311,5 +311,5 @@ private class OptimizerTexpr {
 			}
 			case TContinue: {
-				return blockElement([], tail);
+				return [head].concat(acc);
 			}
 			case _: {

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions