Binder\Binder.ValueChecks.cs (17)
69internal static MethodInfo Create(PropertySymbol property)
77internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1718var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2607case PropertySymbol property:
3573var indexerSymbol = indexerAccess.Indexer;
3595var indexerSymbol = indexerAccess.Indexer;
3879var indexerSymbol = indexerAccess.Indexer;
3910var indexerSymbol = indexerAccess.Indexer;
4021var propertySymbol = propertyAccess.PropertySymbol;
4288var indexerSymbol = indexerAccess.Indexer;
4310var indexerSymbol = indexerAccess.Indexer;
4762PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4763PropertySymbol property => getPropertyEscape(property, rightEscape),
4780PropertySymbol indexer,
4833PropertySymbol property,
5047var indexerSymbol = indexerAccess.Indexer;
5073var indexerSymbol = indexerAccess.Indexer;
Binder\Binder_Expressions.cs (42)
1513ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2215return BindPropertyAccess(node, receiver, (PropertySymbol)symbol, diagnostics, resultKind, hasErrors: isError);
6051PropertySymbol propertySymbol,
8049case PropertySymbol propertySymbol:
8339resultType = ((PropertySymbol)symbolOpt).Type;
8493result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8652OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
8799static OverloadResolutionResult<PropertySymbol>? resolveProperties(
8806ArrayBuilder<PropertySymbol>? properties = null;
8809if (member is PropertySymbol property)
8811properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
8827OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9017PropertySymbol propertySymbol,
9296foreach (PropertySymbol property in members)
9632return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
9956ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
9960indexerGroup.Add((PropertySymbol)symbol);
9971private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10022private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10027var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10039ImmutableArray<PropertySymbol> applicableProperties,
10082ArrayBuilder<PropertySymbol> propertyGroup,
10087OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10122ArrayBuilder<PropertySymbol> propertyGroup,
10124OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10135ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10149var candidate = candidates[0];
10170PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10183MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10184PropertySymbol property = resolutionResult.Member;
10194this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10377candidate is PropertySymbol property &&
10387var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10494if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10514[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10526bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10542lookupResult.Symbols[0] is PropertySymbol property &&
10561private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10564var candidate = propertyGroup[0];
FlowAnalysis\NullableWalker.cs (33)
670predicate: member => member is PropertySymbol { IsRequired: true },
673var property = (PropertySymbol)member;
748symbol = (Symbol?)(f.AssociatedSymbol as PropertySymbol) ?? f;
759case PropertySymbol p when forcePropertyAnalysis:
830case PropertySymbol { IsRequired: true }:
832case PropertySymbol:
945var prop = symbolToInitialize as PropertySymbol ?? (symbolToInitialize as FieldSymbol)?.AssociatedSymbol as PropertySymbol;
982if (requiredMember is PropertySymbol { IsAbstract: true } abstractProperty)
985&& isFilterableOverrideOfAbstractProperty((PropertySymbol)overridingMember))
1007var property = (PropertySymbol)requiredMember;
1032static bool isFilterableOverrideOfAbstractProperty(PropertySymbol property)
2082var propSymbol = propAccess.PropertySymbol;
2792if (method is SourcePropertyAccessorSymbol { AssociatedSymbol: PropertySymbol prop } && (object)backingField.AssociatedSymbol == prop)
4344((PropertySymbol?)symbol)?.Parameters ?? default, objectInitializer.ArgsToParamsOpt,
4403argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4728var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
4749static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
5760if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7158PropertySymbol? property,
7163return VisitArguments<PropertySymbol>(node, arguments, refKindsOpt, parametersOpt: property is null ? default : property.Parameters, argsToParamsOpt, defaultArguments, expanded, invokedAsExtensionMethod: false).results;
10520private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10541var property = left switch
10594var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11336private (PropertySymbol updatedProperty, bool returnNotNull) ReInferAndVisitExtensionPropertyAccess(BoundNode node, PropertySymbol property, BoundExpression receiver)
11357var property = node.PropertySymbol;
11401var indexer = node.Indexer;
11405indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11516var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
Generated\BoundNodes.xml.Generated.cs (54)
320public BoundPropertyEqualsValue(SyntaxNode syntax, PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
331public PropertySymbol Property { get; }
336public BoundPropertyEqualsValue Update(PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value)
2130public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, bool hasErrors = false)
2143public PropertySymbol? IsCompleted { get; }
2149public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult)
5463public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5474public PropertySymbol Property { get; }
5480public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5494public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5505public PropertySymbol Property { get; }
5511public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6107public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6116public ImmutableArray<PropertySymbol> Properties { get; }
6121public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7005public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7015public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7026public PropertySymbol Property { get; }
7031public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7329public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7346public PropertySymbol PropertySymbol { get; }
7353public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7403public BoundIndexerAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, AccessorKind accessorKind, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type, bool hasErrors = false)
7427public PropertySymbol Indexer { get; }
7435public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7440public BoundIndexerAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, AccessorKind accessorKind, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type)
7544public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7565public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7570public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
10836PropertySymbol property = this.VisitPropertySymbol(node.Property);
11171PropertySymbol? isCompleted = this.VisitPropertySymbol(node.IsCompleted);
11744PropertySymbol property = this.VisitPropertySymbol(node.Property);
11750PropertySymbol property = this.VisitPropertySymbol(node.Property);
11869ImmutableArray<PropertySymbol> properties = this.VisitSymbols<PropertySymbol>(node.Properties);
12033PropertySymbol property = this.VisitPropertySymbol(node.Property);
12094PropertySymbol propertySymbol = this.VisitPropertySymbol(node.PropertySymbol);
12108PropertySymbol indexer = this.VisitPropertySymbol(node.Indexer);
12109ImmutableArray<PropertySymbol> originalIndexersOpt = this.VisitSymbols<PropertySymbol>(node.OriginalIndexersOpt);
12135ImmutableArray<PropertySymbol> applicableIndexers = this.VisitSymbols<PropertySymbol>(node.ApplicableIndexers);
12414PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13106PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
13841PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13848PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14064ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14441PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14601PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14637PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14638ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14675ImmutableArray<PropertySymbol> applicableIndexers = GetUpdatedArray(node, node.ApplicableIndexers);
Symbols\Compilation_WellKnownMembers.cs (8)
247internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
253internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
332PropertySymbol property = (PropertySymbol)member;
1063internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1092protected override TypeSymbol GetPropertyType(PropertySymbol property)
1138protected override ImmutableArray<ParameterSymbol> GetParameters(PropertySymbol property)
1182protected override bool IsByRefProperty(PropertySymbol property)
Symbols\Source\SourceMemberContainerSymbol.cs (26)
1736else if (member is FieldSymbol { AssociatedSymbol: SourcePropertySymbolBase { PartialDefinitionPart: PropertySymbol definition } implementation } &&
2259var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2271PropertySymbol indexer = (PropertySymbol)symbol;
2321PropertySymbol indexer,
2324Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2358if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2618var propertySymbol = (PropertySymbol)symbol;
4405PropertySymbol propertySymbol,
4490private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4509private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4712if (!((PropertySymbol)member).IsIndexer)
4888PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4914Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4925Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5177ImmutableArray<PropertySymbol>.Empty);
5201else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5259MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5293PropertySymbol addEqualityContract()
5303ImmutableArray<PropertySymbol>.Empty);
5305PropertySymbol equalityContract;
5315equalityContract = (PropertySymbol)existingEqualityContractProperty;
5352MethodSymbol addThisEquals(PropertySymbol? equalityContract)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (16)
327(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__Count)!,
332(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__IsSynchronized)!,
337(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__SyncRoot)!,
347(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
353(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IsFixedSize)!,
358(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IsReadOnly)!,
405((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyCollection_T__Count)!).AsMember(iReadOnlyCollectionT),
410((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
416((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Count)!).AsMember(iCollectionT),
421((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__IsReadOnly)!).AsMember(iCollectionT),
451((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
518var listMember = (PropertySymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Count);
676var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
729static void addProperty(ArrayBuilder<Symbol> builder, PropertySymbol property)