Binder\Binder.ValueChecks.cs (17)
68internal static MethodInfo Create(PropertySymbol property)
76internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1989var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2873case PropertySymbol property:
3843var indexerSymbol = indexerAccess.Indexer;
3858var indexerSymbol = indexerAccess.Indexer;
4118var indexerSymbol = indexerAccess.Indexer;
4142var indexerSymbol = indexerAccess.Indexer;
4230var propertySymbol = propertyAccess.PropertySymbol;
4483var indexerSymbol = indexerAccess.Indexer;
4498var indexerSymbol = indexerAccess.Indexer;
4889PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4890PropertySymbol property => getPropertyEscape(property, rightEscape),
4907PropertySymbol indexer,
4964PropertySymbol property,
5171var indexerSymbol = indexerAccess.Indexer;
5190var indexerSymbol = indexerAccess.Indexer;
Binder\Binder_Expressions.cs (45)
1567ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2191return BindPropertyAccess(node, receiver, (PropertySymbol)symbol, diagnostics, resultKind, hasErrors: isError);
6208PropertySymbol propertySymbol,
7738leftType = ((PropertySymbol)leftSymbol).Type;
8270case PropertySymbol propertySymbol:
8564resultType = ((PropertySymbol)symbolOpt).Type;
8718result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8877OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
9027static OverloadResolutionResult<PropertySymbol>? resolveProperties(
9034ArrayBuilder<PropertySymbol>? properties = null;
9037if (member is PropertySymbol property)
9039properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
9055OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9066OverloadResolutionResult<PropertySymbol> propertyResult,
9086PropertySymbol representativeProperty = propertyResult.PickRepresentativeMember();
9296PropertySymbol propertySymbol,
9576foreach (PropertySymbol property in members)
9912return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
10236ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
10240indexerGroup.Add((PropertySymbol)symbol);
10251private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10302private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10307var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10319ImmutableArray<PropertySymbol> applicableProperties,
10362ArrayBuilder<PropertySymbol> propertyGroup,
10367OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10402ArrayBuilder<PropertySymbol> propertyGroup,
10404OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10415ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10429var candidate = candidates[0];
10450PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10463MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10464PropertySymbol property = resolutionResult.Member;
10474this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10657candidate is PropertySymbol property &&
10667var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10774if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10794[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10806bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10822lookupResult.Symbols[0] is PropertySymbol property &&
10841private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10844var 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:
848case PropertySymbol { IsRequired: true }:
850case PropertySymbol:
963var prop = symbolToInitialize as PropertySymbol ?? (symbolToInitialize as FieldSymbol)?.AssociatedSymbol as PropertySymbol;
1000if (requiredMember is PropertySymbol { IsAbstract: true } abstractProperty)
1003&& isFilterableOverrideOfAbstractProperty((PropertySymbol)overridingMember))
1025var property = (PropertySymbol)requiredMember;
1050static bool isFilterableOverrideOfAbstractProperty(PropertySymbol property)
2101var propSymbol = propAccess.PropertySymbol;
2811if (method is SourcePropertyAccessorSymbol { AssociatedSymbol: PropertySymbol prop } && (object)backingField.AssociatedSymbol == prop)
4493ImmutableArray<ParameterSymbol> parameters = ((PropertySymbol?)symbol)?.Parameters ?? default;
4575argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4601if (symbol is not PropertySymbol { IsStatic: false } property
4937var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
4958static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
5969if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7416PropertySymbol? property,
10826private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10847var property = left switch
10900var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11646private ReinferenceResult<PropertySymbol> ReInferAndVisitExtensionPropertyAccess(BoundNode node, PropertySymbol property, BoundExpression receiver)
11667var property = node.PropertySymbol;
11673ReinferenceResult<PropertySymbol> reinferenceResult = ReInferAndVisitExtensionPropertyAccess(node, property, node.ReceiverOpt);
11713var indexer = node.Indexer;
11717indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11834var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
Generated\BoundNodes.xml.Generated.cs (54)
322public BoundPropertyEqualsValue(SyntaxNode syntax, PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
333public PropertySymbol Property { get; }
338public BoundPropertyEqualsValue Update(PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value)
2177public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2196public PropertySymbol? IsCompleted { get; }
2204public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
5526public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5537public PropertySymbol Property { get; }
5543public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5557public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5568public PropertySymbol Property { get; }
5574public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6170public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6179public ImmutableArray<PropertySymbol> Properties { get; }
6184public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7114public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7124public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7135public PropertySymbol Property { get; }
7140public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7438public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7455public PropertySymbol PropertySymbol { get; }
7462public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7512public 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)
7536public PropertySymbol Indexer { get; }
7544public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7549public 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)
7653public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7674public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7679public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
10966PropertySymbol property = this.VisitPropertySymbol(node.Property);
11307PropertySymbol? isCompleted = this.VisitPropertySymbol(node.IsCompleted);
11882PropertySymbol property = this.VisitPropertySymbol(node.Property);
11888PropertySymbol property = this.VisitPropertySymbol(node.Property);
12007ImmutableArray<PropertySymbol> properties = this.VisitSymbols<PropertySymbol>(node.Properties);
12176PropertySymbol property = this.VisitPropertySymbol(node.Property);
12237PropertySymbol propertySymbol = this.VisitPropertySymbol(node.PropertySymbol);
12251PropertySymbol indexer = this.VisitPropertySymbol(node.Indexer);
12252ImmutableArray<PropertySymbol> originalIndexersOpt = this.VisitSymbols<PropertySymbol>(node.OriginalIndexersOpt);
12278ImmutableArray<PropertySymbol> applicableIndexers = this.VisitSymbols<PropertySymbol>(node.ApplicableIndexers);
12557PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13266PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
14010PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14017PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14233ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14610PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14770PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14806PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14807ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14844ImmutableArray<PropertySymbol> applicableIndexers = GetUpdatedArray(node, node.ApplicableIndexers);
Symbols\Compilation_WellKnownMembers.cs (8)
251internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
257internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
336PropertySymbol property = (PropertySymbol)member;
1079internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1108protected override TypeSymbol GetPropertyType(PropertySymbol property)
1154protected override ImmutableArray<ParameterSymbol> GetParameters(PropertySymbol property)
1198protected 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;
4357PropertySymbol propertySymbol,
4442private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4461private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4664if (!((PropertySymbol)member).IsIndexer)
4840PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4866Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4877Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5129ImmutableArray<PropertySymbol>.Empty);
5153else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5211MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5245PropertySymbol addEqualityContract()
5255ImmutableArray<PropertySymbol>.Empty);
5257PropertySymbol equalityContract;
5267equalityContract = (PropertySymbol)existingEqualityContractProperty;
5304MethodSymbol 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),
525var listMember = (PropertySymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Count);
710var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
770static void addProperty(ArrayBuilder<Symbol> builder, PropertySymbol property)