Binder\Binder.ValueChecks.cs (17)
68internal static MethodInfo Create(PropertySymbol property)
76internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1718var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2607case PropertySymbol property:
3571var indexerSymbol = indexerAccess.Indexer;
3593var indexerSymbol = indexerAccess.Indexer;
3870var indexerSymbol = indexerAccess.Indexer;
3901var indexerSymbol = indexerAccess.Indexer;
4012var propertySymbol = propertyAccess.PropertySymbol;
4272var indexerSymbol = indexerAccess.Indexer;
4294var indexerSymbol = indexerAccess.Indexer;
4721PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4722PropertySymbol property => getPropertyEscape(property, rightEscape),
4739PropertySymbol indexer,
4792PropertySymbol property,
5006var indexerSymbol = indexerAccess.Indexer;
5032var indexerSymbol = indexerAccess.Indexer;
Binder\Binder_Expressions.cs (42)
1513ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2213return BindPropertyAccess(node, receiver, (PropertySymbol)symbol, diagnostics, resultKind, hasErrors: isError);
6040PropertySymbol propertySymbol,
8038case PropertySymbol propertySymbol:
8331resultType = ((PropertySymbol)symbolOpt).Type;
8475result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8634OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
8781static OverloadResolutionResult<PropertySymbol>? resolveProperties(
8788ArrayBuilder<PropertySymbol>? properties = null;
8791if (member is PropertySymbol property)
8793properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
8809OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9053PropertySymbol propertySymbol,
9332foreach (PropertySymbol property in members)
9668return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
9992ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
9996indexerGroup.Add((PropertySymbol)symbol);
10007private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10058private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10063var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10075ImmutableArray<PropertySymbol> applicableProperties,
10118ArrayBuilder<PropertySymbol> propertyGroup,
10123OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10158ArrayBuilder<PropertySymbol> propertyGroup,
10160OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10171ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10185var candidate = candidates[0];
10206PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10219MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10220PropertySymbol property = resolutionResult.Member;
10230this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10413candidate is PropertySymbol property &&
10423var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10529if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10549[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10561bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10577lookupResult.Symbols[0] is PropertySymbol property &&
10596private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10599var 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)
5691if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7061PropertySymbol? property,
7066return VisitArguments<PropertySymbol>(node, arguments, refKindsOpt, parametersOpt: property is null ? default : property.Parameters, argsToParamsOpt, defaultArguments, expanded, invokedAsExtensionMethod: false).results;
10414private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10435var property = left switch
10488var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11127var property = node.PropertySymbol;
11184var indexer = node.Indexer;
11188indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11299var 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)
2126public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, bool hasErrors = false)
2139public PropertySymbol? IsCompleted { get; }
2145public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult)
5455public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5466public PropertySymbol Property { get; }
5472public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5486public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5497public PropertySymbol Property { get; }
5503public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6099public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6108public ImmutableArray<PropertySymbol> Properties { get; }
6113public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
6997public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7007public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7018public PropertySymbol Property { get; }
7023public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7321public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7338public PropertySymbol PropertySymbol { get; }
7345public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7395public 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)
7419public PropertySymbol Indexer { get; }
7427public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7432public 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)
7536public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7557public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7562public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
10828PropertySymbol property = this.VisitPropertySymbol(node.Property);
11163PropertySymbol? isCompleted = this.VisitPropertySymbol(node.IsCompleted);
11736PropertySymbol property = this.VisitPropertySymbol(node.Property);
11742PropertySymbol property = this.VisitPropertySymbol(node.Property);
11861ImmutableArray<PropertySymbol> properties = this.VisitSymbols<PropertySymbol>(node.Properties);
12025PropertySymbol property = this.VisitPropertySymbol(node.Property);
12086PropertySymbol propertySymbol = this.VisitPropertySymbol(node.PropertySymbol);
12100PropertySymbol indexer = this.VisitPropertySymbol(node.Indexer);
12101ImmutableArray<PropertySymbol> originalIndexersOpt = this.VisitSymbols<PropertySymbol>(node.OriginalIndexersOpt);
12127ImmutableArray<PropertySymbol> applicableIndexers = this.VisitSymbols<PropertySymbol>(node.ApplicableIndexers);
12406PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13121PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
13856PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13863PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14079ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14456PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14616PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14652PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14653ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14690ImmutableArray<PropertySymbol> applicableIndexers = GetUpdatedArray(node, node.ApplicableIndexers);
Symbols\Compilation_WellKnownMembers.cs (8)
245internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
251internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
330PropertySymbol property = (PropertySymbol)member;
1061internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1090protected override TypeSymbol GetPropertyType(PropertySymbol property)
1136protected override ImmutableArray<ParameterSymbol> GetParameters(PropertySymbol property)
1180protected override bool IsByRefProperty(PropertySymbol property)
Symbols\Source\SourceMemberContainerSymbol.cs (26)
1709else if (member is FieldSymbol { AssociatedSymbol: SourcePropertySymbolBase { PartialDefinitionPart: PropertySymbol definition } implementation } &&
2233var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2245PropertySymbol indexer = (PropertySymbol)symbol;
2295PropertySymbol indexer,
2298Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2332if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2572var propertySymbol = (PropertySymbol)symbol;
4348PropertySymbol propertySymbol,
4433private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4452private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4655if (!((PropertySymbol)member).IsIndexer)
4831PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4857Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4868Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5120ImmutableArray<PropertySymbol>.Empty);
5144else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5202MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5236PropertySymbol addEqualityContract()
5246ImmutableArray<PropertySymbol>.Empty);
5248PropertySymbol equalityContract;
5258equalityContract = (PropertySymbol)existingEqualityContractProperty;
5295MethodSymbol 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)