zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d227f76afbacb619152ffd943cf3018e62e00adc (tree)
parent 47dfaf47b89d4d87a9a15aed512e910fdec5cbb0
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 30 Mar 2022 11:52:10 -0700

std.zig.Ast: fix escaped capture of by-value parameters

Diffstat:
Mlib/std/zig/Ast.zig | 6+++---
Msrc/AstGen.zig | 4++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/std/zig/Ast.zig b/lib/std/zig/Ast.zig @@ -2354,10 +2354,10 @@ pub const full = struct { } }; - pub fn iterate(fn_proto: FnProto, tree: Ast) Iterator { + pub fn iterate(fn_proto: *const FnProto, tree: *const Ast) Iterator { return .{ - .tree = &tree, - .fn_proto = &fn_proto, + .tree = tree, + .fn_proto = fn_proto, .param_i = 0, .tok_i = fn_proto.lparen + 1, .tok_flag = true, diff --git a/src/AstGen.zig b/src/AstGen.zig @@ -1122,7 +1122,7 @@ fn fnProtoExpr( const is_var_args = is_var_args: { var param_type_i: usize = 0; - var it = fn_proto.iterate(tree.*); + var it = fn_proto.iterate(tree); while (it.next()) |param| : (param_type_i += 1) { const is_comptime = if (param.comptime_noalias) |token| token_tags[token] == .keyword_comptime @@ -3377,7 +3377,7 @@ fn fnDecl( var params_scope = &fn_gz.base; const is_var_args = is_var_args: { var param_type_i: usize = 0; - var it = fn_proto.iterate(tree.*); + var it = fn_proto.iterate(tree); while (it.next()) |param| : (param_type_i += 1) { const is_comptime = if (param.comptime_noalias) |token| token_tags[token] == .keyword_comptime