diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-07-12 14:45:29 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-07-12 14:45:29 -0400 |
commit | a7d209081a9f59f9d347ab87f76d0b58dc7cc106 (patch) | |
tree | 165238bf6f7431a6136ecbb7660bdf9a5aa28dc2 | |
parent | ad700fb033e47377f7945e10facc3475da0b747c (diff) |
reduce number of errors if an include failed
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | test.toc | 5 | ||||
-rw-r--r-- | types.c | 7 |
3 files changed, 8 insertions, 5 deletions
@@ -8,7 +8,6 @@ see development.md for development information @TODO: -if we do #include "foo.toc", bar; and foo.toc fails, bar should be declared as TYPE_UNKNOWN (right now it's undeclared) fix #foreign not at global scope - right now the cgen'd definition doesn't use the proper type figure out how printf is gonna work improve type_to_str: @@ -1,6 +1,7 @@ -#include "std/io.toc", io; +#include "main.c", t; + main ::= fn() { - io.puts("Hello, world!"); + t.puts("hi"); } main(); @@ -3878,7 +3878,6 @@ top: { char *contents = read_file_contents(tr->allocr, filename, s->where); if (!contents) { - tr->had_include_err = true; success = false; goto nms_done; } @@ -3919,7 +3918,11 @@ top: tr->block = prev_block; } if (inc_f) inc_f->flags &= (IncFileFlags)~(IncFileFlags)INC_FILE_INCLUDING; - if (!success) return false; + if (!success) { + // give up on typing if #include failed + tr->had_include_err = true; + return false; + } } break; case STMT_MESSAGE: { Message *m = s->message; |