Skip to content

Conversation

@Frotty
Copy link
Member

@Frotty Frotty commented Dec 8, 2025

No description provided.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +556 to 558
if (isEffectivelyPure(r.expr)
|| isUnchangedVarAccess(r.expr, results, i + 1)
|| i >= withStmts) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Var reads can be reordered past impure statements

The new isUnchangedVarAccess guard in flattenExprs now reuses an ImVarAccess when no direct ImSet to the same var is found, causing the first argument to be evaluated after later statements. However, ImVarAccess is classified as ReadsGlobals rather than Pure (PurityLevels.java:32‑34), so its value can change across any side effect. The write check only looks for ImSet targets (writesVar at lines 515‑524) and ignores other impure statements such as function-call statements (ImStmt includes ImExpr, parserspec/jass_im.parseq lines 74‑83), so a later statement expression that calls a mutating function will bypass the temp creation and the read will occur after the mutation (e.g., foo(g, (mutate(); ...)) now reads the updated g). This reorders observable effects compared to the original left-to-right evaluation.

Useful? React with 👍 / 👎.

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

Successfully merging this pull request may close these issues.

2 participants