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,
8037case PropertySymbol propertySymbol:
8330resultType = ((PropertySymbol)symbolOpt).Type;
8474result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8633OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
8780static OverloadResolutionResult<PropertySymbol>? resolveProperties(
8787ArrayBuilder<PropertySymbol>? properties = null;
8790if (member is PropertySymbol property)
8792properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
8808OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9052PropertySymbol propertySymbol,
9331foreach (PropertySymbol property in members)
9667return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
9991ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
9995indexerGroup.Add((PropertySymbol)symbol);
10006private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10057private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10062var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10074ImmutableArray<PropertySymbol> applicableProperties,
10117ArrayBuilder<PropertySymbol> propertyGroup,
10122OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10157ArrayBuilder<PropertySymbol> propertyGroup,
10159OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10170ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10184var candidate = candidates[0];
10205PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10218MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10219PropertySymbol property = resolutionResult.Member;
10229this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10412candidate is PropertySymbol property &&
10422var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10528if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10548[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10560bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10576lookupResult.Symbols[0] is PropertySymbol property &&
10595private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10598var 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)
4284((PropertySymbol?)symbol)?.Parameters ?? default, objectInitializer.ArgsToParamsOpt,
4343argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4667var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
4688static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
5637if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7007PropertySymbol? property,
7012return VisitArguments<PropertySymbol>(node, arguments, refKindsOpt, parametersOpt: property is null ? default : property.Parameters, argsToParamsOpt, defaultArguments, expanded, invokedAsExtensionMethod: false).results;
10360private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
10381var property = left switch
10434var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
11073var property = node.PropertySymbol;
11130var indexer = node.Indexer;
11134indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
11245var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
Generated\BoundNodes.xml.Generated.cs (54)
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)
2145public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, bool hasErrors = false)
2158public PropertySymbol? IsCompleted { get; }
2164public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult)
5474public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5485public PropertySymbol Property { get; }
5491public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5505public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5516public PropertySymbol Property { get; }
5522public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6118public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6127public ImmutableArray<PropertySymbol> Properties { get; }
6132public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7016public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7026public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7037public PropertySymbol Property { get; }
7042public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7340public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7357public PropertySymbol PropertySymbol { get; }
7364public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7414public 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)
7438public PropertySymbol Indexer { get; }
7446public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7451public 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)
7555public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7576public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7581public 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);
11755PropertySymbol property = this.VisitPropertySymbol(node.Property);
11761PropertySymbol property = this.VisitPropertySymbol(node.Property);
11880ImmutableArray<PropertySymbol> properties = this.VisitSymbols<PropertySymbol>(node.Properties);
12044PropertySymbol property = this.VisitPropertySymbol(node.Property);
12105PropertySymbol propertySymbol = this.VisitPropertySymbol(node.PropertySymbol);
12119PropertySymbol indexer = this.VisitPropertySymbol(node.Indexer);
12120ImmutableArray<PropertySymbol> originalIndexersOpt = this.VisitSymbols<PropertySymbol>(node.OriginalIndexersOpt);
12146ImmutableArray<PropertySymbol> applicableIndexers = this.VisitSymbols<PropertySymbol>(node.ApplicableIndexers);
12425PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13140PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
13875PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13882PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14098ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14475PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14635PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14671PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14672ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
14709ImmutableArray<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)
4648if (!((PropertySymbol)member).IsIndexer)
4828PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
4854Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
4865Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5117ImmutableArray<PropertySymbol>.Empty);
5141else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5199MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5233PropertySymbol addEqualityContract()
5243ImmutableArray<PropertySymbol>.Empty);
5245PropertySymbol equalityContract;
5255equalityContract = (PropertySymbol)existingEqualityContractProperty;
5292MethodSymbol 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)