Skip to content

Fix indent and is_last variable misusage#9

Open
Meredith2328 wants to merge 1 commit intotea-compiler:mainfrom
Meredith2328:main
Open

Fix indent and is_last variable misusage#9
Meredith2328 wants to merge 1 commit intotea-compiler:mainfrom
Meredith2328:main

Conversation

@Meredith2328
Copy link
Copy Markdown

@Meredith2328 Meredith2328 commented Apr 10, 2026

The original src/ast/tree.rs prints extra vertical bar lines, making the AST tree less readable.

  • Remove incorrectly added ! on is_last to fix extra vertical bar lines printed for Program/FnDef and other nodes
  • Change VarDeclStmt::fmt_tree to pass new_indent instead of indent_levels to its inner, fixing the issue where child nodes appear at the same level as their parent

Pic1: Before fix - Program/FnDef shows extra vertical bars; VarDeclStmt and a: int are at the same level

Pasted image 20260410121430

Pic2: After fix

Pasted image 20260410122131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant