mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 18:51:13 +08:00
feat: 实现 SequenceExpression + 带标签 break/continue + EmptyStatement
This commit is contained in:
@@ -34,6 +34,12 @@ pub(super) fn hash_expression(expr: &Expression, h: &mut rustc_hash::FxHasher, i
|
||||
pin.left.name.as_str().hash(h);
|
||||
hash_expression(&pin.right, h, include_binding_names);
|
||||
}
|
||||
Expression::SequenceExpression(seq) => {
|
||||
(seq.expressions.len() as u32).hash(h);
|
||||
for e in &seq.expressions {
|
||||
hash_expression(e, h, include_binding_names);
|
||||
}
|
||||
}
|
||||
Expression::Identifier(ident) => {
|
||||
if include_binding_names {
|
||||
ident.name.as_str().hash(h);
|
||||
|
||||
@@ -32,8 +32,20 @@ pub(super) fn hash_statement(stmt: &Statement, h: &mut rustc_hash::FxHasher, inc
|
||||
hash_statement(s, h, include_binding_names);
|
||||
}
|
||||
}
|
||||
Statement::BreakStatement(_) => {}
|
||||
Statement::ContinueStatement(_) => {}
|
||||
Statement::BreakStatement(b) => {
|
||||
if let Some(label) = &b.label {
|
||||
label.name.as_str().hash(h);
|
||||
}
|
||||
}
|
||||
Statement::ContinueStatement(c) => {
|
||||
if let Some(label) = &c.label {
|
||||
label.name.as_str().hash(h);
|
||||
}
|
||||
}
|
||||
Statement::LabeledStatement(ls) => {
|
||||
ls.label.name.as_str().hash(h);
|
||||
hash_statement(&ls.body, h, include_binding_names);
|
||||
}
|
||||
Statement::DoWhileStatement(dw) => {
|
||||
hash_statement(&dw.body, h, include_binding_names);
|
||||
expression::hash_expression(&dw.test, h, include_binding_names);
|
||||
|
||||
Reference in New Issue
Block a user