Binder\Binder.ValueChecks.cs (17)
69internal static MethodInfo Create(PropertySymbol property)
77internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1940var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2831case PropertySymbol property:
3795var indexerSymbol = indexerAccess.Indexer;
3811var indexerSymbol = indexerAccess.Indexer;
4065var indexerSymbol = indexerAccess.Indexer;
4090var indexerSymbol = indexerAccess.Indexer;
4177var propertySymbol = propertyAccess.PropertySymbol;
4426var indexerSymbol = indexerAccess.Indexer;
4442var indexerSymbol = indexerAccess.Indexer;
4836PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4837PropertySymbol property => getPropertyEscape(property, rightEscape),
4854PropertySymbol indexer,
4911PropertySymbol property,
5113var indexerSymbol = indexerAccess.Indexer;
5133var 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);
6049PropertySymbol propertySymbol,
8047case PropertySymbol propertySymbol:
8337resultType = ((PropertySymbol)symbolOpt).Type;
8491result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8650OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
8797static OverloadResolutionResult<PropertySymbol>? resolveProperties(
8804ArrayBuilder<PropertySymbol>? properties = null;
8807if (member is PropertySymbol property)
8809properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
8825OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9015PropertySymbol propertySymbol,
9294foreach (PropertySymbol property in members)
9630return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
9954ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
9958indexerGroup.Add((PropertySymbol)symbol);
9969private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10020private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10025var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10037ImmutableArray<PropertySymbol> applicableProperties,
10080ArrayBuilder<PropertySymbol> propertyGroup,
10085OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10120ArrayBuilder<PropertySymbol> propertyGroup,
10122OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10133ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10147var candidate = candidates[0];
10168PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10181MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10182PropertySymbol property = resolutionResult.Member;
10192this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10375candidate is PropertySymbol property &&
10385var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10492if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10512[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10524bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10540lookupResult.Symbols[0] is PropertySymbol property &&
10559private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10562var 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) &&
7159PropertySymbol? property,
7164return VisitArguments<PropertySymbol>(node, arguments, refKindsOpt, parametersOpt: property is null ? default : property.Parameters, argsToParamsOpt, defaultArguments, expanded, invokedAsExtensionMethod: false).results;
10521private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10542var property = left switch
10595var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11337private (PropertySymbol updatedProperty, bool returnNotNull) ReInferAndVisitExtensionPropertyAccess(BoundNode node, PropertySymbol property, BoundExpression receiver)
11358var property = node.PropertySymbol;
11402var indexer = node.Indexer;
11406indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11517var 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)
5471public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5482public PropertySymbol Property { get; }
5488public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5502public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5513public PropertySymbol Property { get; }
5519public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6115public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6124public ImmutableArray<PropertySymbol> Properties { get; }
6129public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7013public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7023public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7034public PropertySymbol Property { get; }
7039public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7337public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7354public PropertySymbol PropertySymbol { get; }
7361public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7411public 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)
7435public PropertySymbol Indexer { get; }
7443public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7448public 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)
7552public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7573public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7578public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
10846PropertySymbol property = this.VisitPropertySymbol(node.Property);
11181PropertySymbol? 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);
13864PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13871PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14087ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14464PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14624PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14660PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14661ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14698ImmutableArray<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 } &&
2271var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2283PropertySymbol indexer = (PropertySymbol)symbol;
2333PropertySymbol indexer,
2336Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2370if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2581var propertySymbol = (PropertySymbol)symbol;
4350PropertySymbol propertySymbol,
4435private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4454private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4657if (!((PropertySymbol)member).IsIndexer)
4833PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4859Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4870Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5122ImmutableArray<PropertySymbol>.Empty);
5146else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5204MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5238PropertySymbol addEqualityContract()
5248ImmutableArray<PropertySymbol>.Empty);
5250PropertySymbol equalityContract;
5260equalityContract = (PropertySymbol)existingEqualityContractProperty;
5297MethodSymbol 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)