# astgen.zig: delay adding closure_capture instructions to preserve GenZir nesting\. Only containers create Namespaces, so the declaring_gz is always the GenZir passed to containerDecl, and containerDecl will always add exactly one instruction \(an extended \*\_decl\) to that GenZir\. Thus, closure_capture instructions are always lined up immediately after a container decl instruction, so rather than adding them at the point of first mention, where we're nested arbitrarily deep, simply walk through the Namespace captures hash map at the end of each containerDecl branch and add them then\. · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/65c27e8e6612b8d649ae1481c27c8e7f0e78ad32)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 65c27e8e6612b8d649ae1481c27c8e7f0e78ad32

Requested commit: 65c27e8e6612b8d649ae1481c27c8e7f0e78ad32

Commit: 65c27e8e6612b8d649ae1481c27c8e7f0e78ad32

Tree: f084ec93c06b48fa7380920c10751bf3e5644d4c

Author: Matthew Borkowski

Committer: Matthew Borkowski

## Message

```
astgen.zig: delay adding closure_capture instructions to preserve GenZir nesting. Only containers create Namespaces, so the declaring_gz is always the GenZir passed to containerDecl, and containerDecl will always add exactly one instruction (an extended *_decl) to that GenZir. Thus, closure_capture instructions are always lined up immediately after a container decl instruction, so rather than adding them at the point of first mention, where we're nested arbitrarily deep, simply walk through the Namespace captures hash map at the end of each containerDecl branch and add them then.

```

## Parents

- [92d2aa1b48c2171d58eec51552ca30d1cc0fe206](https://git.cafe/gitcafe/zig/commit/92d2aa1b48c2171d58eec51552ca30d1cc0fe206?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/65c27e8e6612b8d649ae1481c27c8e7f0e78ad32?format=markdown)
