hare

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

commit 6b88430683e59e1b143648b590062d82b5704f61
parent 9a232fab13e8e8f32dd212be2c49889b8eca68dc
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 29 Apr 2021 10:59:04 -0400

haredoc: fix indentation of nested structs

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mcmd/haredoc/html.ha | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha @@ -439,10 +439,11 @@ fn struct_html( let z = 0z; z += fmt::fprint(out, "<span class='keyword'>struct</span> {")?; + indent += 1; for (let i = 0z; i < len(t); i += 1) { const member = t[i]; - z += newline(out, indent + 1)?; + z += newline(out, indent)?; match (member._offset) { null => void, expr: *ast::expr => { @@ -458,7 +459,7 @@ fn struct_html( z += type_html(out, indent, *f._type, brief)?; }, embed: ast::struct_embedded => { - z += type_html(out, indent + 1, *embed, brief)?; + z += type_html(out, indent, *embed, brief)?; }, indent: ast::struct_alias => { z += unparse::ident(out, indent)?; @@ -467,6 +468,7 @@ fn struct_html( z += fmt::fprint(out, ",")?; }; + indent -= 1; z += newline(out, indent)?; z += fmt::fprint(out, "}")?;