Binder\Binder.ValueChecks.cs (17)
69internal static MethodInfo Create(PropertySymbol property)
77internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1942var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2833case PropertySymbol property:
3808var indexerSymbol = indexerAccess.Indexer;
3824var indexerSymbol = indexerAccess.Indexer;
4088var indexerSymbol = indexerAccess.Indexer;
4113var indexerSymbol = indexerAccess.Indexer;
4205var propertySymbol = propertyAccess.PropertySymbol;
4459var indexerSymbol = indexerAccess.Indexer;
4475var indexerSymbol = indexerAccess.Indexer;
4874PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4875PropertySymbol property => getPropertyEscape(property, rightEscape),
4892PropertySymbol indexer,
4949PropertySymbol property,
5156var indexerSymbol = indexerAccess.Indexer;
5176var indexerSymbol = indexerAccess.Indexer;
Binder\Binder_Expressions.cs (42)
1536ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2238return BindPropertyAccess(node, receiver, (PropertySymbol)symbol, diagnostics, resultKind, hasErrors: isError);
6079PropertySymbol propertySymbol,
8078case PropertySymbol propertySymbol:
8368resultType = ((PropertySymbol)symbolOpt).Type;
8522result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8681OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
8828static OverloadResolutionResult<PropertySymbol>? resolveProperties(
8835ArrayBuilder<PropertySymbol>? properties = null;
8838if (member is PropertySymbol property)
8840properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
8856OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9046PropertySymbol propertySymbol,
9325foreach (PropertySymbol property in members)
9661return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
9985ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
9989indexerGroup.Add((PropertySymbol)symbol);
10000private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10051private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10056var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10068ImmutableArray<PropertySymbol> applicableProperties,
10111ArrayBuilder<PropertySymbol> propertyGroup,
10116OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10151ArrayBuilder<PropertySymbol> propertyGroup,
10153OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10164ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10178var candidate = candidates[0];
10199PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10212MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10213PropertySymbol property = resolutionResult.Member;
10223this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10406candidate is PropertySymbol property &&
10416var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10523if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10543[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10555bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10571lookupResult.Symbols[0] is PropertySymbol property &&
10590private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10593var candidate = propertyGroup[0];
FlowAnalysis\NullableWalker.cs (34)
687predicate: member => member is PropertySymbol { IsRequired: true },
690var property = (PropertySymbol)member;
765symbol = (Symbol?)(f.AssociatedSymbol as PropertySymbol) ?? f;
776case PropertySymbol p when forcePropertyAnalysis:
847case PropertySymbol { IsRequired: true }:
849case PropertySymbol:
962var prop = symbolToInitialize as PropertySymbol ?? (symbolToInitialize as FieldSymbol)?.AssociatedSymbol as PropertySymbol;
999if (requiredMember is PropertySymbol { IsAbstract: true } abstractProperty)
1002&& isFilterableOverrideOfAbstractProperty((PropertySymbol)overridingMember))
1024var property = (PropertySymbol)requiredMember;
1049static bool isFilterableOverrideOfAbstractProperty(PropertySymbol property)
2100var propSymbol = propAccess.PropertySymbol;
2810if (method is SourcePropertyAccessorSymbol { AssociatedSymbol: PropertySymbol prop } && (object)backingField.AssociatedSymbol == prop)
4359((PropertySymbol?)symbol)?.Parameters ?? default, objectInitializer.ArgsToParamsOpt,
4418argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4444if (symbol is not PropertySymbol { IsStatic: false } property
4780var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
4801static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
5812if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7252PropertySymbol? property,
7257return VisitArguments<PropertySymbol>(node, arguments, refKindsOpt, parametersOpt: property is null ? default : property.Parameters, argsToParamsOpt, defaultArguments, expanded, invokedAsExtensionMethod: false).results;
10660private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10681var property = left switch
10734var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11472private (PropertySymbol updatedProperty, bool returnNotNull) ReInferAndVisitExtensionPropertyAccess(BoundNode node, PropertySymbol property, BoundExpression receiver)
11493var property = node.PropertySymbol;
11537var indexer = node.Indexer;
11541indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11652var 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, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2149public PropertySymbol? IsCompleted { get; }
2157public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
5469public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5480public PropertySymbol Property { get; }
5486public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5500public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5511public PropertySymbol Property { get; }
5517public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6113public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6122public ImmutableArray<PropertySymbol> Properties { get; }
6127public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7015public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7025public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7036public PropertySymbol Property { get; }
7041public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7339public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7356public PropertySymbol PropertySymbol { get; }
7363public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7413public 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)
7437public PropertySymbol Indexer { get; }
7445public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7450public 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)
7554public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7575public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7580public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
10847PropertySymbol property = this.VisitPropertySymbol(node.Property);
11182PropertySymbol? isCompleted = this.VisitPropertySymbol(node.IsCompleted);
11757PropertySymbol property = this.VisitPropertySymbol(node.Property);
11763PropertySymbol property = this.VisitPropertySymbol(node.Property);
11882ImmutableArray<PropertySymbol> properties = this.VisitSymbols<PropertySymbol>(node.Properties);
12046PropertySymbol property = this.VisitPropertySymbol(node.Property);
12107PropertySymbol propertySymbol = this.VisitPropertySymbol(node.PropertySymbol);
12121PropertySymbol indexer = this.VisitPropertySymbol(node.Indexer);
12122ImmutableArray<PropertySymbol> originalIndexersOpt = this.VisitSymbols<PropertySymbol>(node.OriginalIndexersOpt);
12148ImmutableArray<PropertySymbol> applicableIndexers = this.VisitSymbols<PropertySymbol>(node.ApplicableIndexers);
12427PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13119PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
13863PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13870PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14086ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14463PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14623PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14659PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14660ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14697ImmutableArray<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;
1075internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1104protected override TypeSymbol GetPropertyType(PropertySymbol property)
1150protected override ImmutableArray<ParameterSymbol> GetParameters(PropertySymbol property)
1194protected override bool IsByRefProperty(PropertySymbol property)
Symbols\Source\SourceMemberContainerSymbol.cs (26)
1749else if (member is FieldSymbol { AssociatedSymbol: SourcePropertySymbolBase { PartialDefinitionPart: PropertySymbol definition } implementation } &&
2272var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2284PropertySymbol indexer = (PropertySymbol)symbol;
2334PropertySymbol indexer,
2337Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2371if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2582var propertySymbol = (PropertySymbol)symbol;
4351PropertySymbol propertySymbol,
4436private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4455private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4658if (!((PropertySymbol)member).IsIndexer)
4834PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4860Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4871Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5123ImmutableArray<PropertySymbol>.Empty);
5147else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5205MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5239PropertySymbol addEqualityContract()
5249ImmutableArray<PropertySymbol>.Empty);
5251PropertySymbol equalityContract;
5261equalityContract = (PropertySymbol)existingEqualityContractProperty;
5298MethodSymbol 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)