From 07995bb4189aad349519b1726026b003a2d7455f Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Sat, 6 Jun 2026 13:16:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=AD=97=E8=8A=82=E7=A0=81=E5=93=88=E5=B8=8C=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=91=BD=E4=B8=AD=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_compiler/src/hash.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/oxide_compiler/src/hash.rs b/crates/oxide_compiler/src/hash.rs index ba856203..92f158c0 100644 --- a/crates/oxide_compiler/src/hash.rs +++ b/crates/oxide_compiler/src/hash.rs @@ -45,6 +45,19 @@ fn hash_statement(stmt: &Statement, h: &mut rustc_hash::FxHasher) { } Statement::ForStatement(fr) => { 5u8.hash(h); + if let Some(init) = &fr.init { + if let Some(expr) = init.as_expression() { + hash_expression(expr, h); + } else if init.is_var_declaration() { + 0u8.hash(h); + } + } + if let Some(test) = &fr.test { + hash_expression(test, h); + } + if let Some(update) = &fr.update { + hash_expression(update, h); + } hash_statement(&fr.body, h); } Statement::BlockStatement(block) => { @@ -89,6 +102,12 @@ fn hash_expression(expr: &Expression, h: &mut rustc_hash::FxHasher) { hash_expression(&log.left, h); hash_expression(&log.right, h); } + Expression::ConditionalExpression(cond) => { + 4u8.hash(h); + hash_expression(&cond.test, h); + hash_expression(&cond.consequent, h); + hash_expression(&cond.alternate, h); + } _ => { std::mem::discriminant(expr).hash(h); }