hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 717e3968a525bb368b395522793c72c69b849e03
parent 657b5b3149ad495742df6b788d652cfdc6248e94
Author: Sebastian <sebastian@sebsite.pw>
Date:   Fri,  4 Aug 2023 00:32:21 -0400

hare::*: remove implicit const flag from functions

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mhare/parse/decl.ha | 2+-
Mhare/parse/type.ha | 2+-
Mhare/unparse/decl.ha | 2+-
Mhare/unparse/type.ha | 7+------
4 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/hare/parse/decl.ha b/hare/parse/decl.ha @@ -183,7 +183,7 @@ fn decl_func(lexer: *lex::lexer) (ast::decl_func | error) = { prototype = ast::_type { start = proto_start, end = proto_end, - flags = ast::type_flag::CONST, + flags = 0, repr = prototype, }, body = body, diff --git a/hare/parse/type.ha b/hare/parse/type.ha @@ -231,7 +231,7 @@ fn fn_type(lexer: *lex::lexer) (ast::_type | error) = { return ast::_type { start = start, end = lex::prevloc(lexer), - flags = ast::type_flag::CONST, + flags = 0, repr = proto, }; }; diff --git a/hare/unparse/decl.ha b/hare/unparse/decl.ha @@ -146,7 +146,7 @@ fn decl_test(d: ast::decl, expected: str) bool = { let type_fn = ast::_type { start = loc, end = loc, - flags = ast::type_flag::CONST, + flags = 0, repr = ast::func_type { result = &type_int, attrs = ast::func_attrs::NORETURN, diff --git a/hare/unparse/type.ha b/hare/unparse/type.ha @@ -216,8 +216,7 @@ export fn _type( t: ast::_type, ) (size | io::error) = { let n = 0z; - if (t.flags & ast::type_flag::CONST != 0 - && !(t.repr is ast::func_type)) { + if (t.flags & ast::type_flag::CONST != 0) { n += fmt::fprint(out, "const ")?; }; if (t.flags & ast::type_flag::ERROR != 0) { @@ -467,10 +466,6 @@ fn type_test(t: ast::_type, expected: str) void = { }; type_test(t, "fn(foo: int, bar: int...) int"); - t.flags = ast::type_flag::CONST; - type_test(t, "fn(foo: int, bar: int...) int"); - - t.flags = 0; t.repr = ast::list_type { length = ast::len_slice, members = &type_int,