mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
added compiler command for only parsing and typechecking
This commit is contained in:
@@ -27,6 +27,7 @@ struct BuildContext {
|
|||||||
bool show_timings;
|
bool show_timings;
|
||||||
bool keep_temp_files;
|
bool keep_temp_files;
|
||||||
bool no_bounds_check;
|
bool no_bounds_check;
|
||||||
|
bool no_output_files;
|
||||||
|
|
||||||
gbAffinity affinity;
|
gbAffinity affinity;
|
||||||
isize thread_count;
|
isize thread_count;
|
||||||
|
|||||||
+19
-1
@@ -162,6 +162,7 @@ void usage(String argv0) {
|
|||||||
print_usage_line(0, "Commands:");
|
print_usage_line(0, "Commands:");
|
||||||
print_usage_line(1, "build compile .odin file as executable");
|
print_usage_line(1, "build compile .odin file as executable");
|
||||||
print_usage_line(1, "run compile and run .odin file");
|
print_usage_line(1, "run compile and run .odin file");
|
||||||
|
print_usage_line(1, "check parse and typecheck .odin file");
|
||||||
print_usage_line(1, "docs generate documentation for a .odin file");
|
print_usage_line(1, "docs generate documentation for a .odin file");
|
||||||
print_usage_line(1, "version print version");
|
print_usage_line(1, "version print version");
|
||||||
}
|
}
|
||||||
@@ -724,6 +725,13 @@ int main(int arg_count, char **arg_ptr) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
init_filename = args[2];
|
init_filename = args[2];
|
||||||
|
} else if (command == "check") {
|
||||||
|
if (args.count < 3) {
|
||||||
|
usage(args[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
build_context.no_output_files = true;
|
||||||
|
init_filename = args[2];
|
||||||
} else if (command == "docs") {
|
} else if (command == "docs") {
|
||||||
if (args.count < 3) {
|
if (args.count < 3) {
|
||||||
usage(args[0]);
|
usage(args[0]);
|
||||||
@@ -750,7 +758,9 @@ int main(int arg_count, char **arg_ptr) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (build_context.no_output_files) {
|
||||||
|
// are there any flags that it shouldn't work with? maybe -out or -keep-temp-files?
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE(bill): add 'shared' directory if it is not already set
|
// NOTE(bill): add 'shared' directory if it is not already set
|
||||||
if (!find_library_collection_path(str_lit("shared"), nullptr)) {
|
if (!find_library_collection_path(str_lit("shared"), nullptr)) {
|
||||||
@@ -795,6 +805,14 @@ int main(int arg_count, char **arg_ptr) {
|
|||||||
|
|
||||||
check_parsed_files(&checker);
|
check_parsed_files(&checker);
|
||||||
|
|
||||||
|
if (build_context.no_output_files) {
|
||||||
|
if (build_context.show_timings) {
|
||||||
|
show_timings(&checker, &timings);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
irGen ir_gen = {0};
|
irGen ir_gen = {0};
|
||||||
if (!ir_gen_init(&ir_gen, &checker)) {
|
if (!ir_gen_init(&ir_gen, &checker)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user