Usage of Ast.full.FnProto.iterate?

I try using Ast for parsing a Zig source code to generate a different Zig source (for context: I’m trying to generate a wrapper for Raylib for my toy language Moin).

I started with adapting Ast.Render, but the code for looping through the args of a function is a bit complicated, so I looked for a cleaner way. The iterate function returns an Iteratorfor the arguments. This works in some cases, but in other cases it panics, because the ast.params slice just contains a single zero.

Is this a bug?

Anyone else here used the Ast for metaprogramming and stumbled over this?

1 Like