libdparse
libdparse copied to clipboard
make Statement, StatementNoCaseNoDefault and Declaration use SumType
old Declaration code used algebraic, which is more efficiently replaced with sumtype.
I replaced the mixin-generated properties with manual properties, since the code is very small for them anyway and helps them being shown in DCD
Since SumType works with well-defiend types, opEquals and visitIfNotNull was trivial to implement.
Saves around 0-3 MB of actual peak RAM in a ~170 MB test environment (could just be fluctuations how much it actually is, but it will definitely include some RAM savings, since we no longer store a bunch of nulls for common types)
Easy backwards-compatible improvement I think.
Made setters backwards-incompatible on purpose, since we don't want accidental assignment of 2 different types on the same sumtype.
Codecov Report
Merging #489 (7f7a9ce) into master (98bf0f4) will increase coverage by
0.04%. The diff coverage is82.27%.
Additional details and impacted files
@@ Coverage Diff @@
## master #489 +/- ##
==========================================
+ Coverage 83.49% 83.53% +0.04%
==========================================
Files 11 11
Lines 8483 8541 +58
==========================================
+ Hits 7083 7135 +52
- Misses 1400 1406 +6
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/dparse/ast.d | 71.97% <80.82%> (+1.72%) |
:arrow_up: |
| src/dparse/parser.d | 91.43% <100.00%> (ø) |
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 98bf0f4...7f7a9ce. Read the comment docs.