Use walk_if_expr_body

This commit is contained in:
Greg Shuflin 2021-11-02 20:23:08 -07:00
parent 8b5e965f16
commit 383eb7bb62
2 changed files with 1 additions and 38 deletions

View File

@ -222,7 +222,6 @@ impl SymbolTable {
self.symbol_trie.insert(&fqsn, def_id);
self.def_to_symbol.insert(def_id, symbol);
}
}
struct SymbolTableRunner<'a> {

View File

@ -200,43 +200,7 @@ impl<'a> ASTVisitor for ScopeResolver<'a> {
lexical_scopes: self.lexical_scopes.new_scope(Some(ScopeType::PatternMatch)),
symbol_table: self.symbol_table,
};
let new_resolver = &mut resolver;
match body.as_ref() {
IfExpressionBody::SimpleConditional { then_case, else_case } => {
walk_block(new_resolver, then_case);
if let Some(block) = else_case.as_ref() {
walk_block(new_resolver, block)
}
}
IfExpressionBody::SimplePatternMatch { pattern, then_case, else_case } => {
walk_pattern(new_resolver, pattern);
walk_block(new_resolver, then_case);
if let Some(block) = else_case.as_ref() {
walk_block(new_resolver, block)
}
}
IfExpressionBody::CondList(arms) =>
for arm in arms {
match arm.condition {
Condition::Pattern(ref pat) => {
walk_pattern(new_resolver, pat);
}
Condition::TruncatedOp(ref _binop, ref expr) => {
walk_expression(new_resolver, expr);
}
Condition::Expression(ref expr) => {
walk_expression(new_resolver, expr);
}
Condition::Else => (),
}
if let Some(ref guard) = arm.guard {
walk_expression(new_resolver, guard);
}
walk_block(new_resolver, &arm.body);
},
};
walk_if_expr_body(&mut resolver, body);
return Recursion::Stop;
}
_ => (),