mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
docs: 添加 Rustdoc 注释
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//! 类相关 AST 节点的结构哈希(ClassElement/ClassExpression 等)。
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(super) fn hash_class_element(element: &ClassElement, h: &mut rustc_hash::FxHasher, include_binding_names: bool) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! 表达式 AST 节点的结构哈希。
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(super) fn hash_expression(expr: &Expression, h: &mut rustc_hash::FxHasher, include_binding_names: bool) {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
//! AST 结构哈希:按语法域(statement/expression/class/...)递归计算
|
||||
//! `Program` 的稳定哈希,用作编译缓存键(code cache)。
|
||||
//!
|
||||
//! `structural_hash` 忽略绑定名(结构相等即可命中),
|
||||
//! `compiled_module_hash` 纳入绑定名(精确匹配避免错误复用)。
|
||||
|
||||
use oxide_parser::{
|
||||
BindingPattern, ChainElement, ClassElement, Expression, ForStatementInit, ObjectPropertyKind, PropertyKey,
|
||||
SimpleAssignmentTarget, Statement,
|
||||
@@ -30,10 +36,12 @@ mod property;
|
||||
mod statement;
|
||||
mod target;
|
||||
|
||||
/// 结构哈希:忽略绑定名的 `Program` 哈希(用于粗粒度缓存命中判断)。
|
||||
pub fn structural_hash(program: &oxide_parser::Program) -> u64 {
|
||||
hash_program(program, false)
|
||||
}
|
||||
|
||||
/// 编译模块哈希:纳入绑定名的 `Program` 哈希(用于精确缓存命中判断)。
|
||||
pub fn compiled_module_hash(program: &oxide_parser::Program) -> u64 {
|
||||
hash_program(program, true)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! 对象属性键/属性类型(PropertyKey/ObjectPropertyKind)的结构哈希。
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(super) fn hash_property_key(key: &PropertyKey, h: &mut rustc_hash::FxHasher, include_binding_names: bool) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! 语句 AST 节点的结构哈希。
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(super) fn hash_statement(stmt: &Statement, h: &mut rustc_hash::FxHasher, include_binding_names: bool) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! 赋值目标(SimpleAssignmentTarget)的结构哈希。
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(super) fn hash_simple_assignment_target(
|
||||
|
||||
Reference in New Issue
Block a user