cgen: minor cleanup of comp_for in comptime.v (#8337)

pull/8345/head
yuyi 2021-01-26 00:08:48 +08:00 committed by GitHub
parent 006a11454f
commit 3199b982a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -298,8 +298,7 @@ fn (mut g Gen) comp_for(node ast.CompFor) {
methods_with_attrs := sym.methods.filter(it.attrs.len > 0) // methods with attrs second
methods << methods_with_attrs
if methods.len > 0 {
g.writeln('\tFunctionData $node.val_var;')
g.writeln('\tmemset(&$node.val_var, 0, sizeof(FunctionData));')
g.writeln('\tFunctionData $node.val_var = {0};')
}
for method in methods { // sym.methods {
/*
@ -372,8 +371,7 @@ fn (mut g Gen) comp_for(node ast.CompFor) {
fields_with_attrs := sym.info.fields.filter(it.attrs.len > 0)
fields << fields_with_attrs
if fields.len > 0 {
g.writeln('\tFieldData $node.val_var;')
g.writeln('\tmemset(&$node.val_var, 0, sizeof(FieldData));')
g.writeln('\tFieldData $node.val_var = {0};')
}
for field in fields {
g.comp_for_field_var = node.val_var