authorgravatar for codroid@gmail.comhryx <codroid@gmail.com> 2019-06-22 22:30:15-07:00
committergravatar for codroid@gmail.comhryx <codroid@gmail.com> 2019-06-22 22:30:15-07:00
log4c8b460fec7dff1f56605ca1c9bd9b76599952d8
treeaa370f7a0d043eddd9304aba9548f19a554c24aa
parent4ae95d7ffc6ce6b011d5e5c6ff747cd3a1aa59bb
signaturelock-open Commit is signed but in an unrecognized format.

Fix recursive self-referential block


1 files changed, 7 insertions(+), 5 deletions(-)

src-self-hosted/translate_c.zig+7-5
......@@ -420,7 +420,9 @@ fn transCompoundStmtInline(
420420 while (it != end_it) : (it += 1) {
421421 const result = try transStmt(rp, parent_scope, it.*, .unused, .r_value);
422422 scope = result.child_scope;
423 try block_node.statements.push(result.node);
423 std.debug.warn("id: {}\n", result.node.id);
424 if (result.node != &block_node.base)
425 try block_node.statements.push(result.node);
424426 }
425427 return TransResult{
426428 .node = &block_node.base,
......@@ -493,7 +495,7 @@ fn transDeclStmt(rp: RestorePoint, parent_scope: *Scope, stmt: *const ZigClangDe
493495
494496 const var_scope = try c.a().create(Scope.Var);
495497 var_scope.* = Scope.Var{
496 .base = Scope{ .id = .Var, .parent = parent_scope },
498 .base = Scope{ .id = .Var, .parent = scope },
497499 .c_name = c_name,
498500 .zig_name = c_name, // TODO: getWantedName
499501 };
......@@ -527,11 +529,11 @@ fn transDeclStmt(rp: RestorePoint, parent_scope: *Scope, stmt: *const ZigClangDe
527529 .eq_token = eq_token,
528530 .mut_token = mut_token,
529531 .comptime_token = null,
530 .extern_export_token = null, // TODO ?TokenIndex,
531 .lib_name = null, // TODO ?*Node,
532 .extern_export_token = null,
533 .lib_name = null,
532534 .type_node = type_node,
533535 .align_node = null, // TODO ?*Node,
534 .section_node = null, // TODO ?*Node,
536 .section_node = null,
535537 .init_node = init_node,
536538 .semicolon_token = semicolon_token,
537539 };