Skip to content

Conversation

@aschackmull
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the C# label Nov 26, 2025
@aschackmull aschackmull force-pushed the csharp/object-initializer branch 2 times, most recently from 49eed3a to 0ef7bee Compare November 27, 2025 13:21
Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

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

Uh, very neat!
Just some quick initial comments. It appears that there are some tests failing.

{
internal sealed class ObjectInitMethod : CachedEntity, IMethodEntity
{
Type ContainingType { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

private?

this.ContainingType = containingType;
}

public string Name => "<object initializer>";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be made a readonly field.

@michaelnebel
Copy link
Contributor

Do you also intend to model some synthetic assignments in the new synthetic method?

@aschackmull
Copy link
Contributor Author

Do you also intend to model some synthetic assignments in the new synthetic method?

The assignments are already extracted as top-level expressions in the enclosing class. We could move them into this new method - that's what Java does, but Java also allow one to write a chunk of code that goes directly into the object initializer, so the situation there is slightly different. However, I opted not to do that since it would be a much more invasive change and require us to change any current QL code that relies on identifying field initializers as they would have moved and would look different. Though, if we were building from scratch then I would have put the assignments inside the method, but as it stands I don't think it's worth it to make the change.

@aschackmull aschackmull force-pushed the csharp/object-initializer branch from bed13c3 to f7ff3f5 Compare November 28, 2025 13:12
@aschackmull aschackmull force-pushed the csharp/object-initializer branch from f7ff3f5 to 3ee3160 Compare November 28, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants