summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-01-06 14:40:39 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-01-06 14:40:39 -0500
commit24e96d9dda5387203322abc28fa875f8579a7c19 (patch)
tree84ccde6eaeb19e8e5cb5477e423be0bd270b5822
parent28f622a04c5af314c80bbe112dc22e8ae16f01ef (diff)
fixed type_to_str for tuples
-rw-r--r--parse.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/parse.c b/parse.c
index f80e28e..0efe4ff 100644
--- a/parse.c
+++ b/parse.c
@@ -251,13 +251,13 @@ static size_t type_to_str_(Type *t, char *buffer, size_t bufsize) {
return written;
}
case TYPE_TUPLE: {
- size_t written = str_copy(buffer, bufsize, "(");
+ size_t written = str_copy(buffer, bufsize, "<");
arr_foreach(t->tuple, Type, child) {
if (child != t->tuple)
written += str_copy(buffer + written, bufsize - written, ", ");
written += type_to_str_(child, buffer + written, bufsize - written);
}
- written += str_copy(buffer + written, bufsize - written, ")");
+ written += str_copy(buffer + written, bufsize - written, ">");
return written;
}
case TYPE_PTR: {
@@ -266,7 +266,7 @@ static size_t type_to_str_(Type *t, char *buffer, size_t bufsize) {
return written;
}
case TYPE_TYPE:
- return str_copy(buffer, bufsize, "<type>");
+ return str_copy(buffer, bufsize, "Type");
case TYPE_PKG:
return str_copy(buffer, bufsize, "pkg");
case TYPE_EXPR:
@@ -695,25 +695,6 @@ static bool parser_is_definitely_type(Parser *p, Token **end) {
case KW_LT: {
/* no expression can start with < */
return true;
-#if 0
- Token *child_end;
- ++t->token;
- ret = false;
- while (parser_is_definitely_type(p, &child_end)) {
- t->token = child_end;
- if (t->token->kind == TOKEN_KW) {
- if (t->token->kw == KW_COMMA) {
- ++t->token;
- continue;
- } else if (t->token->kw == KW_GT) {
- /* it *is* a tuple! */
- ret = true;
- ++t->token;
- goto end;
- }
- } else break;
- }
-#endif
} break;
case KW_FN: {
ret = false;