From 5454562d2cf13d583f61c9232cc18abbe5848c42 Mon Sep 17 00:00:00 2001 From: walking devel <104449470+walkingdevel@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:35:12 +0000 Subject: [PATCH] checker, parser, orm: remove redundant `&` for sum type value arguments to functions with `expr &ast.Expr` parameters (#17482) --- vlib/v/checker/orm.v | 16 ++++++++-------- vlib/v/parser/sql.v | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/vlib/v/checker/orm.v b/vlib/v/checker/orm.v index fa72b9c4d7..2f22c07915 100644 --- a/vlib/v/checker/orm.v +++ b/vlib/v/checker/orm.v @@ -369,7 +369,7 @@ fn (mut c Checker) check_sql_expr_type_is_int(expr &ast.Expr, sql_keyword string return } else if expr is ast.ParExpr { - c.check_sql_expr_type_is_int(&expr.expr, sql_keyword) + c.check_sql_expr_type_is_int(expr.expr, sql_keyword) return } @@ -407,10 +407,10 @@ fn (mut c Checker) check_expr_has_no_fn_calls_with_non_orm_return_type(expr &ast expr.pos) } } else if expr is ast.ParExpr { - c.check_expr_has_no_fn_calls_with_non_orm_return_type(&expr.expr) + c.check_expr_has_no_fn_calls_with_non_orm_return_type(expr.expr) } else if expr is ast.InfixExpr { - c.check_expr_has_no_fn_calls_with_non_orm_return_type(&expr.left) - c.check_expr_has_no_fn_calls_with_non_orm_return_type(&expr.right) + c.check_expr_has_no_fn_calls_with_non_orm_return_type(expr.left) + c.check_expr_has_no_fn_calls_with_non_orm_return_type(expr.right) } } @@ -437,19 +437,19 @@ fn (mut c Checker) check_where_expr_has_no_pointless_exprs(table_type_symbol &as } else if expr.left is ast.InfixExpr || expr.left is ast.ParExpr || expr.left is ast.PrefixExpr { c.check_where_expr_has_no_pointless_exprs(table_type_symbol, field_names, - &expr.left) + expr.left) } else { c.orm_error(has_no_field_error, expr.left.pos()) } if expr.right is ast.InfixExpr || expr.right is ast.ParExpr || expr.right is ast.PrefixExpr { c.check_where_expr_has_no_pointless_exprs(table_type_symbol, field_names, - &expr.right) + expr.right) } } else if expr is ast.ParExpr { - c.check_where_expr_has_no_pointless_exprs(table_type_symbol, field_names, &expr.expr) + c.check_where_expr_has_no_pointless_exprs(table_type_symbol, field_names, expr.expr) } else if expr is ast.PrefixExpr { - c.check_where_expr_has_no_pointless_exprs(table_type_symbol, field_names, &expr.right) + c.check_where_expr_has_no_pointless_exprs(table_type_symbol, field_names, expr.right) } else { c.orm_error('`where` expression must have at least one comparison for filtering rows', expr.pos()) diff --git a/vlib/v/parser/sql.v b/vlib/v/parser/sql.v index 508d6090d1..21afb16404 100644 --- a/vlib/v/parser/sql.v +++ b/vlib/v/parser/sql.v @@ -318,7 +318,7 @@ fn (p &Parser) has_sql_where_expr_with_comparison_with_id(expr &ast.Expr) bool { return expr.left.name == 'id' } } else if expr is ast.ParExpr { - return p.has_sql_where_expr_with_comparison_with_id(&expr.expr) + return p.has_sql_where_expr_with_comparison_with_id(expr.expr) } return false @@ -334,12 +334,12 @@ fn (mut p Parser) check_sql_where_expr_has_no_undefined_variables(expr &ast.Expr } } else if expr is ast.InfixExpr { if expr.left is ast.Ident && expr.right is ast.Ident { - return p.check_sql_where_expr_has_no_undefined_variables(&expr.right, [ + return p.check_sql_where_expr_has_no_undefined_variables(expr.right, [ expr.left.str(), ]) } - left_check_result := p.check_sql_where_expr_has_no_undefined_variables(&expr.left, + left_check_result := p.check_sql_where_expr_has_no_undefined_variables(expr.left, []) if left_check_result is ast.NodeError { @@ -347,14 +347,14 @@ fn (mut p Parser) check_sql_where_expr_has_no_undefined_variables(expr &ast.Expr } variable_names := if expr.left is ast.Ident { [expr.left.str()] } else { []string{} } - right_check_result := p.check_sql_where_expr_has_no_undefined_variables(&expr.right, + right_check_result := p.check_sql_where_expr_has_no_undefined_variables(expr.right, variable_names) if right_check_result is ast.NodeError { return right_check_result } } else if expr is ast.ParExpr { - return p.check_sql_where_expr_has_no_undefined_variables(&expr.expr, []) + return p.check_sql_where_expr_has_no_undefined_variables(expr.expr, []) } return ast.empty_expr