Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOperation API for anonymous object creation expressions #19926

Closed
mavasani opened this issue May 31, 2017 · 1 comment
Closed

IOperation API for anonymous object creation expressions #19926

mavasani opened this issue May 31, 2017 · 1 comment
Assignees
Labels
4 - In Review A fix for the issue is submitted for review. Area-Analyzers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature - IOperation IOperation Urgency-Soon
Milestone

Comments

@mavasani
Copy link
Contributor

Two possible approaches:

  1. Expose two separate arrays for declared property symbols and arguments:
    public interface IAnonymousObjectCreationExpression : IHasArgumentsExpression
    {
        ImmutableArray<IPropertySymbol> DeclaredProperties { get; }
    }
  1. Expose a single array of property initializers, each with declared symbol and initializer:
    public interface IAnonymousObjectCreationExpression : IOperation
    {
        ImmutableArray<IAnonymousPropertyInitializer> Initializers { get; }
    }

    public interface IAnonymousPropertyInitializer : IOperation
    {
        IPropertySymbol DeclaredProperty { get; }
        IOperation Initializer { get; }
    }

@mavasani mavasani added Area-Analyzers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. Discussion Feature - IOperation IOperation labels May 31, 2017
@mavasani mavasani added this to the 15.later milestone May 31, 2017
@CyrusNajmabadi
Copy link
Member

CyrusNajmabadi commented Jun 1, 2017

Design Team Decision

public interface IAnonymousObjectCreationExpression : IOperation
    {
        ImmutableArray<IAssignmentExpression> Initializers { get; }  // or
        ImmutableArray<IOperation> Initializers { get; }
    }

If we use AssignmentExpression we need to have a IOperation for the left side. This will be a PropertyReferenceExpression. HOwever, because we don't have an appropriate 'receiver' (since we're inside creating the anonymous expression), we'll just use 'null' as the receiver and doc this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-Analyzers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature - IOperation IOperation Urgency-Soon
Projects
None yet
Development

No branches or pull requests

3 participants