Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better debug output for piece trees. #1324

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Better debug output for piece trees. #1324

merged 2 commits into from
Nov 16, 2023

Conversation

munificent
Copy link
Member

The old formatter has pretty nice debug output, but the new one is still pretty rudimentary. This improves that situation somewhat from:

Sequence(Type(`class Foo` Block(`{` Sequence(Var(`static late final int` `i;`) Var(`static late int` `i;`) Var(`static late var` `i;`) Var(`covariant late var` `i;`) Var(`covariant late int` `i;`) Var(`late final int` `i;`) Var(`late int` `i;`) Var(`late var` `i;`)) `}`)))

To:

Seq(
  Type(
    `class Foo`
    Block(
      `{`
      Seq(
        Var(`static late final int` `i;`)
        Var(`static late int` `i;`)
        Var(`static late var` `i;`)
        Var(`covariant late var` `i;`)
        Var(`covariant late int` `i;`)
        Var(`late final int` `i;`)
        Var(`late int` `i;`)
        Var(`late var` `i;`)
      )
      `}`
    )
  )
)

It also eliminates a bunch of pointless toString() implementations that are only used for debugging and can be inferred from runtimeType.

The old formatter has pretty nice debug output, but the new one is still
pretty rudimentary. This improves that situation somewhat from:

```
Sequence(Type(`class Foo` Block(`{` Sequence(Var(`static late final int` `i;`) Var(`static late int` `i;`) Var(`static late var` `i;`) Var(`covariant late var` `i;`) Var(`covariant late int` `i;`) Var(`late final int` `i;`) Var(`late int` `i;`) Var(`late var` `i;`)) `}`)))
```

To:

```
Seq(
  Type(
    `class Foo`
    Block(
      `{`
      Seq(
        Var(`static late final int` `i;`)
        Var(`static late int` `i;`)
        Var(`static late var` `i;`)
        Var(`covariant late var` `i;`)
        Var(`covariant late int` `i;`)
        Var(`late final int` `i;`)
        Var(`late int` `i;`)
        Var(`late var` `i;`)
      )
      `}`
    )
  )
)
```

It also eliminates a bunch of pointless `toString()` implementations
that are only used for debugging and can be inferred from runtimeType.
lib/src/debug.dart Outdated Show resolved Hide resolved
@munificent munificent merged commit fd6ed34 into main Nov 16, 2023
7 checks passed
@munificent munificent deleted the piece-debug-output branch November 16, 2023 22:51
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.

3 participants