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)
242synthesizedEntryPoint = new SynthesizedEntryPointSymbol.AsyncForwardEntryPoint(compilation, entryPoint.ContainingType, entryPoint);
246moduleBeingBuilt.AddSynthesizedDefinition(entryPoint.ContainingType, synthesizedEntryPoint.GetCciAdapter());
277new TypeCompilationState(synthesizedEntryPoint.ContainingType, compilation, moduleBeingBuilt),
919if (methodSymbol.IsAbstract || methodSymbol.ContainingType?.IsDelegateType() == true)
1045Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || methodSymbol.ContainingType.IsStructType());
1059((methodSymbol.ContainingType.IsStructType() && !methodSymbol.IsImplicitConstructor) ||
1475method.ContainingType,
1518method.ContainingType,
1536method.ContainingType,
2434Debug.Assert(!method.ContainingType.IsDelegateType());
2459if (ctorCall != null && !ctorCall.HasAnyErrors && ctorCall.Method != method && TypeSymbol.Equals(ctorCall.Method.ContainingType, method.ContainingType, TypeCompareKind.ConsiderEverything2))
FlowAnalysis\NullableWalker.cs (38)
663? method.ContainingType.GetMembersUnordered().SelectManyAsArray(
673foreach (var member in method.ContainingType.GetMembersUnordered())
688if (chainedConstructorEnforcesRequiredMembers && !constructorEnforcesRequiredMembers && method.ContainingType.BaseTypeNoUseSiteDiagnostics is { } baseType)
908&& (!method.ContainingType.IsValueType
912return membersToBeInitialized(method.ContainingType, includeAllMembers: true, includeCurrentTypeRequiredMembers, includeBaseRequiredMembers);
917return membersToBeInitialized(method.ContainingType, includeAllMembers: method.IncludeFieldInitializersInBody(), includeCurrentTypeRequiredMembers, includeBaseRequiredMembers);
1013foreach (var member in property.ContainingType.GetMembers(notNullMemberName))
1056foreach (var member in method.ContainingType.GetMembers(memberName))
1092enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: true, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenTrue, otherState: pendingReturn.StateWhenFalse);
1097enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: false, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenFalse, otherState: pendingReturn.StateWhenTrue);
1123foreach (var member in method.ContainingType.GetMembers(memberName))
1176var type = method.ContainingType;
1495&& method.ContainingType is SourceMemberContainerTypeSymbol containingType)
2249if ((constructor.IsStatic && containingSlot == 0 && constructor.ContainingType.Equals(symbol.ContainingType))
2709TypeSymbol possibleBase = possibleMember.ContainingType;
3761(FieldSymbol { ContainingType: { IsTupleType: true }, TupleElementIndex: var oi } originalField, FieldSymbol { ContainingType: { IsTupleType: true }, TupleElementIndex: var ui } updatedField) =>
4135var containingType = constructor?.ContainingType;
5256TypeSymbol methodContainer = method.ContainingType;
5636var containingType = this._symbol?.ContainingType;
6387Debug.Assert(node.Method.ContainingType.ExtensionParameter is not null);
6388annotations = node.Method.ContainingType.ExtensionParameter.FlowAnalysisAnnotations;
6506ParameterSymbol? extensionParameter = method.ContainingType.ExtensionParameter;
6540ParameterSymbol? extensionParameter = method.ContainingType.ExtensionParameter;
6629var wellKnownType = wellKnownMethod.ContainingType;
6650if (implementationMethod.ContainingType.IsInterface)
6681while (!baseType.Equals(implementationMethod.ContainingType) && method is object)
6683if (baseType.Equals(method.ContainingType))
6697if (method is object && baseType.Equals(method.ContainingType))
6822method.ContainingType.IsReferenceType)
7430var type = method.ContainingType;
8146definition.ContainingType,
8486var symbolContainer = symbol.ContainingType;
8498Debug.Assert(symbol.ContainingType.IsDefinition);
10137ParameterSymbol? receiverParameter = isNewExtensionMethod ? method.ContainingType.ExtensionParameter : method.Parameters[0];
10526var receiverParameter = isNewExtension ? deconstructMethod.ContainingType.ExtensionParameter : deconstructMethod.Parameters[0];
11166if ((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),