Use walk_if_expr_body
This commit is contained in:
parent
8b5e965f16
commit
383eb7bb62
@ -222,7 +222,6 @@ impl SymbolTable {
|
|||||||
self.symbol_trie.insert(&fqsn, def_id);
|
self.symbol_trie.insert(&fqsn, def_id);
|
||||||
self.def_to_symbol.insert(def_id, symbol);
|
self.def_to_symbol.insert(def_id, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SymbolTableRunner<'a> {
|
struct SymbolTableRunner<'a> {
|
||||||
|
@ -200,43 +200,7 @@ impl<'a> ASTVisitor for ScopeResolver<'a> {
|
|||||||
lexical_scopes: self.lexical_scopes.new_scope(Some(ScopeType::PatternMatch)),
|
lexical_scopes: self.lexical_scopes.new_scope(Some(ScopeType::PatternMatch)),
|
||||||
symbol_table: self.symbol_table,
|
symbol_table: self.symbol_table,
|
||||||
};
|
};
|
||||||
let new_resolver = &mut resolver;
|
walk_if_expr_body(&mut resolver, body);
|
||||||
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return Recursion::Stop;
|
return Recursion::Stop;
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
Loading…
Reference in New Issue
Block a user