# AstGen: allow closure over known-runtime values within @TypeOf · gitcafe/zig

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

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

Visibility: public

Requested revision: 28caaea0938e938de96cc66a49f670005a2df9d4

Requested commit: 28caaea0938e938de96cc66a49f670005a2df9d4

Commit: 28caaea0938e938de96cc66a49f670005a2df9d4

Tree: 7e2975d48dd85296bc79d6918d6520c689ebc268

Author: mlugg

Committer: mlugg

## Message

```
AstGen: allow closure over known-runtime values within @TypeOf

AstGen emits an error when a closure over a known-runtime value crosses
a namespace boundary. This usually makes sense: however, this usage is
actually valid if the capture is within a `@TypeOf` operand. Sema
already has a special case to allow such closure within `@TypeOf` when
AstGen could not determine a value to be runtime-known. This commit
simply introduces analagous logic to AstGen to allow `var`s to cross
namespace boundaries within `@TypeOf`.

```

## Parents

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

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