Skip to content

Commit

Permalink
Cleanup: Use named arguments in System.Xaml.
Browse files Browse the repository at this point in the history
Contributes to #10018
  • Loading branch information
ThomasGoulet73 committed Nov 13, 2024
1 parent 4c8dc80 commit ebae0b1
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ internal XamlType ServiceProvider_ResolveXamlType(string qName)

internal AmbientPropertyValue ServiceProvider_GetFirstAmbientValue(IEnumerable<XamlType> ceilingTypes, XamlMember[] properties)
{
List<AmbientPropertyValue> valueList = FindAmbientValues(ceilingTypes, /*searchLiveStackOnly*/false, /*types*/null, properties, true);
List<AmbientPropertyValue> valueList = FindAmbientValues(ceilingTypes, searchLiveStackOnly: false, types: null, properties, true);
return (valueList.Count == 0) ? null : valueList[0];
}

Expand All @@ -183,7 +183,7 @@ internal object ServiceProvider_GetFirstAmbientValue(XamlType[] types)

internal IEnumerable<AmbientPropertyValue> ServiceProvider_GetAllAmbientValues(IEnumerable<XamlType> ceilingTypes, XamlMember[] properties)
{
List<AmbientPropertyValue> valueList = FindAmbientValues(ceilingTypes, /*searchLiveStackOnly*/false, /*types*/null, properties, /*stopAfterFirst*/ false);
List<AmbientPropertyValue> valueList = FindAmbientValues(ceilingTypes, searchLiveStackOnly: false, types: null, properties, stopAfterFirst: false);
return valueList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private XamlRuntime CreateRuntime(XamlObjectWriterSettings settings, XamlSchemaC
}
if (result == null)
{
result = new ClrObjectRuntime(runtimeSettings, true /*isWriter*/);
result = new ClrObjectRuntime(runtimeSettings, isWriter: true);
}
result.LineInfo = this;
return result;
Expand Down Expand Up @@ -606,7 +606,7 @@ public override void WriteStartMember(XamlMember property)

// Duplicate Property Setting Check.
//
Logic_DuplicatePropertyCheck(_context, property, false /*onParent*/);
Logic_DuplicatePropertyCheck(_context, property, onParent: false);

// If we haven't created the object yet then consider creating it now.
// We need an object instance to set property values on.
Expand Down Expand Up @@ -1531,7 +1531,7 @@ private void Logic_ApplyCurrentPreconstructionPropertyValues(ObjectWriterContext
}
else
{
Logic_ApplyPropertyValue(ctx, prop, value, false /*onParent*/);
Logic_ApplyPropertyValue(ctx, prop, value, onParent: false);
}
}
}
Expand Down Expand Up @@ -2011,7 +2011,7 @@ private void Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)

if (!ctx.CurrentIsObjectFromMember)
{
Logic_ApplyPropertyValue(ctx, parentProperty, value, true /*onParent*/);
Logic_ApplyPropertyValue(ctx, parentProperty, value, onParent: true);

// registered a named object
if (parentProperty == parentType.GetAliasedProperty(XamlLanguage.Name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContex
_endOfStreamNode = new InternalNode(InternalNodeType.EndOfStream);

_context = (XamlParserContext)XamlContext.CreateContext(UsageMode.Parser, schemaContext,
_mergedSettings.LocalAssembly, false /*ignoreCanConvert*/);
_mergedSettings.LocalAssembly, ignoreCanConvert: false);

XamlScanner xamlScanner = new XamlScanner(_context, myXmlReader, _mergedSettings);
XamlPullParser parser = new XamlPullParser(_context, xamlScanner, _mergedSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ private void ResolvePropertyName(string longName)

if (propName.IsDotted)
{
prop = _context.GetDottedProperty(tagType, tagNamespace, propName, false /*tagIsRoot*/);
prop = _context.GetDottedProperty(tagType, tagNamespace, propName, tagIsRoot: false);
}
// Regular property p
else
{
string ns = _context.GetAttributeNamespace(propName, Namespace);
declaringType = _context.CurrentType;
prop = _context.GetNoDotAttributeProperty(declaringType, propName, Namespace, ns, false /*tagIsRoot*/);
prop = _context.GetNoDotAttributeProperty(declaringType, propName, Namespace, ns, tagIsRoot: false);
}
_tokenProperty = prop;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private XamlMember GetXamlAttributeProperty(XamlParserContext context, XamlPrope
if (propName.IsDotted)
{
XamlType attachedOwnerType = new XamlType(string.Empty, propName.OwnerName, null, context.SchemaContext);
unknownProperty = new XamlMember(propName.Name, attachedOwnerType, true /*isAttachable*/);
unknownProperty = new XamlMember(propName.Name, attachedOwnerType, isAttachable: true);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ private Dictionary<Type, DelegateCreator> DelegateCreators

internal DynamicMethodRuntime(XamlRuntimeSettings settings, XamlSchemaContext schemaContext,
XamlAccessLevel accessLevel)
: base(settings, true /*isWriter*/)
: base(settings, isWriter: true)
{
Debug.Assert(schemaContext != null);
Debug.Assert(accessLevel != null);
_schemaContext = schemaContext;
_localAssembly = Assembly.Load(accessLevel.AssemblyAccessToAssemblyName);
if (accessLevel.PrivateAccessToTypeName != null)
{
_localType = _localAssembly.GetType(accessLevel.PrivateAccessToTypeName, true /*throwOnError*/);
_localType = _localAssembly.GetType(accessLevel.PrivateAccessToTypeName, throwOnError: true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PartialTrustTolerantRuntime : XamlRuntime

public PartialTrustTolerantRuntime(XamlRuntimeSettings runtimeSettings, XamlAccessLevel accessLevel, XamlSchemaContext schemaContext)
{
_transparentRuntime = new ClrObjectRuntime(runtimeSettings, true /*isWriter*/);
_transparentRuntime = new ClrObjectRuntime(runtimeSettings, isWriter: true);
_accessLevel = accessLevel;
_schemaContext = schemaContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ internal static XamlCollectionKind LookupCollectionKind(Type type, out MethodInf
}

// If the type doesn't match any of the interfaces, check for Add methods
if (TryGetDictionaryAdder(type, false /*mayBeIDictionary*/, out addMethod))
if (TryGetDictionaryAdder(type, mayBeIDictionary: false, out addMethod))
{
return XamlCollectionKind.Dictionary;
}
if (TryGetCollectionAdder(type, false /*mayBeICollection*/, out addMethod))
if (TryGetCollectionAdder(type, mayBeICollection: false, out addMethod))
{
return XamlCollectionKind.Collection;
}
Expand All @@ -84,14 +84,14 @@ internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collect
switch (collectionKind)
{
case XamlCollectionKind.Collection:
bool isCollection = TryGetCollectionAdder(type, true /*mayBeICollection*/, out result);
bool isCollection = TryGetCollectionAdder(type, mayBeICollection: true, out result);
if (isCollection && result == null)
{
throw new XamlSchemaException(SR.Format(SR.AmbiguousCollectionItemType, type));
}
break;
case XamlCollectionKind.Dictionary:
bool isDictionary = TryGetDictionaryAdder(type, true /*mayBeIDictionary*/, out result);
bool isDictionary = TryGetDictionaryAdder(type, mayBeIDictionary: true, out result);
if (isDictionary && result == null)
{
throw new XamlSchemaException(SR.Format(SR.AmbiguousDictionaryItemType, type));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public string GetAttributeString(Type attributeType, out bool checkedInherited)
// Passes inherit=true for reasons explained in comment on XamlType.TryGetAttributeString
checkedInherited = true;

object[] attributes = CustomAttributeProvider.GetCustomAttributes(attributeType, true /*inherit*/);
object[] attributes = CustomAttributeProvider.GetCustomAttributes(attributeType, inherit: true);
if (attributes.Length == 0)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,23 +756,23 @@ private List<MethodInfo> LookupStaticAdders(string name)
string adderName = KnownStrings.Add + name + KnownStrings.Handler;
MemberInfo[] adders = UnderlyingType.GetMember(adderName, MemberTypes.Method, AttachableProperties_BF);
List<MethodInfo> preferredAdders, otherAdders;
PrioritizeAccessors(adders, true /*isEvent*/, false /*isGetter*/, out preferredAdders, out otherAdders);
PrioritizeAccessors(adders, isEvent: true, isGetter: false, out preferredAdders, out otherAdders);
return preferredAdders ?? otherAdders;
}

private List<MethodInfo> LookupStaticGetters(string name)
{
MemberInfo[] getters = UnderlyingType.GetMember(KnownStrings.Get + name, MemberTypes.Method, AttachableProperties_BF);
List<MethodInfo> preferredGetters, otherGetters;
PrioritizeAccessors(getters, false /*isEvent*/, true /*isGetter*/, out preferredGetters, out otherGetters);
PrioritizeAccessors(getters, isEvent: false, isGetter: true, out preferredGetters, out otherGetters);
return preferredGetters ?? otherGetters;
}

private List<MethodInfo> LookupStaticSetters(string name)
{
MemberInfo[] setters = UnderlyingType.GetMember(KnownStrings.Set + name, MemberTypes.Method, AttachableProperties_BF);
List<MethodInfo> preferredSetters, otherSetters;
PrioritizeAccessors(setters, false /*isEvent*/, false /*isGetter*/, out preferredSetters, out otherSetters);
PrioritizeAccessors(setters, isEvent: false, isGetter: false, out preferredSetters, out otherSetters);
return preferredSetters ?? otherSetters;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override XamlProperty GetDirectiveProperty(string name)
if (directive == null)
{
directive = new UnknownProperty(name,
null, /*declaringType - xml directives don't have one. */
declaringType: null, /* xml directives don't have a declaring type. */
XmlDirectives.Uri);
}
return directive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public XamlMember(PropertyInfo propertyInfo, XamlSchemaContext schemaContext)
}

public XamlMember(PropertyInfo propertyInfo, XamlSchemaContext schemaContext, XamlMemberInvoker invoker)
: this(propertyInfo, schemaContext, invoker, new MemberReflector(false /*isEvent*/))
: this(propertyInfo, schemaContext, invoker, new MemberReflector(isEvent: false))
{
}

Expand All @@ -71,7 +71,7 @@ public XamlMember(EventInfo eventInfo, XamlSchemaContext schemaContext)
}

public XamlMember(EventInfo eventInfo, XamlSchemaContext schemaContext, XamlMemberInvoker invoker)
:this(eventInfo, schemaContext, invoker, new MemberReflector(true /*isEvent*/))
:this(eventInfo, schemaContext, invoker, new MemberReflector(isEvent: true))
{
}

Expand All @@ -96,7 +96,7 @@ public XamlMember(string attachablePropertyName, MethodInfo getter, MethodInfo s

public XamlMember(string attachablePropertyName, MethodInfo getter, MethodInfo setter,
XamlSchemaContext schemaContext, XamlMemberInvoker invoker)
:this(attachablePropertyName, getter, setter, schemaContext, invoker, new MemberReflector(getter, setter, false /*isEvent*/))
:this(attachablePropertyName, getter, setter, schemaContext, invoker, new MemberReflector(getter, setter, isEvent: false))
{
}

Expand Down Expand Up @@ -129,7 +129,7 @@ public XamlMember(string attachableEventName, MethodInfo adder, XamlSchemaContex

public XamlMember(string attachableEventName, MethodInfo adder, XamlSchemaContext schemaContext,
XamlMemberInvoker invoker)
: this(attachableEventName, adder, schemaContext, invoker, new MemberReflector(null, adder, true /*isEvent*/))
: this(attachableEventName, adder, schemaContext, invoker, new MemberReflector(null, adder, isEvent: true))
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public static MemberMarkupInfo ForProperty(

static MemberMarkupInfo ForSequence(object source, XamlMember property, SerializerContext context, bool isAttachable)
{
var itemsInfo = ForSequenceItems(source, isAttachable ? null : property, property.Type, context, false /*allowReadOnly*/);
var itemsInfo = ForSequenceItems(source, isAttachable ? null : property, property.Type, context, allowReadOnly: false);
if (itemsInfo != null && itemsInfo.Children.Count != 0)
{
return new MemberMarkupInfo
Expand Down Expand Up @@ -1202,7 +1202,7 @@ void AddItemsProperty(object value, SerializerContext context, XamlType xamlType
}
else if (xamlType.IsCollection)
{
propertyInfo = MemberMarkupInfo.ForSequenceItems(value, null, xamlType, context, true /*allowReadOnly*/);
propertyInfo = MemberMarkupInfo.ForSequenceItems(value, null, xamlType, context, allowReadOnly: true);
}

if (propertyInfo != null && propertyInfo.Children.Count != 0)
Expand Down Expand Up @@ -2490,7 +2490,7 @@ public SerializerContext(XamlSchemaContext schemaContext, XamlObjectReaderSettin
prefixToNamespaceMap = new Dictionary<string, string>();
ReferenceTable = new ReferenceTable(null);
this.schemaContext = schemaContext;
runtime = new ClrObjectRuntime(null, false /*isWriter*/);
runtime = new ClrObjectRuntime(null, isWriter: false);
this.settings = settings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public XamlMember GetMember(string name)
XamlMember result;
if (!_reflector.Members.TryGetValue(name, out result) && !_reflector.Members.IsComplete)
{
result = LookupMember(name, false /*skipReadOnlyCheck*/);
result = LookupMember(name, skipReadOnlyCheck: false);
result = _reflector.Members.TryAdd(name, result);
}
return result;
Expand Down Expand Up @@ -758,7 +758,7 @@ protected virtual XamlMember LookupContentProperty()
{
return null;
}
return GetPropertyOrUnknown(contentPropertyName, false /*skipReadOnlyCheck*/);
return GetPropertyOrUnknown(contentPropertyName, skipReadOnlyCheck: false);
}
if (BaseType != null)
{
Expand Down Expand Up @@ -1433,7 +1433,7 @@ private XamlMember GetPropertyOrUnknown(string propertyName, bool skipReadOnlyCh
XamlMember result = skipReadOnlyCheck ? LookupMember(propertyName, true) : GetMember(propertyName);
if (result == null)
{
result = new XamlMember(propertyName, this /*declaringType*/, false /*isAttachable*/);
result = new XamlMember(propertyName, declaringType: this, isAttachable: false);
}
return result;
}
Expand Down

0 comments on commit ebae0b1

Please # to comment.