hare

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

commit 7164e8e084983ad2c207632343be65980daa2f7e
parent e5ecf11005e3e9d1bc9b1cd6a8dfef884a18e9e2
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sat, 28 Oct 2023 02:34:57 -0400

hare::ast: s/fndecl_attrs/fndecl_attr/g

For consistency with other type names which aren't plural, like flag.

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

Diffstat:
Mhare/ast/decl.ha | 4++--
Mhare/parse/decl.ha | 8++++----
Mhare/unit/process.ha | 4++--
Mhare/unit/scan.ha | 2+-
Mhare/unit/unit.ha | 2+-
Mhare/unparse/decl.ha | 10+++++-----
6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/hare/ast/decl.ha b/hare/ast/decl.ha @@ -34,7 +34,7 @@ export type decl_type = struct { }; // Attributes applicable to a function declaration. -export type fndecl_attrs = enum { +export type fndecl_attr = enum { NONE, FINI, INIT, @@ -49,7 +49,7 @@ export type decl_func = struct { ident: ident, prototype: *_type, body: nullable *expr, - attrs: fndecl_attrs, + attrs: fndecl_attr, }; // A Hare declaration. diff --git a/hare/parse/decl.ha b/hare/parse/decl.ha @@ -128,7 +128,7 @@ fn decl_type(lexer: *lex::lexer) ([]ast::decl_type | error) = { }; fn decl_func(lexer: *lex::lexer) (ast::decl_func | error) = { - let attr = ast::fndecl_attrs::NONE, sym = ""; + let attr = ast::fndecl_attr::NONE, sym = ""; const attrs = [ ltok::ATTR_FINI, ltok::ATTR_INIT, ltok::ATTR_TEST, ltok::ATTR_SYMBOL @@ -139,11 +139,11 @@ fn decl_func(lexer: *lex::lexer) (ast::decl_func | error) = { case let t: lex::token => switch (t.0) { case ltok::ATTR_FINI => - attr = ast::fndecl_attrs::FINI; + attr = ast::fndecl_attr::FINI; case ltok::ATTR_INIT => - attr = ast::fndecl_attrs::INIT; + attr = ast::fndecl_attr::INIT; case ltok::ATTR_TEST => - attr = ast::fndecl_attrs::TEST; + attr = ast::fndecl_attr::TEST; case ltok::ATTR_SYMBOL => sym = attr_symbol(lexer)?; case => diff --git a/hare/unit/process.ha b/hare/unit/process.ha @@ -52,7 +52,7 @@ fn process_func( adecl: *ast::decl, func: *ast::decl_func, ) (decl | error) = { - assert(func.attrs & ast::fndecl_attrs::TEST == 0); // TODO + assert(func.attrs & ast::fndecl_attr::TEST == 0); // TODO const afndecl = adecl.decl as ast::decl_func; const prototype = types::lookup(ctx.store, func.prototype)!; const fntype = prototype.repr as types::func; @@ -78,7 +78,7 @@ fn process_func( prototype = prototype, body = body, // TODO: We should make these enums inherited - attrs = afndecl.attrs: ast::fndecl_attrs, + attrs = afndecl.attrs: ast::fndecl_attr, }, }; }; diff --git a/hare/unit/scan.ha b/hare/unit/scan.ha @@ -50,7 +50,7 @@ fn scan_func( decl: *ast::decl, func: *ast::decl_func, ) (void | types::deferred | error) = { - assert(func.attrs & ast::fndecl_attrs::TEST == 0); // TODO + assert(func.attrs & ast::fndecl_attr::TEST == 0); // TODO const fntype = match (types::lookup(ctx.store, func.prototype)) { case let err: types::error => return err; diff --git a/hare/unit/unit.ha b/hare/unit/unit.ha @@ -12,7 +12,7 @@ export type decl_func = struct { ident: ast::ident, prototype: const *types::_type, body: nullable *expr, - attrs: ast::fndecl_attrs, + attrs: ast::fndecl_attr, }; // A declaration within a unit. diff --git a/hare/unparse/decl.ha b/hare/unparse/decl.ha @@ -122,14 +122,14 @@ export fn decl( }; switch (f.attrs) { - case ast::fndecl_attrs::NONE => void; - case ast::fndecl_attrs::FINI => + case ast::fndecl_attr::NONE => void; + case ast::fndecl_attr::FINI => n += syn(&ctx, "@fini", synkind::ATTRIBUTE)?; n += space(&ctx)?; - case ast::fndecl_attrs::INIT => + case ast::fndecl_attr::INIT => n += syn(&ctx, "@init", synkind::ATTRIBUTE)?; n += space(&ctx)?; - case ast::fndecl_attrs::TEST => + case ast::fndecl_attr::TEST => n += syn(&ctx, "@test", synkind::ATTRIBUTE)?; n += space(&ctx)?; }; @@ -289,7 +289,7 @@ fn decl_test(d: *ast::decl, expected: str) bool = { ident = ["foo"], prototype = &type_fn, body = null, - attrs = ast::fndecl_attrs::FINI, + attrs = ast::fndecl_attr::FINI, }; assert(decl_test(&d, "@fini @symbol(\"foo\") fn foo(foo: int, bar: int...) int;"));