Skip to content

Commit 5faabe7

Browse files
committed
Revert "cgen: fix error for struct with reference alias fields (#13374)"
This reverts commit 4d485ae.
1 parent 4d485ae commit 5faabe7

File tree

4 files changed

+1
-21
lines changed

4 files changed

+1
-21
lines changed

vlib/v/gen/c/auto_str_methods.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,7 @@ fn (mut g Gen) gen_str_for_struct(info ast.Struct, styp string, str_fn_name stri
916916
funcprefix += 'isnil(it.${c_name(field.name)})'
917917
funcprefix += ' ? _SLIT("nil") : '
918918
// struct, floats and ints have a special case through the _str function
919-
if sym.kind !in [.struct_, .alias] && !field.typ.is_int_valptr()
920-
&& !field.typ.is_float_valptr() {
919+
if sym.kind != .struct_ && !field.typ.is_int_valptr() && !field.typ.is_float_valptr() {
921920
funcprefix += '*'
922921
}
923922
}

vlib/v/gen/c/cgen.v

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5519,9 +5519,6 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
55195519
|| sfield.typ.is_pointer()) && !sfield.typ.is_number() {
55205520
g.write('/* autoref */&')
55215521
}
5522-
if sfield.typ.is_ptr() && field_type_sym.kind == .alias {
5523-
g.write('&')
5524-
}
55255522
g.expr_with_cast(sfield.expr, sfield.typ, sfield.expected_type)
55265523
}
55275524
}

vlib/v/gen/c/str.v

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ fn (mut g Gen) gen_expr_to_string(expr ast.Expr, etype ast.Type) {
8585
g.expr(expr)
8686
g.write(')')
8787
} else if typ == ast.string_type {
88-
if etype.is_ptr() {
89-
g.write('*')
90-
}
9188
g.expr(expr)
9289
} else if typ == ast.bool_type {
9390
g.expr(expr)

vlib/v/tests/struct_with_reference_alias_fields.v

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)