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

refactored IAssignment/ICompoundAssignment as we discussed and removed IndexPropertyReference #20431

Merged
merged 16 commits into from
Jun 30, 2017

Conversation

heejaechang
Copy link
Contributor

@heejaechang heejaechang commented Jun 23, 2017

refactored IAssignment/ICoumoundAssignment as we discussed. broke out IncrementalExpression from assignment expression.

merged Indexed and normal propertyreference expression and removed IndexedProperty interface.

also, made more code to use same patterns.

@heejaechang heejaechang changed the base branch from master to features/ioperation June 23, 2017 19:56
@heejaechang
Copy link
Contributor Author

@dotnet/analyzer-ioperation @dotnet/roslyn-analysis can you take a look?

@heejaechang
Copy link
Contributor Author

@jinujoseph I think we had a bug about this, but I couldn't find it. do you know what that is?

@heejaechang heejaechang changed the title first step adding parent API added Base interface to 3 interfaces (IAssignmentExpression, ICompoundAssignmentExpression, IPropertyReferenceExpression) which doesn't follow existing pattern Jun 23, 2017
@heejaechang heejaechang changed the title added Base interface to 3 interfaces (IAssignmentExpression, ICompoundAssignmentExpression, IPropertyReferenceExpression) which doesn't follow existing pattern added Base interfaces to 3 interfaces (IAssignmentExpression, ICompoundAssignmentExpression, IPropertyReferenceExpression) which don't follow existing pattern Jun 23, 2017
@heejaechang
Copy link
Contributor Author

@AlekseyTs @cston @jinujoseph how do you think about this change?

@heejaechang
Copy link
Contributor Author

@mavasani has this wok item - #18056 (comment)

which is this
...
Design Team Notes

We need to simplify the hierarchy, The intend here is we are not going to have the complex inheritance hierarchy where in the same hierarchy there is lot of base. We should try to make it more flat and narrow. IExpression might have Iincrementexpression, IcompondAssignment , IAssignementExpression and those themselves can implement side hierarchy, which can be call as infos which are not Ioperation Kind , Say IAssignmentInfos and some one can uniformally operate on this things.
...

I dont believe we can make IOperation hierarchy flat since we have cases such as ICaseClause where we want to return base type (ICaseClauses) when needed.

but we can make IIncrementExpression, ICoumpoundAssignment, IAssignmentExpression to IHasXXXX pattern if want to.

but I believe we can address that in different PR, this PR at least remove those odd cases where an interface are based interface for other interface and at the same time, itself has implementation.

/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IAssignmentExpression : IBaseAssignmentExpression
Copy link
Member

Choose a reason for hiding this comment

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

What code will be consuming or implementing IAssignmentExpression rather than IBaseAssignmentExpression?

@heejaechang heejaechang changed the title added Base interfaces to 3 interfaces (IAssignmentExpression, ICompoundAssignmentExpression, IPropertyReferenceExpression) which don't follow existing pattern refactored IAssignment/ICompoundAssignment as we discussed and removed IndexPropertyReference Jun 27, 2017
@heejaechang
Copy link
Contributor Author

@mavasani @dotnet/analyzer-ioperation can you take a look?

@heejaechang
Copy link
Contributor Author

@AlekseyTs can you take a look at this PR?

@heejaechang
Copy link
Contributor Author

@dotnet/roslyn-infrastructure
https://ci.dot.net/job/dotnet_roslyn/job/features_ioperation/job/windows_debug_vs-integration_prtest/126/

this seems happening in multiple PR.

@heejaechang
Copy link
Contributor Author

@dotnet/roslyn-infrastructure test failed
Roslyn.VisualStudio.IntegrationTests.VisualBasic.BasicExpressionEvaluator.StateMachineTypeParameters

https://ci.dot.net/job/dotnet_roslyn/job/features_ioperation/job/windows_debug_vs-integration_prtest/127/

@heejaechang
Copy link
Contributor Author

retest windows_debug_vs-integration_prtest please

@heejaechang
Copy link
Contributor Author

@AlekseyTs is on vacation. can @cston @jcouv take a look? I talked about the design with @AlekseyTs and following his suggestion.

IAssignmentExpression is now purely used as base interface, implementation only exist for SimpleAssignment and CompoundAssignment.

InncrementExpression no longer inherit from CompoundAssignment. and it is its own type.

IndexedPropertyReference and PropertyReference is merged and Argument return > 0 if it is indexed property.

@jinujoseph
Copy link
Contributor

cc @dotnet/roslyn-compiler

@heejaechang
Copy link
Contributor Author

ping? can I get one more sign off from compiler team

@@ -1,5 +1,9 @@
*REMOVED*Microsoft.CodeAnalysis.Compilation.Emit(System.IO.Stream peStream, System.IO.Stream pdbStream = null, System.IO.Stream xmlDocumentationStream = null, System.IO.Stream win32Resources = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ResourceDescription> manifestResources = null, Microsoft.CodeAnalysis.Emit.EmitOptions options = null, Microsoft.CodeAnalysis.IMethodSymbol debugEntryPoint = null, System.IO.Stream sourceLinkStream = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.EmbeddedText> embeddedTexts = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Emit.EmitResult
*REMOVED*Microsoft.CodeAnalysis.Emit.EmitOptions.EmitOptions(bool metadataOnly = false, Microsoft.CodeAnalysis.Emit.DebugInformationFormat debugInformationFormat = (Microsoft.CodeAnalysis.Emit.DebugInformationFormat)0, string pdbFilePath = null, string outputNameOverride = null, int fileAlignment = 0, ulong baseAddress = 0, bool highEntropyVirtualAddressSpace = false, Microsoft.CodeAnalysis.SubsystemVersion subsystemVersion = default(Microsoft.CodeAnalysis.SubsystemVersion), string runtimeMetadataVersion = null, bool tolerateErrors = false, bool includePrivateMembers = false, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Emit.InstrumentationKind> instrumentationKinds = default(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Emit.InstrumentationKind>)) -> void
*REMOVED*Microsoft.CodeAnalysis.Semantics.IAssignmentExpression.Target.get -> Microsoft.CodeAnalysis.IOperation
Copy link
Member

Choose a reason for hiding this comment

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

Did IOperations APIs previously ship?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me take a look. we did ship it under feature flag though

@@ -385,10 +385,29 @@ internal abstract partial class BaseAssignmentExpression : Operation, IAssignmen
/// <summary>
/// Represents an assignment expression.
Copy link
Member

Choose a reason for hiding this comment

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

// a simple assignment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

}

/// <summary>
/// Represents an assignment expression.
/// </summary>
internal sealed partial class LazyAssignmentExpression : BaseAssignmentExpression, IAssignmentExpression
internal sealed partial class LazySimpleAssignmentExpression : BaseSimpleAssignmentExpression, ISimpleAssignmentExpression
{
private readonly Lazy<IOperation> _lazyTarget;
Copy link
Member

Choose a reason for hiding this comment

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

As a general question about the lazy pattern in IOperations, why not just implement this as:
class Lazy { private readonly Lazy<SimpleAssignmentExpression>; ... }

Do we expect that the different lazy parts with materialized separately?
[not blocking this PR]

Copy link
Contributor Author

@heejaechang heejaechang Jun 29, 2017

Choose a reason for hiding this comment

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

we don't want to realize all children at some for example blocks.

by the way, this Lazy pattern is ver 1. so that we can share one implementation for both C# and VB. we might later move this to C#/VB explicit type that directly hold on to bound node that implements common IOperation interface for laziness. (more perf optimized version)

we decide this way since interface is the public API and implementation we can change later.

{
InitializedProperty = initializedProperty;
_lazyValue = value ?? throw new System.ArgumentNullException("value");
Copy link
Member

@jcouv jcouv Jun 29, 2017

Choose a reason for hiding this comment

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

nameof(value) instead of "value"
Same for other other instances of throw ArgumentNullException

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure.

@@ -182,9 +182,9 @@ public sealed override void Initialize(AnalysisContext context)
IOperation advanceIncrement = null;
BinaryOperationKind advanceOperationCode = BinaryOperationKind.None;

if (advanceExpression.Kind == OperationKind.AssignmentExpression)
if (advanceExpression.Kind == OperationKind.SimpleAssignmentExpression)
Copy link
Member

Choose a reason for hiding this comment

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

Not related to this PR, but this method is getting quite deep. Consider refactoring.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM

@heejaechang
Copy link
Contributor Author

@dotnet/roslyn-infrastructure windows_debug_vs-integration_prtest failed due to vsix installation.

looks like busted in multiple PR
https://ci.dot.net/job/dotnet_roslyn/job/features_ioperation/job/windows_debug_vs-integration_prtest/135/

@heejaechang heejaechang merged commit 7926277 into dotnet:features/ioperation Jun 30, 2017
@heejaechang
Copy link
Contributor Author

#8755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants