Using For from Array
This commit is contained in:
@@ -755,7 +755,7 @@ gen_ast(Ast *ast) {
|
||||
global_indent++;
|
||||
|
||||
For(node->cases) {
|
||||
For_Named(it->labels, label) {
|
||||
For2(it->labels, label) {
|
||||
gen_line(it);
|
||||
genln("");
|
||||
gen("case ");
|
||||
@@ -951,7 +951,7 @@ compile_to_c_code() {
|
||||
}
|
||||
|
||||
// Generate slice and tuple types
|
||||
For_Named(pctx->all_types, type) {
|
||||
For2(pctx->all_types, type) {
|
||||
Scoped_Arena scratch(pctx->scratch);
|
||||
|
||||
if (type->kind == TYPE_SLICE) {
|
||||
@@ -1021,7 +1021,7 @@ compile_to_c_code() {
|
||||
genln("int64_t type_infos_len = %d;", length(&pctx->all_types));
|
||||
genln("Type_Info *type_infos = (Type_Info[]){");
|
||||
global_indent++;
|
||||
For_Named(pctx->all_types, t) {
|
||||
For2(pctx->all_types, t) {
|
||||
if (t->kind == TYPE_POLYMORPH) continue;
|
||||
genln("{/*%Q*/.kind = %d, .size = %d, .align = %d, .is_unsigned = %s, .type = %d, ", typestring(t),
|
||||
(S32)t->kind, (S32)t->size, (S32)t->align, t->is_unsigned ? "true" : "false", t->type_id);
|
||||
@@ -1038,7 +1038,7 @@ compile_to_c_code() {
|
||||
gen(".lambda_return = %d, ", t->func.ret->type_id);
|
||||
gen(".lambda_arguments.len = %d, ", t->func.args.len);
|
||||
gen(".lambda_arguments.data = (Type_Info[%d]){", t->func.args.len);
|
||||
For_Named(t->func.args, arg) {
|
||||
For2(t->func.args, arg) {
|
||||
gen("{.type = %d}, ", arg->type_id);
|
||||
}
|
||||
gen("}");
|
||||
@@ -1047,7 +1047,7 @@ compile_to_c_code() {
|
||||
case TYPE_STRUCT: {
|
||||
gen(".struct_members.len = %d, ", t->agg.members.len);
|
||||
gen(".struct_members.data = (Type_Info_Struct_Member[]){");
|
||||
For_Named(t->agg.members, m) {
|
||||
For2(t->agg.members, m) {
|
||||
gen("{.name = (%Q){(uint8_t *)\"%Q\", %d}, .type = %d, .offset = %d}, ", prefixed_string_type, m.name, m.name.len, m.type->type_id, m.offset);
|
||||
}
|
||||
gen("}");
|
||||
|
||||
Reference in New Issue
Block a user