Binder\Binder_Expressions.cs (15)
56var containingType = memberOpt?.ContainingType;
1483var implicitReceiver = field.IsStatic ? null : ThisReference(node, field.ContainingType, wasCompilerGenerated: true);
2305NamedTypeSymbol declaringType = member.ContainingType;
4827NamedTypeSymbol containingType = constructor.ContainingType;
4987NamedTypeSymbol baseType = constructor.ContainingType.BaseTypeNoUseSiteDiagnostics;
5112if (resultMember is null || resultMember.ContainingType.SpecialType != SpecialType.System_Object)
5159return constructor.ContainingType is SourceNamedTypeSymbol sourceType &&
6136constructor.ContainingType.HasRequiredMembersError) // An error will be reported on the constructor if from source, or a use-site diagnostic will be reported on the use if from metadata.
6141return constructor.ContainingType.AllRequiredMembers;
6655this.IsSymbolAccessibleConditional(constructor, containingType, ref useSiteInfo, constructor.ContainingType);
8038Debug.Assert(propertySymbol.ContainingType.ExtensionParameter is not null);
8042receiver = CheckAndConvertExtensionReceiver(receiver, propertySymbol.ContainingType.ExtensionParameter, diagnostics);
8899NamedTypeSymbol type = fieldSymbol.ContainingType;
9072if (symbol.ContainingType?.IsInterface == true)
10599return new ErrorPropertySymbol(candidate.ContainingType, propertyType, candidate.Name, candidate.IsIndexer, candidate.IsIndexedProperty);
Binder\Binder_Invocation.cs (7)
1066if (call.ReceiverOpt.Type.IsRestrictedType() && !call.Method.ContainingType.IsInterface && !TypeSymbol.Equals(call.Method.ContainingType, call.ReceiverOpt.Type, TypeCompareKind.ConsiderEverything2))
1068SymbolDistinguisher distinguisher = new SymbolDistinguisher(compilation, call.ReceiverOpt.Type, call.Method.ContainingType);
1074SymbolDistinguisher distinguisher = new SymbolDistinguisher(compilation, this.ContainingType, call.Method.ContainingType);
1291receiver = CheckAndConvertExtensionReceiver(receiver, method.ContainingType.ExtensionParameter, diagnostics);
1844TypeSymbol.Equals(containingMethod.ContainingType, method.ContainingType, TypeCompareKind.ConsiderEverything) &&
BoundTree\Constructors.cs (3)
62!fieldSymbol.ContainingType.IsValueType ||
254: this(syntax, constructor, ImmutableArray.Create<BoundExpression>(arguments), default(ImmutableArray<string?>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType)
258: this(syntax, constructor, arguments, default(ImmutableArray<string?>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType)
Compiler\MethodCompiler.cs (12)
243synthesizedEntryPoint = new SynthesizedEntryPointSymbol.AsyncForwardEntryPoint(compilation, entryPoint.ContainingType, entryPoint);
247moduleBeingBuilt.AddSynthesizedDefinition(entryPoint.ContainingType, synthesizedEntryPoint.GetCciAdapter());
278new TypeCompilationState(synthesizedEntryPoint.ContainingType, compilation, moduleBeingBuilt),
920if (methodSymbol.IsAbstract || methodSymbol.ContainingType?.IsDelegateType() == true)
1046Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || methodSymbol.ContainingType.IsStructType());
1060((methodSymbol.ContainingType.IsStructType() && !methodSymbol.IsImplicitConstructor) ||
1476method.ContainingType,
1519method.ContainingType,
1537method.ContainingType,
2435Debug.Assert(!method.ContainingType.IsDelegateType());
2460if (ctorCall != null && !ctorCall.HasAnyErrors && ctorCall.Method != method && TypeSymbol.Equals(ctorCall.Method.ContainingType, method.ContainingType, TypeCompareKind.ConsiderEverything2))
FlowAnalysis\NullableWalker.cs (32)
659? method.ContainingType.GetMembersUnordered().SelectManyAsArray(
669foreach (var member in method.ContainingType.GetMembersUnordered())
684if (chainedConstructorEnforcesRequiredMembers && !constructorEnforcesRequiredMembers && method.ContainingType.BaseTypeNoUseSiteDiagnostics is { } baseType)
904&& (!method.ContainingType.IsValueType
908return membersToBeInitialized(method.ContainingType, includeAllMembers: true, includeCurrentTypeRequiredMembers, includeBaseRequiredMembers);
913return membersToBeInitialized(method.ContainingType, includeAllMembers: method.IncludeFieldInitializersInBody(), includeCurrentTypeRequiredMembers, includeBaseRequiredMembers);
1009foreach (var member in property.ContainingType.GetMembers(notNullMemberName))
1052foreach (var member in method.ContainingType.GetMembers(memberName))
1088enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: true, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenTrue, otherState: pendingReturn.StateWhenFalse);
1093enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: false, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenFalse, otherState: pendingReturn.StateWhenTrue);
1119foreach (var member in method.ContainingType.GetMembers(memberName))
1172var type = method.ContainingType;
1480&& method.ContainingType is SourceMemberContainerTypeSymbol containingType)
2234if ((constructor.IsStatic && containingSlot == 0 && constructor.ContainingType.Equals(symbol.ContainingType))
2694TypeSymbol possibleBase = possibleMember.ContainingType;
3745(FieldSymbol { ContainingType: { IsTupleType: true }, TupleElementIndex: var oi } originalField, FieldSymbol { ContainingType: { IsTupleType: true }, TupleElementIndex: var ui } updatedField) =>
4119var containingType = constructor?.ContainingType;
5240TypeSymbol methodContainer = method.ContainingType;
5625var containingType = this._symbol?.ContainingType;
6513var wellKnownType = wellKnownMethod.ContainingType;
6534if (implementationMethod.ContainingType.IsInterface)
6565while (!baseType.Equals(implementationMethod.ContainingType) && method is object)
6567if (baseType.Equals(method.ContainingType))
6581if (method is object && baseType.Equals(method.ContainingType))
6701method.ContainingType.IsReferenceType)
7304var type = method.ContainingType;
8017definition.ContainingType,
8353var symbolContainer = symbol.ContainingType;
8365Debug.Assert(symbol.ContainingType.IsDefinition);
10989if ((object)getMethod != null && getMethod.ContainingType.SpecialType == SpecialType.System_Nullable_T)
Lowering\DiagnosticsPass_ExpressionTrees.cs (2)
278Binder.ReportDiagnosticsIfObsolete(_diagnostics, node.EventSymbol.AssociatedField, node.Syntax, hasBaseReceiver, _containingSymbol, _containingSymbol.ContainingType, BinderFlags.None);
292Binder.ReportDiagnosticsIfObsolete(_diagnostics, node.Event, ((AssignmentExpressionSyntax)node.Syntax).Left, hasBaseReceiver, _containingSymbol, _containingSymbol.ContainingType, BinderFlags.None);
Lowering\SyntheticBoundNodeFactory.cs (9)
76_currentType = value.ContainingType;
104: this(topLevelMethod, topLevelMethod.ContainingType, node, compilationState, diagnostics, instrumentationState)
134Debug.Assert(TopLevelMethod is null || TypeSymbol.Equals(TopLevelMethod.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2));
143TypeSymbol.Equals(CurrentFunction.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2));
774constructor.ContainingType)
1320GetMethodFromHandleMethod(ctor.ContainingType, constructorInfo),
1419if (!method.ContainingType.IsValueType || !Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.MayUseCallForStructMethod(method))
1427GetMethodFromHandleMethod(method.ContainingType, systemReflectionMethodInfo),
1443GetFieldFromHandleMethod(field.ContainingType),