fix: 函数 async/generator 标志纳入编译缓存键防字节码错配

This commit is contained in:
2026-08-16 17:34:03 +08:00
parent c8b1ccd0a0
commit ae6c60d99d
4 changed files with 53 additions and 0 deletions
+2
View File
@@ -8,6 +8,8 @@ pub(super) fn hash_class_element(element: &ClassElement, h: &mut rustc_hash::FxH
method.r#static.hash(h);
method.computed.hash(h);
std::mem::discriminant(&method.kind).hash(h);
method.value.r#async.hash(h);
method.value.generator.hash(h);
property::hash_property_key(&method.key, h, include_binding_names);
if method.computed {
property::hash_property_key(&method.key, h, include_binding_names);
@@ -82,6 +82,7 @@ pub(super) fn hash_expression(expr: &Expression, h: &mut rustc_hash::FxHasher, i
}
}
Expression::ArrowFunctionExpression(arrow) => {
arrow.r#async.hash(h);
(arrow.params.items.len() as u32).hash(h);
if include_binding_names {
for param in &arrow.params.items {
@@ -91,6 +92,8 @@ pub(super) fn hash_expression(expr: &Expression, h: &mut rustc_hash::FxHasher, i
hash_function_body(&arrow.body, h, include_binding_names);
}
Expression::FunctionExpression(fe) => {
fe.r#async.hash(h);
fe.generator.hash(h);
(fe.params.items.len() as u32).hash(h);
if include_binding_names {
if let Some(id) = &fe.id {
@@ -194,6 +194,8 @@ fn hash_for_statement(fr: &oxide_parser::ForStatement<'_>, h: &mut rustc_hash::F
}
fn hash_function_declaration(fd: &Function<'_>, h: &mut rustc_hash::FxHasher, include_binding_names: bool) {
fd.r#async.hash(h);
fd.generator.hash(h);
if include_binding_names {
if let Some(id) = &fd.id {
id.name.as_str().hash(h);