feat(opt): sabit katlama'ya mantıksal operatörler ekle (&&, ||)
canFoldOp ve computeOp'a AMPERSAND_AMPERSAND ve PIPE_PIPE eklendi. false && false, true || false gibi sabit mantıksal ifadeler artık derleme zamanında 0/1 literaline katlanır. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
044655d675
commit
3d5912f991
|
|
@ -65,6 +65,8 @@ private:
|
|||
case TokenType::GREATER:
|
||||
case TokenType::LESS_EQUAL:
|
||||
case TokenType::GREATER_EQUAL:
|
||||
case TokenType::AMPERSAND_AMPERSAND:
|
||||
case TokenType::PIPE_PIPE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -84,6 +86,8 @@ private:
|
|||
case TokenType::GREATER: return l > r ? 1 : 0;
|
||||
case TokenType::LESS_EQUAL: return l <= r ? 1 : 0;
|
||||
case TokenType::GREATER_EQUAL: return l >= r ? 1 : 0;
|
||||
case TokenType::AMPERSAND_AMPERSAND: return (l && r) ? 1 : 0;
|
||||
case TokenType::PIPE_PIPE: return (l || r) ? 1 : 0;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue