Skip to content

Commit e9bc60b

Browse files
Cleanup: Use named arguments in System.Xaml. (#10061)
Contributes to #10018
1 parent 674bafb commit e9bc60b

14 files changed

+32
-32
lines changed

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ internal XamlType ServiceProvider_ResolveXamlType(string qName)
168168

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

@@ -180,7 +180,7 @@ internal object ServiceProvider_GetFirstAmbientValue(XamlType[] types)
180180

181181
internal IEnumerable<AmbientPropertyValue> ServiceProvider_GetAllAmbientValues(IEnumerable<XamlType> ceilingTypes, XamlMember[] properties)
182182
{
183-
List<AmbientPropertyValue> valueList = FindAmbientValues(ceilingTypes, /*searchLiveStackOnly*/false, /*types*/null, properties, /*stopAfterFirst*/ false);
183+
List<AmbientPropertyValue> valueList = FindAmbientValues(ceilingTypes, searchLiveStackOnly: false, types: null, properties, stopAfterFirst: false);
184184
return valueList;
185185
}
186186

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private XamlRuntime CreateRuntime(XamlObjectWriterSettings settings, XamlSchemaC
129129
}
130130
if (result is null)
131131
{
132-
result = new ClrObjectRuntime(runtimeSettings, true /*isWriter*/);
132+
result = new ClrObjectRuntime(runtimeSettings, isWriter: true);
133133
}
134134
result.LineInfo = this;
135135
return result;
@@ -604,7 +604,7 @@ public override void WriteStartMember(XamlMember property)
604604

605605
// Duplicate Property Setting Check.
606606
//
607-
Logic_DuplicatePropertyCheck(_context, property, false /*onParent*/);
607+
Logic_DuplicatePropertyCheck(_context, property, onParent: false);
608608

609609
// If we haven't created the object yet then consider creating it now.
610610
// We need an object instance to set property values on.
@@ -1529,7 +1529,7 @@ private void Logic_ApplyCurrentPreconstructionPropertyValues(ObjectWriterContext
15291529
}
15301530
else
15311531
{
1532-
Logic_ApplyPropertyValue(ctx, prop, value, false /*onParent*/);
1532+
Logic_ApplyPropertyValue(ctx, prop, value, onParent: false);
15331533
}
15341534
}
15351535
}
@@ -2009,7 +2009,7 @@ private void Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)
20092009

20102010
if (!ctx.CurrentIsObjectFromMember)
20112011
{
2012-
Logic_ApplyPropertyValue(ctx, parentProperty, value, true /*onParent*/);
2012+
Logic_ApplyPropertyValue(ctx, parentProperty, value, onParent: true);
20132013

20142014
// registered a named object
20152015
if (parentProperty == parentType.GetAliasedProperty(XamlLanguage.Name))

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlTextReader.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContex
111111
_endOfStreamNode = new InternalNode(InternalNodeType.EndOfStream);
112112

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

116116
XamlScanner xamlScanner = new XamlScanner(_context, myXmlReader, _mergedSettings);
117117
XamlPullParser parser = new XamlPullParser(_context, xamlScanner, _mergedSettings);

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MeScanner.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ private void ResolvePropertyName(string longName)
321321

322322
if (propName.IsDotted)
323323
{
324-
prop = _context.GetDottedProperty(tagType, tagNamespace, propName, false /*tagIsRoot*/);
324+
prop = _context.GetDottedProperty(tagType, tagNamespace, propName, tagIsRoot: false);
325325
}
326326
// Regular property p
327327
else
328328
{
329329
string ns = _context.GetAttributeNamespace(propName, Namespace);
330330
declaringType = _context.CurrentType;
331-
prop = _context.GetNoDotAttributeProperty(declaringType, propName, Namespace, ns, false /*tagIsRoot*/);
331+
prop = _context.GetNoDotAttributeProperty(declaringType, propName, Namespace, ns, tagIsRoot: false);
332332
}
333333
_tokenProperty = prop;
334334
}

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlAttribute.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private XamlMember GetXamlAttributeProperty(XamlParserContext context, XamlPrope
152152
if (propName.IsDotted)
153153
{
154154
XamlType attachedOwnerType = new XamlType(string.Empty, propName.OwnerName, null, context.SchemaContext);
155-
unknownProperty = new XamlMember(propName.Name, attachedOwnerType, true /*isAttachable*/);
155+
unknownProperty = new XamlMember(propName.Name, attachedOwnerType, isAttachable: true);
156156
}
157157
else
158158
{

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/DynamicMethodRuntime.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ private Dictionary<Type, DelegateCreator> DelegateCreators
122122

123123
internal DynamicMethodRuntime(XamlRuntimeSettings settings, XamlSchemaContext schemaContext,
124124
XamlAccessLevel accessLevel)
125-
: base(settings, true /*isWriter*/)
125+
: base(settings, isWriter: true)
126126
{
127127
Debug.Assert(schemaContext is not null);
128128
Debug.Assert(accessLevel is not null);
129129
_schemaContext = schemaContext;
130130
_localAssembly = Assembly.Load(accessLevel.AssemblyAccessToAssemblyName);
131131
if (accessLevel.PrivateAccessToTypeName is not null)
132132
{
133-
_localType = _localAssembly.GetType(accessLevel.PrivateAccessToTypeName, true /*throwOnError*/);
133+
_localType = _localAssembly.GetType(accessLevel.PrivateAccessToTypeName, throwOnError: true);
134134
}
135135
}
136136

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/PartialTrustTolerantRuntime.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PartialTrustTolerantRuntime : XamlRuntime
3737

3838
public PartialTrustTolerantRuntime(XamlRuntimeSettings runtimeSettings, XamlAccessLevel accessLevel, XamlSchemaContext schemaContext)
3939
{
40-
_transparentRuntime = new ClrObjectRuntime(runtimeSettings, true /*isWriter*/);
40+
_transparentRuntime = new ClrObjectRuntime(runtimeSettings, isWriter: true);
4141
_accessLevel = accessLevel;
4242
_schemaContext = schemaContext;
4343
}

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/CollectionReflector.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ internal static XamlCollectionKind LookupCollectionKind(Type type, out MethodInf
6565
}
6666

6767
// If the type doesn't match any of the interfaces, check for Add methods
68-
if (TryGetDictionaryAdder(type, false /*mayBeIDictionary*/, out addMethod))
68+
if (TryGetDictionaryAdder(type, mayBeIDictionary: false, out addMethod))
6969
{
7070
return XamlCollectionKind.Dictionary;
7171
}
72-
if (TryGetCollectionAdder(type, false /*mayBeICollection*/, out addMethod))
72+
if (TryGetCollectionAdder(type, mayBeICollection: false, out addMethod))
7373
{
7474
return XamlCollectionKind.Collection;
7575
}
@@ -83,14 +83,14 @@ internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collect
8383
switch (collectionKind)
8484
{
8585
case XamlCollectionKind.Collection:
86-
bool isCollection = TryGetCollectionAdder(type, true /*mayBeICollection*/, out result);
86+
bool isCollection = TryGetCollectionAdder(type, mayBeICollection: true, out result);
8787
if (isCollection && result is null)
8888
{
8989
throw new XamlSchemaException(SR.Format(SR.AmbiguousCollectionItemType, type));
9090
}
9191
break;
9292
case XamlCollectionKind.Dictionary:
93-
bool isDictionary = TryGetDictionaryAdder(type, true /*mayBeIDictionary*/, out result);
93+
bool isDictionary = TryGetDictionaryAdder(type, mayBeIDictionary: true, out result);
9494
if (isDictionary && result is null)
9595
{
9696
throw new XamlSchemaException(SR.Format(SR.AmbiguousDictionaryItemType, type));

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public string GetAttributeString(Type attributeType, out bool checkedInherited)
6666
// Passes inherit=true for reasons explained in comment on XamlType.TryGetAttributeString
6767
checkedInherited = true;
6868

69-
object[] attributes = CustomAttributeProvider.GetCustomAttributes(attributeType, true /*inherit*/);
69+
object[] attributes = CustomAttributeProvider.GetCustomAttributes(attributeType, inherit: true);
7070
if (attributes.Length == 0)
7171
{
7272
return null;

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/TypeReflector.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -754,23 +754,23 @@ private List<MethodInfo> LookupStaticAdders(string name)
754754
string adderName = KnownStrings.Add + name + KnownStrings.Handler;
755755
MemberInfo[] adders = UnderlyingType.GetMember(adderName, MemberTypes.Method, AttachableProperties_BF);
756756
List<MethodInfo> preferredAdders, otherAdders;
757-
PrioritizeAccessors(adders, true /*isEvent*/, false /*isGetter*/, out preferredAdders, out otherAdders);
757+
PrioritizeAccessors(adders, isEvent: true, isGetter: false, out preferredAdders, out otherAdders);
758758
return preferredAdders ?? otherAdders;
759759
}
760760

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

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

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XmlNamespace.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public override XamlProperty GetDirectiveProperty(string name)
7575
if (directive == null)
7676
{
7777
directive = new UnknownProperty(name,
78-
null, /*declaringType - xml directives don't have one. */
78+
declaringType: null, /* xml directives don't have a declaring type. */
7979
XmlDirectives.Uri);
8080
}
8181
return directive;

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMember.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public XamlMember(PropertyInfo propertyInfo, XamlSchemaContext schemaContext)
4545
}
4646

4747
public XamlMember(PropertyInfo propertyInfo, XamlSchemaContext schemaContext, XamlMemberInvoker invoker)
48-
: this(propertyInfo, schemaContext, invoker, new MemberReflector(false /*isEvent*/))
48+
: this(propertyInfo, schemaContext, invoker, new MemberReflector(isEvent: false))
4949
{
5050
}
5151

@@ -68,7 +68,7 @@ public XamlMember(EventInfo eventInfo, XamlSchemaContext schemaContext)
6868
}
6969

7070
public XamlMember(EventInfo eventInfo, XamlSchemaContext schemaContext, XamlMemberInvoker invoker)
71-
:this(eventInfo, schemaContext, invoker, new MemberReflector(true /*isEvent*/))
71+
:this(eventInfo, schemaContext, invoker, new MemberReflector(isEvent: true))
7272
{
7373
}
7474

@@ -93,7 +93,7 @@ public XamlMember(string attachablePropertyName, MethodInfo getter, MethodInfo s
9393

9494
public XamlMember(string attachablePropertyName, MethodInfo getter, MethodInfo setter,
9595
XamlSchemaContext schemaContext, XamlMemberInvoker invoker)
96-
:this(attachablePropertyName, getter, setter, schemaContext, invoker, new MemberReflector(getter, setter, false /*isEvent*/))
96+
:this(attachablePropertyName, getter, setter, schemaContext, invoker, new MemberReflector(getter, setter, isEvent: false))
9797
{
9898
}
9999

@@ -126,7 +126,7 @@ public XamlMember(string attachableEventName, MethodInfo adder, XamlSchemaContex
126126

127127
public XamlMember(string attachableEventName, MethodInfo adder, XamlSchemaContext schemaContext,
128128
XamlMemberInvoker invoker)
129-
: this(attachableEventName, adder, schemaContext, invoker, new MemberReflector(null, adder, true /*isEvent*/))
129+
: this(attachableEventName, adder, schemaContext, invoker, new MemberReflector(null, adder, isEvent: true))
130130
{
131131
}
132132

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlObjectReader.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public static MemberMarkupInfo ForProperty(
529529

530530
static MemberMarkupInfo ForSequence(object source, XamlMember property, SerializerContext context, bool isAttachable)
531531
{
532-
var itemsInfo = ForSequenceItems(source, isAttachable ? null : property, property.Type, context, false /*allowReadOnly*/);
532+
var itemsInfo = ForSequenceItems(source, isAttachable ? null : property, property.Type, context, allowReadOnly: false);
533533
if (itemsInfo is not null && itemsInfo.Children.Count != 0)
534534
{
535535
return new MemberMarkupInfo
@@ -1197,7 +1197,7 @@ void AddItemsProperty(object value, SerializerContext context, XamlType xamlType
11971197
}
11981198
else if (xamlType.IsCollection)
11991199
{
1200-
propertyInfo = MemberMarkupInfo.ForSequenceItems(value, null, xamlType, context, true /*allowReadOnly*/);
1200+
propertyInfo = MemberMarkupInfo.ForSequenceItems(value, null, xamlType, context, allowReadOnly: true);
12011201
}
12021202

12031203
if (propertyInfo is not null && propertyInfo.Children.Count != 0)
@@ -2485,7 +2485,7 @@ public SerializerContext(XamlSchemaContext schemaContext, XamlObjectReaderSettin
24852485
prefixToNamespaceMap = new Dictionary<string, string>();
24862486
ReferenceTable = new ReferenceTable(null);
24872487
this.schemaContext = schemaContext;
2488-
runtime = new ClrObjectRuntime(null, false /*isWriter*/);
2488+
runtime = new ClrObjectRuntime(null, isWriter: false);
24892489
this.settings = settings;
24902490
}
24912491

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlType.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public XamlMember GetMember(string name)
334334
XamlMember result;
335335
if (!_reflector.Members.TryGetValue(name, out result) && !_reflector.Members.IsComplete)
336336
{
337-
result = LookupMember(name, false /*skipReadOnlyCheck*/);
337+
result = LookupMember(name, skipReadOnlyCheck: false);
338338
result = _reflector.Members.TryAdd(name, result);
339339
}
340340
return result;
@@ -755,7 +755,7 @@ protected virtual XamlMember LookupContentProperty()
755755
{
756756
return null;
757757
}
758-
return GetPropertyOrUnknown(contentPropertyName, false /*skipReadOnlyCheck*/);
758+
return GetPropertyOrUnknown(contentPropertyName, skipReadOnlyCheck: false);
759759
}
760760
if (BaseType is not null)
761761
{
@@ -1430,7 +1430,7 @@ private XamlMember GetPropertyOrUnknown(string propertyName, bool skipReadOnlyCh
14301430
XamlMember result = skipReadOnlyCheck ? LookupMember(propertyName, true) : GetMember(propertyName);
14311431
if (result is null)
14321432
{
1433-
result = new XamlMember(propertyName, this /*declaringType*/, false /*isAttachable*/);
1433+
result = new XamlMember(propertyName, declaringType: this, isAttachable: false);
14341434
}
14351435
return result;
14361436
}

0 commit comments

Comments
 (0)