Skip to content

Commit

Permalink
cgen: minor cleanup in comptime_if_cond() (#13142)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Jan 12, 2022
1 parent f99b794 commit 89165ed
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions vlib/v/gen/c/comptime.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 89165ed

Please sign in to comment.