make Statement, StatementNoCaseNoDefault and Declaration use SumType #489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.