Cleanup iterators
This commit is contained in:
@@ -178,13 +178,12 @@ CORE_Static void
|
||||
parse_all_modules() {
|
||||
pctx->parsing_time_begin = os_time();
|
||||
|
||||
Iter_Named(&pctx->modules, mod_it) {
|
||||
Ast_Module *module = mod_it.item[0];
|
||||
For_Named(pctx->modules, module) {
|
||||
if (module->state != MODULE_REGISTERED)
|
||||
continue;
|
||||
|
||||
Iter(&module->all_loaded_files) {
|
||||
parse_file(*it.item);
|
||||
For(module->all_loaded_files) {
|
||||
parse_file(it);
|
||||
}
|
||||
|
||||
if (module != pctx->language_base_module) {
|
||||
@@ -220,8 +219,8 @@ add_module(Token *pos, Intern_String filename, B32 command_line_module) {
|
||||
// Find in module folder
|
||||
//
|
||||
else {
|
||||
Iter(&pctx->module_folders) {
|
||||
String path = string_fmt(scratch, "%Q/%Q", it.item[0], filename);
|
||||
For(pctx->module_folders) {
|
||||
String path = string_fmt(scratch, "%Q/%Q", it, filename);
|
||||
if (os_does_file_exist(path)) {
|
||||
absolute_file_path = path;
|
||||
absolute_base_folder = string_chop_last_slash(path);
|
||||
@@ -234,10 +233,10 @@ add_module(Token *pos, Intern_String filename, B32 command_line_module) {
|
||||
compiler_error(pos, "Couldn't find the module with name %Q", filename);
|
||||
}
|
||||
|
||||
Iter(&pctx->modules) {
|
||||
if (string_compare(it.item[0]->absolute_file_path, absolute_file_path)) {
|
||||
For(pctx->modules) {
|
||||
if (string_compare(it->absolute_file_path, absolute_file_path)) {
|
||||
log_trace("Returning registered module: %Q\n", absolute_file_path);
|
||||
return it.item[0];
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,10 +260,9 @@ resolve_everything_in_module(Ast_Module *module) {
|
||||
if (module->state == MODULE_RESOLVED)
|
||||
return;
|
||||
pctx->resolving_time_begin = os_time();
|
||||
Iter_Named(&module->all_loaded_files, file) {
|
||||
Iter(&file.item[0]->decls) {
|
||||
Ast_Decl *decl = it.item[0];
|
||||
resolve_name(file.item[0], decl->pos, decl->name);
|
||||
For_Named(module->all_loaded_files, file) {
|
||||
For_Named(file->decls, decl) {
|
||||
resolve_name(file, decl->pos, decl->name);
|
||||
|
||||
if (decl->kind == AST_STRUCT) {
|
||||
type_complete(decl->type_val);
|
||||
@@ -371,8 +369,8 @@ compile_file(Allocator *allocator, String filename, U32 compile_flags = COMPILE_
|
||||
F64 begin = os_time();
|
||||
String_Builder builder = {scratch};
|
||||
builder.addf("clang program.c -Wall -Wno-unused-function -Wno-parentheses-equality -g -o a" OS_EXE " ");
|
||||
Iter(&pctx->files_to_link) {
|
||||
builder.addf("-l%Q ", it.item[0]->intern_val);
|
||||
For(pctx->files_to_link) {
|
||||
builder.addf("-l%Q ", it->intern_val);
|
||||
}
|
||||
String compiler_call = string_flatten(scratch, &builder);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user