Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Convert ValueNode to record - #2419

Merged
vitek-karas merged 4 commits into
dotnet:feature/damAnalyzerfrom
vitek-karas:ValueNodeRefactor
Dec 3, 2021
Merged

vitek-karas merged 4 commits into
dotnet:feature/damAnalyzerfrom
vitek-karas:ValueNodeRefactor

Conversation

@vitek-karas

Copy link
Copy Markdown
Member

This is in preparation to merging the value type system with the analyzer and the SingleValue type.

Removes the Kind enum and uses type checks instead (there are not that many places actually since we already used type checks in lot of places).
Cleans up some of the value .ctors and properties.
Remove Equals/GetHashCode implementation where possible (leave it up to record).

@vitek-karas
vitek-karas requested a review from sbomer December 3, 2021 20:00
@vitek-karas vitek-karas self-assigned this Dec 3, 2021
@vitek-karas
vitek-karas merged commit a114ab5 into dotnet:feature/damAnalyzer Dec 3, 2021
@vitek-karas
vitek-karas deleted the ValueNodeRefactor branch December 3, 2021 21:54
class SystemTypeValue : LeafValueNode
record SystemTypeValue : LeafValueNode
{
public SystemTypeValue (TypeDefinition typeRepresented)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange to see such ctors in records, why not use records syntax?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still learning records. Which record syntax did you have in mind?

Using init only properties - VS even suggest adding a .ctor.
Using function-like positional parameters - This is really tricky with properties on base type - it seems the base type would have to make the properties mandatory....

@marek-safar marek-safar Dec 7, 2021 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which record syntax did you have in mind?

record SystemTypeValue (TypeDefinition TypeRepresented) : LeafValueNode
{
}

you should be able to delete the ctor after this

agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
This is in preparation to merging the value type system with the analyzer and the `SingleValue` type.

Removes the Kind enum and uses type checks instead (there are not that many places actually since we already used type checks in lot of places).
Cleans up some of the value .ctors and properties.
Remove Equals/GetHashCode implementation where possible (leave it up to record).

Commit migrated from dotnet/linker@a114ab5
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants