From ad385d2f4ffebd8898c78db1a83cedd2607d25c1 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 11 Nov 2019 03:53:51 -0800 Subject: [PATCH] rename function --- schala-lang/language/src/ast/visitor.rs | 8 ++++---- schala-lang/language/src/ast/visitor_test.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/schala-lang/language/src/ast/visitor.rs b/schala-lang/language/src/ast/visitor.rs index 0d10ccc..6e74596 100644 --- a/schala-lang/language/src/ast/visitor.rs +++ b/schala-lang/language/src/ast/visitor.rs @@ -56,20 +56,20 @@ pub trait ExpressionVisitor { fn done(&mut self, kind: Self::Output, anno: Option) -> Self::Output; } -pub fn dispatch_expression_visitor(input: &Expression, visitor: &mut dyn ExpressionVisitor) -> Result { +pub fn dispatch_expression(input: &Expression, visitor: &mut dyn ExpressionVisitor) -> Result { let output = match input.kind { ExpressionKind::NatLiteral(ref n) => visitor.nat_literal(n), ExpressionKind::StringLiteral(ref s) => visitor.string_literal(s), ExpressionKind::BinExp(ref op, ref lhs, ref rhs) => { - let lhs = dispatch_expression_visitor(lhs, visitor)?; - let rhs = dispatch_expression_visitor(rhs, visitor)?; + let lhs = dispatch_expression(lhs, visitor)?; + let rhs = dispatch_expression(rhs, visitor)?; visitor.binexp(op, lhs, rhs) }, ExpressionKind::TupleLiteral(ref exprs) => { let mut output = vec![]; for ex in exprs { - output.push(dispatch_expression_visitor(&ex, visitor)?); + output.push(dispatch_expression(&ex, visitor)?); } visitor.tuple_literal(output) }, diff --git a/schala-lang/language/src/ast/visitor_test.rs b/schala-lang/language/src/ast/visitor_test.rs index 5a8db20..644b8cf 100644 --- a/schala-lang/language/src/ast/visitor_test.rs +++ b/schala-lang/language/src/ast/visitor_test.rs @@ -1,7 +1,7 @@ #![cfg(test)] use crate::ast::*; -use crate::ast::visitor::{ASTVisitor, ExpressionVisitor, dispatch_expression_visitor}; +use crate::ast::visitor::*; use crate::ast::walker; use crate::util::quick_ast; @@ -95,6 +95,6 @@ fn new_visitor() { let expr: Expression = make_expr("7+\"nueces\"*(33,32)"); let mut printer = ExprPrinter { }; - let s = dispatch_expression_visitor(&expr, &mut printer).unwrap(); + let s = dispatch_expression(&expr, &mut printer).unwrap(); assert_eq!(s, r#"7 + "nueces" * (33, 32, )"#); }