diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-01 14:57:25 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-01 14:57:25 -0500 |
commit | c4d50b7f83117d46015a7c8e5c7eaeb1b63f04a3 (patch) | |
tree | 942fc2d60bf133779622b7b1cefa59ebb7d10e4f | |
parent | 65a7e6270d5c97ac01f02a7d16d016eb6f526d51 (diff) |
more exporting
-rw-r--r-- | package.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -61,6 +61,16 @@ static void export_ident(Exporter *ex, Identifier i) { static void export_type(Exporter *ex, Type *type) { } +static bool export_len(Exporter *ex, size_t len, const char *for_, Location where) { + if (len > 65535) { + err_print(where, "Too many %s (the maximum is 65535).", for_); + return false; + } + export_len(ex, (U16)len); + return true; +} + + static bool export_val(Exporter *ex, Value val, Type *type, Location where) { export_type(ex, type); switch (type->kind) { @@ -81,6 +91,14 @@ static bool export_val(Exporter *ex, Value val, Type *type, Location where) { case BUILTIN_CHAR: export_char(ex, val.charv); break; } break; + case TYPE_TUPLE: + if (arr_len(type->tuple) > 65535) { + err_print(where, "Too many types in one tuple."); + return false; + } + export_u16((U16)arr_len(type->tuple)); + + break; case TYPE_TYPE: export_type(ex, val.type); break; |