Pass 'generic_macro'

This commit is contained in:
David Gonzalez Martin 2025-06-17 10:05:09 -06:00
parent 51cad46ad6
commit d6c187e20e

View File

@ -7170,12 +7170,55 @@ parse = fn (module: &Module) void
if (is_generic) if (is_generic)
{ {
while (1)
{
skip_space(module);
if (consume_character_if_match(module, right_bracket))
{
break;
}
>argument_name = arena_duplicate_string(module.arena, parse_identifier(module));
skip_space(module);
>has_value = consume_character_if_match(module, ':');
>constant_argument_index = constant_argument_count;
if (has_value)
{
#trap();
}
else
{
>ty = new_type(module, {
.id = .unresolved,
.name = argument_name,
.scope = &macro_declaration.scope,
zero,
});
constant_argument_buffer[constant_argument_index] = {
.name = argument_name,
.content = {
.type = ty,
},
.id = .type,
};
}
constant_argument_count += 1;
}
skip_space(module);
// END OF SCOPE // END OF SCOPE
if (constant_argument_count == 0) if (constant_argument_count == 0)
{ {
report_error(); report_error();
} }
#trap();
} }
else else
{ {
@ -16929,6 +16972,7 @@ names: [_][]u8 =
"slice_array_literal", "slice_array_literal",
"slice_only_start", "slice_only_start",
"basic_macro", "basic_macro",
"generic_macro",
]; ];
[export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32 [export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32