From 0576ba32b0798d7674d739fffefec4f88e57d1a6 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 30 Dec 2024 23:26:39 +0200 Subject: [PATCH] more cleanup, use the const directly, remove the empty_comptime_const_expr() function --- vlib/v/ast/ast.v | 7 ++++--- vlib/v/ast/comptime_const_values.v | 7 ------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index fad6c30963e182..483f75578a3bdf 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -205,6 +205,7 @@ pub: pub const empty_expr = Expr(EmptyExpr(0)) pub const empty_stmt = Stmt(EmptyStmt{}) pub const empty_node = Node(EmptyNode{}) +pub const empty_comptime_const_value = ComptTimeConstValue(EmptyExpr(0)) // `{stmts}` or `unsafe {stmts}` pub struct Block { @@ -398,7 +399,7 @@ pub mut: end_comments []Comment // comments that after const field // the comptime_expr_value field is filled by the checker, when it has enough // info to evaluate the constant at compile time - comptime_expr_value ComptTimeConstValue = empty_comptime_const_expr() + comptime_expr_value ComptTimeConstValue = empty_comptime_const_value } // const declaration @@ -1132,9 +1133,9 @@ pub mut: or_block OrExpr ct_left_value_evaled bool - ct_left_value ComptTimeConstValue = empty_comptime_const_expr() + ct_left_value ComptTimeConstValue = empty_comptime_const_value ct_right_value_evaled bool - ct_right_value ComptTimeConstValue = empty_comptime_const_expr() + ct_right_value ComptTimeConstValue = empty_comptime_const_value before_op_comments []Comment after_op_comments []Comment diff --git a/vlib/v/ast/comptime_const_values.v b/vlib/v/ast/comptime_const_values.v index 0966cb6d612d7f..798075b5681beb 100644 --- a/vlib/v/ast/comptime_const_values.v +++ b/vlib/v/ast/comptime_const_values.v @@ -17,13 +17,6 @@ pub type ComptTimeConstValue = EmptyExpr //| int -const ectcv = ComptTimeConstValue(EmptyExpr(0)) - -// empty_comptime_const_expr return an EmptyExpr. -pub fn empty_comptime_const_expr() ComptTimeConstValue { - return ectcv -} - // i8 tries to return a `ComptTimeConstValue` as `i8` type. pub fn (val ComptTimeConstValue) i8() ?i8 { x := val.i64()?