public static bool Equals(ArgumentInfo left, ArgumentInfo right) { if (left == null) { return right == null; } return right != null && left.Name == right.Name && TypeEquals(left, right) && left.Direction == right.Direction; }
public override bool Equals(object obj) { ArgumentInfo operand = obj as ArgumentInfo; return(Equals(this, operand)); }
private static bool TypeEquals(ArgumentInfo left, ArgumentInfo right) { Fx.Assert(left != null && right != null, "both left and right must not be null."); if (left.versionlessAssemblyQualifiedTypeName == right.versionlessAssemblyQualifiedTypeName) { return true; } // // Try to determine if the two argument types are in fact the same due to one being a TypeForwardedTo type to the other. // When forwarded types are used, it is expected that all the assemblies involved in type forwarding to be always available, // whether during map calcuation, during implementation map rollup, or during merging of multiple maps. // if (left.Type != null && right.Type != null && left.Type == right.Type) { return true; } return false; }
bool TryMatchingArguments(DynamicUpdateMapEntry entry, Activity originalActivity, Activity currentActivity) { // now, let's try creating argument entries IList <ArgumentInfo> oldArguments = ArgumentInfo.List(originalActivity); this.nestedFinalizer.CreateArgumentEntries(entry, currentActivity.RuntimeArguments, oldArguments); if (entry.HasEnvironmentUpdates) { if (entry.EnvironmentUpdateMap.HasArgumentEntries) { foreach (EnvironmentUpdateMapEntry argumentEntry in entry.EnvironmentUpdateMap.ArgumentEntries) { if (!argumentEntry.IsAddition) { // if it is a matching argument pair, // let's add them to the lists for further matching process. RuntimeArgument originalArg = originalActivity.RuntimeArguments[argumentEntry.OldOffset]; RuntimeArgument updatedArg = currentActivity.RuntimeArguments[argumentEntry.NewOffset]; if (!this.TryPreparingArgumentExpressions(originalArg, updatedArg)) { return(false); } } } } // we need to also visit subtrees of Expressions of removed arguments IList <ArgumentInfo> newArgumentInfos = ArgumentInfo.List(currentActivity); foreach (RuntimeArgument oldRuntimeArgument in originalActivity.RuntimeArguments) { if (newArgumentInfos.IndexOf(new ArgumentInfo(oldRuntimeArgument)) == EnvironmentUpdateMapEntry.NonExistent) { // this is a removed argument. if (oldRuntimeArgument.IsBound && oldRuntimeArgument.BoundArgument.Expression != null && oldRuntimeArgument.BoundArgument.Expression.MemberOf == originalActivity.MemberOf) { // create an entry for removal of this expression this.privateMap.AddEntry(new DynamicUpdateMapEntry(oldRuntimeArgument.BoundArgument.Expression.InternalId, 0)); } } } DynamicUpdateMapBuilder.Finalizer.FillEnvironmentMapMemberCounts(entry.EnvironmentUpdateMap, currentActivity, originalActivity, oldArguments); this.argumentChangeDetected = true; } else if (currentActivity.RuntimeArguments != null && currentActivity.RuntimeArguments.Count > 0) { Fx.Assert(currentActivity.RuntimeArguments.Count == originalActivity.RuntimeArguments.Count, "RuntimeArguments.Count for both currentActivity and originalActivity must be equal."); // if we are here, we know RuntimeArguments matched between currentActivity and originalActivity // but we still need to prepare their Expressions for matching for (int i = 0; i < currentActivity.RuntimeArguments.Count; i++) { if (!this.TryPreparingArgumentExpressions(originalActivity.RuntimeArguments[i], currentActivity.RuntimeArguments[i])) { return(false); } } } if (entry.IsRuntimeUpdateBlocked) { entry.EnvironmentUpdateMap = null; } return(true); }