summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/package.c b/package.c
index 97d0007..4738781 100644
--- a/package.c
+++ b/package.c
@@ -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;