From 24e96d9dda5387203322abc28fa875f8579a7c19 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 6 Jan 2020 14:40:39 -0500 Subject: fixed type_to_str for tuples --- parse.c | 25 +++---------------------- 1 file 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, ""); + 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; -- cgit v1.2.3