mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: minor cleanup in dump_expr() (#17006)
This commit is contained in:
parent
75d6cb9c3a
commit
a22dfe0ddf
@ -19,21 +19,18 @@ fn (mut g Gen) dump_expr(node ast.DumpExpr) {
|
|||||||
// generic func with recursion rewrite node.expr_type
|
// generic func with recursion rewrite node.expr_type
|
||||||
if node.expr is ast.Ident {
|
if node.expr is ast.Ident {
|
||||||
// var
|
// var
|
||||||
if (node.expr as ast.Ident).info is ast.IdentVar && (node.expr as ast.Ident).language == .v {
|
if node.expr.info is ast.IdentVar && node.expr.language == .v {
|
||||||
name = g.typ(g.unwrap_generic((node.expr as ast.Ident).info.typ)).replace('*',
|
name = g.typ(g.unwrap_generic(node.expr.info.typ)).replace('*', '')
|
||||||
'')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// var.${field.name}
|
// var.${field.name}
|
||||||
if node.expr is ast.ComptimeSelector {
|
if node.expr is ast.ComptimeSelector {
|
||||||
selector := node.expr as ast.ComptimeSelector
|
if node.expr.field_expr is ast.SelectorExpr {
|
||||||
if selector.field_expr is ast.SelectorExpr {
|
if node.expr.field_expr.expr is ast.Ident {
|
||||||
selector_expr := selector.field_expr as ast.SelectorExpr
|
if node.expr.field_expr.expr.name == g.comptime_for_field_var
|
||||||
if selector_expr.expr is ast.Ident {
|
&& node.expr.field_expr.field_name == 'name' {
|
||||||
ident_expr := selector_expr.expr
|
field, _ := g.get_comptime_selector_var_type(node.expr)
|
||||||
if ident_expr.name == g.comptime_for_field_var && selector_expr.field_name == 'name' {
|
|
||||||
field, _ := g.get_comptime_selector_var_type(selector)
|
|
||||||
name = g.typ(g.unwrap_generic(field.typ.clear_flag(.shared_f).clear_flag(.option).clear_flag(.result)))
|
name = g.typ(g.unwrap_generic(field.typ.clear_flag(.shared_f).clear_flag(.option).clear_flag(.result)))
|
||||||
expr_type = field.typ
|
expr_type = field.typ
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user