mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt
This commit is contained in:
parent
7d84ddfa65
commit
20ef2354e7
@ -636,7 +636,8 @@ fn (mut g Gen) assign_stmt(node_ ast.AssignStmt) {
|
||||
if is_decl {
|
||||
g.writeln(';')
|
||||
}
|
||||
} else if !var_type.has_flag(.option_mut_param_t) && !g.is_arraymap_set && !str_add && !op_overloaded {
|
||||
} else if !var_type.has_flag(.option_mut_param_t) && !g.is_arraymap_set && !str_add
|
||||
&& !op_overloaded {
|
||||
g.write(' ${op} ')
|
||||
} else if str_add || op_overloaded {
|
||||
g.write(', ')
|
||||
@ -746,7 +747,7 @@ fn (mut g Gen) assign_stmt(node_ ast.AssignStmt) {
|
||||
g.write(')')
|
||||
}
|
||||
if var_type.has_flag(.option_mut_param_t) {
|
||||
g.write('.data, sizeof(${g.base_type(val_type)}))')
|
||||
g.write('.data, sizeof(${g.base_type(val_type)}))')
|
||||
}
|
||||
if g.is_arraymap_set {
|
||||
g.write(' })')
|
||||
|
@ -186,7 +186,11 @@ fn (mut g Gen) gen_str_for_option(typ ast.Type, styp string, str_fn_name string)
|
||||
g.auto_str_funcs.writeln('string indent_${str_fn_name}(${styp} it, int indent_count) {')
|
||||
g.auto_str_funcs.writeln('\tstring res;')
|
||||
g.auto_str_funcs.writeln('\tif (it.state == 0) {')
|
||||
deref := if typ.is_ptr() && !typ.has_flag(.option_mut_param_t) { '**(${sym.cname}**)&' } else { '*(${sym.cname}*)' }
|
||||
deref := if typ.is_ptr() && !typ.has_flag(.option_mut_param_t) {
|
||||
'**(${sym.cname}**)&'
|
||||
} else {
|
||||
'*(${sym.cname}*)'
|
||||
}
|
||||
if sym.kind == .string {
|
||||
if typ.nr_muls() > 1 {
|
||||
g.auto_str_funcs.writeln('\t\tres = ptr_str(*(${sym.cname}**)&it.data);')
|
||||
|
Loading…
Reference in New Issue
Block a user