Skip to content

fix: 条件比较右侧使用裸变量时判断错误 - #1066

Open
MakinoharaShoko wants to merge 1 commit into
devfrom
fix-when-bare-var-compare
Open

MakinoharaShoko wants to merge 1 commit into
devfrom
fix-when-bare-var-compare

Conversation

@MakinoharaShoko

Copy link
Copy Markdown
Member

No description provided.

多字符运算符需要排在单字符字符类之前,否则 >=、<=、!= 会被拆开,
右侧变量名被拼接为 =xxx 而无法解析。
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T15:42:51.802772Z be0c4a3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@MakinoharaShoko MakinoharaShoko linked an issue Oct 17, 2026 that may be closed by this pull request
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying webgal-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: be0c4a3
Status: ✅  Deploy successful!
Preview URL: https://c61033d9.webgal-dev.pages.dev
Branch Preview URL: https://fix-when-bare-var-compare.webgal-dev.pages.dev

View logs

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

Copy link
Copy Markdown

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.

Reviewed commit: be0c4a3eb0

ℹ️ 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".

// 先把变量解析出来
const valExpArr = whenValue.split(/([+\-*\/()><!]|>=|<=|==|&&|\|\||!=)/g);
// 多字符运算符必须排在单字符之前,否则 >= 会被拆成 > 和 =xxx,导致右侧变量无法被识别
const valExpArr = whenValue.split(/(>=|<=|==|!=|&&|\|\||[+\-*\/()><!])/g);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve strict inequality tokenization

When a condition uses the valid !== operator with a bare variable on the right, this ordering now splits left!==right into left, !=, and =right. The lookup therefore targets the nonexistent key =right, and the reconstructed expression compares against an unresolved right identifier rather than its stored value; for example, two equal variables can incorrectly make left!==right true. Previously ! followed by == preserved this expression, so !== should be recognized before !=.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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.

条件比较右侧使用裸变量时判断错误

1 participant