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

Refactor EEType - #1621

Merged
nattress merged 1 commit into
dotnet:masterfrom
nattress:refactor_eetype_2
Aug 9, 2016
Merged

nattress merged 1 commit into
dotnet:masterfrom
nattress:refactor_eetype_2

Conversation

@nattress

@nattress nattress commented Aug 6, 2016

Copy link
Copy Markdown
Contributor

Split EEType into two pieces: the non-constructed EETypeNode and the
constructed ConstructedEETypeNode.
Generic type definitions get their own GenericDefinitionEETypeNode node
which matches the the one produced by the binder.

Both the constructed and the generic nodes inherit from EETypeNode.
GenericDefinitionEETypeNode could exist without inheriting from
EETypeNode, however this simplifies code that expects to get back a
common usable ObjectNode/ISymbolNode from the NodeFactory. For example,
TypeMetadataMapNode.GetData would require special casing for the
different EEType node kinds if the various EEType nodes were independent
of eachother.

@nattress

nattress commented Aug 8, 2016

Copy link
Copy Markdown
Contributor Author

@dotnet-bot Please test Windows_NT Debug

@nattress

nattress commented Aug 8, 2016

Copy link
Copy Markdown
Contributor Author

@MichalStrehovsky PTAL

@nattress

nattress commented Aug 8, 2016

Copy link
Copy Markdown
Contributor Author

Proposed attempt at addressing #1213

@jkotas PTAL, too

@jkotas

jkotas commented Aug 8, 2016

Copy link
Copy Markdown
Member

Looks fine to me.

(I do not have strong opinions on the right balance between object hierarchy vs. if-checks.)

if (_type.IsInterface)
flags |= (short)EETypeFlags.IsInterfaceFlag;

dataBuilder.EmitShort(0); // ComponentSize is always 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ComponentSize should be the number of generic parameters.

@MichalStrehovsky

Copy link
Copy Markdown
Member

I usually prefer having an abstract class as opposed to a deriving class that tries to suppress behaviors of the base (because not overriding an abstract method is a compile error but forgetting to suppress a behavior by overriding is not), but it's fewer if's, so LGTM.

/// |
/// [Pointer Size] | Pointer to the generic argument and variance info (optional)
/// </summary>
internal sealed partial class EETypeNode : ObjectNode, ISymbolNode, IEETypeNode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you seal the overrides that can be sealed?

@nattress
nattress force-pushed the refactor_eetype_2 branch from 305289b to a13d10e Compare August 8, 2016 19:43
@nattress

nattress commented Aug 8, 2016

Copy link
Copy Markdown
Contributor Author

@MichalStrehovsky Updated with requested changes.

@MichalStrehovsky

Copy link
Copy Markdown
Member

LGTM

Split EEType into two pieces: the non-constructed EETypeNode and the
constructed ConstructedEETypeNode.
Generic type definitions get their own GenericDefinitionEETypeNode node
which matches the the one produced by the binder.

Both the constructed and the generic nodes inherit from EETypeNode.
GenericDefinitionEETypeNode could exist without inheriting from
EETypeNode, however this simplifies code that expects to get back a
common usable ObjectNode/ISymbolNode from the NodeFactory. For example,
TypeMetadataMapNode.GetData would require special casing for the
different EEType node kinds if the various EEType nodes were independent
of eachother.
@nattress
nattress force-pushed the refactor_eetype_2 branch from cb9af9e to 6ed9886 Compare August 9, 2016 17:23
@nattress
nattress merged commit f5d1ab0 into dotnet:master Aug 9, 2016
@nattress
nattress deleted the refactor_eetype_2 branch June 26, 2017 18:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants