Spread out implementations of symbol and attrs-related things, add impl
blocks for TranslateAst Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -236,7 +236,7 @@ impl Visit<FunExpr> for CollectSyms<'_, '_> {
|
||||
|
||||
fn visit(&mut self, expr: &FunExpr) -> Self::Out {
|
||||
expr.params.iter().for_each(|name| {
|
||||
self.ctx.add_sym(name.clone());
|
||||
self.ctx.syms_mut().add(name.clone());
|
||||
});
|
||||
self.visit(&expr.expr);
|
||||
}
|
||||
@@ -249,11 +249,11 @@ impl Visit<BaseExpr> for CollectSyms<'_, '_> {
|
||||
match &expr.kind {
|
||||
BaseExprKind::Ident => {
|
||||
let name = expr.text_at(self.text).to_string();
|
||||
self.ctx.add_sym(name);
|
||||
self.ctx.syms_mut().add(name);
|
||||
}
|
||||
BaseExprKind::Sym => {
|
||||
let name = expr.text_at(self.text).chars().skip(1).collect::<String>();
|
||||
self.ctx.add_sym(name);
|
||||
self.ctx.syms_mut().add(name);
|
||||
}
|
||||
BaseExprKind::List(l) | BaseExprKind::Tuple(l) => {
|
||||
l.iter().for_each(|expr| self.visit(expr))
|
||||
|
||||
Reference in New Issue
Block a user