mirror of
https://github.com/ziglang/zig.git
synced 2024-12-17 08:40:19 +00:00
Fix recursive self-referential block
This commit is contained in:
parent
4ae95d7ffc
commit
4c8b460fec
@ -420,7 +420,9 @@ fn transCompoundStmtInline(
|
|||||||
while (it != end_it) : (it += 1) {
|
while (it != end_it) : (it += 1) {
|
||||||
const result = try transStmt(rp, parent_scope, it.*, .unused, .r_value);
|
const result = try transStmt(rp, parent_scope, it.*, .unused, .r_value);
|
||||||
scope = result.child_scope;
|
scope = result.child_scope;
|
||||||
try block_node.statements.push(result.node);
|
std.debug.warn("id: {}\n", result.node.id);
|
||||||
|
if (result.node != &block_node.base)
|
||||||
|
try block_node.statements.push(result.node);
|
||||||
}
|
}
|
||||||
return TransResult{
|
return TransResult{
|
||||||
.node = &block_node.base,
|
.node = &block_node.base,
|
||||||
@ -493,7 +495,7 @@ fn transDeclStmt(rp: RestorePoint, parent_scope: *Scope, stmt: *const ZigClangDe
|
|||||||
|
|
||||||
const var_scope = try c.a().create(Scope.Var);
|
const var_scope = try c.a().create(Scope.Var);
|
||||||
var_scope.* = Scope.Var{
|
var_scope.* = Scope.Var{
|
||||||
.base = Scope{ .id = .Var, .parent = parent_scope },
|
.base = Scope{ .id = .Var, .parent = scope },
|
||||||
.c_name = c_name,
|
.c_name = c_name,
|
||||||
.zig_name = c_name, // TODO: getWantedName
|
.zig_name = c_name, // TODO: getWantedName
|
||||||
};
|
};
|
||||||
@ -527,11 +529,11 @@ fn transDeclStmt(rp: RestorePoint, parent_scope: *Scope, stmt: *const ZigClangDe
|
|||||||
.eq_token = eq_token,
|
.eq_token = eq_token,
|
||||||
.mut_token = mut_token,
|
.mut_token = mut_token,
|
||||||
.comptime_token = null,
|
.comptime_token = null,
|
||||||
.extern_export_token = null, // TODO ?TokenIndex,
|
.extern_export_token = null,
|
||||||
.lib_name = null, // TODO ?*Node,
|
.lib_name = null,
|
||||||
.type_node = type_node,
|
.type_node = type_node,
|
||||||
.align_node = null, // TODO ?*Node,
|
.align_node = null, // TODO ?*Node,
|
||||||
.section_node = null, // TODO ?*Node,
|
.section_node = null,
|
||||||
.init_node = init_node,
|
.init_node = init_node,
|
||||||
.semicolon_token = semicolon_token,
|
.semicolon_token = semicolon_token,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user