From 21348be840361927a98faa45ae48ba51feedf1e2 Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Thu, 17 Sep 2026 14:53:41 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=94=B6=E6=95=9B=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E5=93=88=E5=B8=8C=E7=BB=91=E5=AE=9A=E5=90=8D=E5=8F=A3=E5=BE=84?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_compiler/src/hash/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/oxide_compiler/src/hash/mod.rs b/crates/oxide_compiler/src/hash/mod.rs index 658babfa..fa1fcf02 100644 --- a/crates/oxide_compiler/src/hash/mod.rs +++ b/crates/oxide_compiler/src/hash/mod.rs @@ -2,9 +2,10 @@ //! `Program` 的稳定哈希,用作编译缓存键(code cache)。 //! //! `structural_hash` 为粗粒度键,忽略变量声明名、标识符读、import 本地名与 -//! 函数参数等大部分绑定名;`compiled_module_hash` 为精确键,额外纳入全部绑定名。 +//! 函数参数等大部分绑定名;`compiled_module_hash` 为精确键,额外纳入标识符形态的绑定名 +//! (变量声明、参数与 catch 的解构形态均不贡献哈希)。 //! 函数声明名、类名与 catch 参数标识名是编译产物物化名,两种粒度下恒计入哈希; -//! catch 参数为解构形态时不贡献哈希。 +//! 变量声明、函数/箭头/方法参数与 catch 参数为解构形态时均不贡献哈希。 use oxide_parser::{ ArrayExpressionElement, BindingPattern, ChainElement, Class, ClassElement, Declaration, @@ -50,7 +51,7 @@ pub fn structural_hash(program: &oxide_parser::Program) -> u64 { hash_program(program, false) } -/// 精确编译模块哈希:在粗粒度键基础上额外纳入全部绑定名, +/// 精确编译模块哈希:在粗粒度键基础上额外纳入标识符形态的绑定名, /// 避免绑定名不同但结构相同的程序错误复用缓存。 pub fn compiled_module_hash(program: &oxide_parser::Program) -> u64 { hash_program(program, true)