diff options
| -rw-r--r-- | boot/lower.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/boot/lower.c b/boot/lower.c index 65eb18c..c72ad97 100644 --- a/boot/lower.c +++ b/boot/lower.c @@ -783,13 +783,25 @@ lower_pass_1_fill_bodies(struct Lower_Context* ctx, struct Tree* tree) } if (stmt->kind == TREE_STATEMENT_PRAGMA) { - lower_push_error( - ctx->unit, - (struct Lower_Error){ - .kind = LOWER_ERROR_UNIMPLEMENTED, - .span = stmt->span, - .detail = string_from_static_c_string("top-level pragmas"), - }); + for (struct Tree_Pragma* pragma = stmt->value.pragma.inner; pragma; + pragma = pragma->next) { + if (pragma->type == TREE_PRAGMA_C_HEADER && pragma->argument_count >= 1 + && pragma->arguments[0].type == TREE_PRAGMA_ARGUMENT_NAME_OR_STRING) { + struct Import import = { + .path = pragma->arguments[0].value.name_or_string, + .span = pragma->span, + }; + array_push(&ctx->unit->imports, &import); + } else { + lower_push_error( + ctx->unit, + (struct Lower_Error){ + .kind = LOWER_ERROR_UNIMPLEMENTED, + .span = pragma->span, + .detail = string_from_static_c_string("this pragma kind"), + }); + } + } continue; } |
