Binder\Binder.ValueChecks.cs (17)
68internal static MethodInfo Create(PropertySymbol property)
76internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1685var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2512case PropertySymbol property:
3465var indexerSymbol = indexerAccess.Indexer;
3487var indexerSymbol = indexerAccess.Indexer;
3764var indexerSymbol = indexerAccess.Indexer;
3795var indexerSymbol = indexerAccess.Indexer;
3906var propertySymbol = propertyAccess.PropertySymbol;
4166var indexerSymbol = indexerAccess.Indexer;
4188var indexerSymbol = indexerAccess.Indexer;
4606PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4607PropertySymbol property => getPropertyEscape(property, rightEscape),
4624PropertySymbol indexer,
4677PropertySymbol property,
4891var indexerSymbol = indexerAccess.Indexer;
4917var indexerSymbol = indexerAccess.Indexer;
Binder\Binder_Expressions.cs (34)
1506ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2198return BindPropertyAccess(node, receiver, (PropertySymbol)symbol, diagnostics, resultKind, hasErrors: isError);
6021PropertySymbol propertySymbol,
8208resultType = ((PropertySymbol)symbolOpt).Type;
8341result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8706PropertySymbol propertySymbol,
8985foreach (PropertySymbol property in members)
9321return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
9645ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
9649indexerGroup.Add((PropertySymbol)symbol);
9660private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
9711private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
9716var properties = ArrayBuilder<PropertySymbol>.GetInstance();
9728ImmutableArray<PropertySymbol> applicableProperties,
9771ArrayBuilder<PropertySymbol> propertyGroup,
9776OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9811ArrayBuilder<PropertySymbol> propertyGroup,
9813OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
9824ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
9838var candidate = candidates[0];
9859PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
9872MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
9873PropertySymbol property = resolutionResult.Member;
9883this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10066candidate is PropertySymbol property &&
10076var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10180if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10200[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10212bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10228lookupResult.Symbols[0] is PropertySymbol property &&
10247private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10250var candidate = propertyGroup[0];
FlowAnalysis\NullableWalker.cs (29)
651predicate: member => member is PropertySymbol { IsRequired: true },
654var property = (PropertySymbol)member;
729symbol = (Symbol?)(f.AssociatedSymbol as PropertySymbol) ?? f;
740case PropertySymbol p when forcePropertyAnalysis:
811case PropertySymbol { IsRequired: true }:
813case PropertySymbol:
926var prop = symbolToInitialize as PropertySymbol ?? (symbolToInitialize as FieldSymbol)?.AssociatedSymbol as PropertySymbol;
963if (requiredMember is PropertySymbol { IsAbstract: true } abstractProperty)
966&& isFilterableOverrideOfAbstractProperty((PropertySymbol)overridingMember))
988var property = (PropertySymbol)requiredMember;
1013static bool isFilterableOverrideOfAbstractProperty(PropertySymbol property)
2041var propSymbol = propAccess.PropertySymbol;
4189((PropertySymbol?)symbol)?.Parameters ?? default, objectInitializer.ArgsToParamsOpt,
4248argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4571var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
4592static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
5545if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
6797PropertySymbol? property,
10060private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10081var property = left switch
10134var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
10738var property = node.PropertySymbol;
10765var indexer = node.Indexer;
10769indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
10879var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
Generated\BoundNodes.xml.Generated.cs (41)
339public BoundPropertyEqualsValue(SyntaxNode syntax, PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
350public PropertySymbol Property { get; }
355public BoundPropertyEqualsValue Update(PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value)
2141public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, bool hasErrors = false)
2154public PropertySymbol? IsCompleted { get; }
2160public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult)
5472public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5483public PropertySymbol Property { get; }
5489public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5503public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5514public PropertySymbol Property { get; }
5520public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6116public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6125public ImmutableArray<PropertySymbol> Properties { get; }
6130public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7014public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7024public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7035public PropertySymbol Property { get; }
7040public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7338public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7355public PropertySymbol PropertySymbol { get; }
7362public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7412public 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)
7436public PropertySymbol Indexer { get; }
7444public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7449public 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)
7553public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7574public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7579public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
12275PropertySymbol property = GetUpdatedSymbol(node, node.Property);
12990PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
13726PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13733PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13949ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14326PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14486PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14522PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14523ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14560ImmutableArray<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)
1698else if (member is FieldSymbol { AssociatedSymbol: SourcePropertySymbolBase { PartialDefinitionPart: PropertySymbol definition } implementation } &&
1751case PropertySymbol property:
2199var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2211PropertySymbol indexer = (PropertySymbol)symbol;
2238PropertySymbol indexer,
2241Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2275if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2335var propertySymbol = (PropertySymbol)symbol;
3922PropertySymbol propertySymbol,
4004private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4023private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4334PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4360Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4371Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
4619ImmutableArray<PropertySymbol>.Empty);
4643else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
4701MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
4735PropertySymbol addEqualityContract()
4745ImmutableArray<PropertySymbol>.Empty);
4747PropertySymbol equalityContract;
4757equalityContract = (PropertySymbol)existingEqualityContractProperty;
4794MethodSymbol addThisEquals(PropertySymbol? equalityContract)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (16)
326(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__Count)!,
331(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__IsSynchronized)!,
336(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__SyncRoot)!,
346(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
352(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IsFixedSize)!,
357(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IsReadOnly)!,
404((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyCollection_T__Count)!).AsMember(iReadOnlyCollectionT),
409((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
415((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Count)!).AsMember(iCollectionT),
420((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__IsReadOnly)!).AsMember(iCollectionT),
450((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
517var listMember = (PropertySymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Count);
675var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
728static void addProperty(ArrayBuilder<Symbol> builder, PropertySymbol property)