Binder\Binder.ValueChecks.cs (17)
69internal static MethodInfo Create(PropertySymbol property)
77internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1719var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2608case PropertySymbol property:
3572var indexerSymbol = indexerAccess.Indexer;
3594var indexerSymbol = indexerAccess.Indexer;
3871var indexerSymbol = indexerAccess.Indexer;
3902var indexerSymbol = indexerAccess.Indexer;
4013var propertySymbol = propertyAccess.PropertySymbol;
4273var indexerSymbol = indexerAccess.Indexer;
4295var indexerSymbol = indexerAccess.Indexer;
4722PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4723PropertySymbol property => getPropertyEscape(property, rightEscape),
4740PropertySymbol indexer,
4793PropertySymbol property,
5007var indexerSymbol = indexerAccess.Indexer;
5033var 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);
6042PropertySymbol propertySymbol,
8040case PropertySymbol propertySymbol:
8330resultType = ((PropertySymbol)symbolOpt).Type;
8484result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8643OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
8790static OverloadResolutionResult<PropertySymbol>? resolveProperties(
8797ArrayBuilder<PropertySymbol>? properties = null;
8800if (member is PropertySymbol property)
8802properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
8818OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9062PropertySymbol propertySymbol,
9341foreach (PropertySymbol property in members)
9677return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
10001ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
10005indexerGroup.Add((PropertySymbol)symbol);
10016private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10067private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10072var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10084ImmutableArray<PropertySymbol> applicableProperties,
10127ArrayBuilder<PropertySymbol> propertyGroup,
10132OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10167ArrayBuilder<PropertySymbol> propertyGroup,
10169OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10180ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10194var candidate = candidates[0];
10215PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10228MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10229PropertySymbol property = resolutionResult.Member;
10239this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10422candidate is PropertySymbol property &&
10432var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10538if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10558[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10570bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10586lookupResult.Symbols[0] is PropertySymbol property &&
10605private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10608var candidate = propertyGroup[0];
FlowAnalysis\NullableWalker.cs (31)
664predicate: member => member is PropertySymbol { IsRequired: true },
667var property = (PropertySymbol)member;
742symbol = (Symbol?)(f.AssociatedSymbol as PropertySymbol) ?? f;
753case PropertySymbol p when forcePropertyAnalysis:
824case PropertySymbol { IsRequired: true }:
826case PropertySymbol:
939var prop = symbolToInitialize as PropertySymbol ?? (symbolToInitialize as FieldSymbol)?.AssociatedSymbol as PropertySymbol;
976if (requiredMember is PropertySymbol { IsAbstract: true } abstractProperty)
979&& isFilterableOverrideOfAbstractProperty((PropertySymbol)overridingMember))
1001var property = (PropertySymbol)requiredMember;
1026static bool isFilterableOverrideOfAbstractProperty(PropertySymbol property)
2076var propSymbol = propAccess.PropertySymbol;
2786if (method is SourcePropertyAccessorSymbol { AssociatedSymbol: PropertySymbol prop } && (object)backingField.AssociatedSymbol == prop)
4338((PropertySymbol?)symbol)?.Parameters ?? default, objectInitializer.ArgsToParamsOpt,
4397argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4721var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
4742static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
5753if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7156PropertySymbol? property,
7161return VisitArguments<PropertySymbol>(node, arguments, refKindsOpt, parametersOpt: property is null ? default : property.Parameters, argsToParamsOpt, defaultArguments, expanded, invokedAsExtensionMethod: false).results;
10509private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10530var property = left switch
10583var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11327var property = node.PropertySymbol;
11384var indexer = node.Indexer;
11388indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11499var 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)
1709else if (member is FieldSymbol { AssociatedSymbol: SourcePropertySymbolBase { PartialDefinitionPart: PropertySymbol definition } implementation } &&
2232var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2244PropertySymbol indexer = (PropertySymbol)symbol;
2294PropertySymbol indexer,
2297Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2331if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2591var propertySymbol = (PropertySymbol)symbol;
4378PropertySymbol propertySymbol,
4463private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4482private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4685if (!((PropertySymbol)member).IsIndexer)
4861PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4887Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4898Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5150ImmutableArray<PropertySymbol>.Empty);
5174else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5232MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5266PropertySymbol addEqualityContract()
5276ImmutableArray<PropertySymbol>.Empty);
5278PropertySymbol equalityContract;
5288equalityContract = (PropertySymbol)existingEqualityContractProperty;
5325MethodSymbol 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)