From 89165ed259da967c65a62e12e7845b5b9d35a102 Mon Sep 17 00:00:00 2001 From: yuyi Date: Wed, 12 Jan 2022 17:40:11 +0800 Subject: [PATCH] cgen: minor cleanup in comptime_if_cond() (#13142) --- vlib/v/gen/c/comptime.v | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index 5ccad7f12a..61cdd8f913 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -300,10 +300,8 @@ fn (mut g Gen) comptime_if(node ast.IfExpr) { g.writeln('#endif') } -/* -// returning `false` means the statements inside the $if can be skipped -*/ // returns the value of the bool comptime expression +// returning `false` means the statements inside the $if can be skipped fn (mut g Gen) comptime_if_cond(cond ast.Expr, pkg_exist bool) bool { match cond { ast.BoolLiteral { @@ -374,10 +372,10 @@ fn (mut g Gen) comptime_if_cond(cond ast.Expr, pkg_exist bool) bool { //} } } else if left is ast.SelectorExpr { - name = '${left.expr}.$left.field_name' if left.gkind_field == .typ { exp_type = g.unwrap_generic(left.name_type) } else { + name = '${left.expr}.$left.field_name' exp_type = g.comptime_var_type_map[name] } } else if left is ast.TypeNode {