aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2018-05-17 10:33:23 +0100
committerGitHub <noreply@github.com>2018-05-17 10:33:23 +0100
commitaf2048570cc96e1c45f4863a6b04b9b4e9376827 (patch)
treea1326b5427178d2df4ea4929aa5d01979dfd6bd5 /src/main.cpp
parente25c72ecddcf12c82aac439ad3fdc58629379765 (diff)
parent1ee4f849cb8e517c2390db0d53792397e404b529 (diff)
Merge pull request #222 from shuaDev/master
added compiler command for only parsing and typechecking
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 46bf2cd71..a3fc783a7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -162,6 +162,7 @@ void usage(String argv0) {
print_usage_line(0, "Commands:");
print_usage_line(1, "build compile .odin file as executable");
print_usage_line(1, "run compile and run .odin file");
+ print_usage_line(1, "check parse and type check .odin file");
print_usage_line(1, "docs generate documentation for a .odin file");
print_usage_line(1, "version print version");
}
@@ -724,6 +725,13 @@ int main(int arg_count, char **arg_ptr) {
return 1;
}
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") {
if (args.count < 3) {
usage(args[0]);
@@ -795,6 +803,18 @@ int main(int arg_count, char **arg_ptr) {
check_parsed_files(&checker);
+ if (build_context.no_output_files) {
+ if (build_context.show_timings) {
+ show_timings(&checker, &timings);
+ }
+
+ if (global_error_collector.count != 0) {
+ return 1;
+ }
+
+ return 0;
+ }
+
irGen ir_gen = {0};
if (!ir_gen_init(&ir_gen, &checker)) {
return 1;