mirror of
https://github.com/ziglang/zig.git
synced 2026-02-01 04:03:40 +00:00
parent
3b19869853
commit
8d8a5f9733
@ -4197,7 +4197,7 @@ pub const FuncGen = struct {
|
||||
}
|
||||
|
||||
var it = iterateParamTypes(self.dg, fn_info);
|
||||
while (it.next()) |lowering| switch (lowering) {
|
||||
while (it.nextCall(self, args)) |lowering| switch (lowering) {
|
||||
.no_bits => continue,
|
||||
.byval => {
|
||||
const arg = args[it.zig_index - 1];
|
||||
@ -9004,10 +9004,26 @@ const ParamTypeIterator = struct {
|
||||
slice,
|
||||
};
|
||||
|
||||
fn next(it: *ParamTypeIterator) ?Lowering {
|
||||
pub fn next(it: *ParamTypeIterator) ?Lowering {
|
||||
if (it.zig_index >= it.fn_info.param_types.len) return null;
|
||||
|
||||
const ty = it.fn_info.param_types[it.zig_index];
|
||||
return nextInner(it, ty);
|
||||
}
|
||||
|
||||
/// `airCall` uses this instead of `next` so that it can take into account variadic functions.
|
||||
pub fn nextCall(it: *ParamTypeIterator, fg: *FuncGen, args: []const Air.Inst.Ref) ?Lowering {
|
||||
if (it.zig_index >= it.fn_info.param_types.len) {
|
||||
if (it.zig_index >= args.len) {
|
||||
return null;
|
||||
} else {
|
||||
return nextInner(it, fg.air.typeOf(args[it.zig_index]));
|
||||
}
|
||||
} else {
|
||||
return nextInner(it, it.fn_info.param_types[it.zig_index]);
|
||||
}
|
||||
}
|
||||
|
||||
fn nextInner(it: *ParamTypeIterator, ty: Type) ?Lowering {
|
||||
if (!ty.hasRuntimeBitsIgnoreComptime()) {
|
||||
it.zig_index += 1;
|
||||
return .no_bits;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user