Repository navigation
fix: 条件比较右侧使用裸变量时判断错误 - #1066
MakinoharaShoko wants to merge 1 commit into
Conversation
多字符运算符需要排在单字符字符类之前,否则 >=、<=、!= 会被拆开, 右侧变量名被拼接为 =xxx 而无法解析。
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying webgal-dev with
|
| 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 |
There was a problem hiding this comment.
💡 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); |
There was a problem hiding this comment.
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 👍 / 👎.
No description provided.