Base:
property
ContainingType
Microsoft.CodeAnalysis.CSharp.Symbol.ContainingType
157 references to ContainingType
Microsoft.CodeAnalysis.CSharp (133)
Lowering\ClosureConversion\ClosureConversion.cs (1)
1497
translatedLambdaContainer = synthesizedMethod.
ContainingType
;
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
54
var lambdaFrame =
ContainingType
as SynthesizedClosureEnvironment;
Lowering\SynthesizedMethodBaseSymbol.cs (1)
76
if (
ContainingType
.IsImplicitlyDeclared)
Symbols\Source\SourceConstructorSymbol.cs (6)
114
bool isInterface =
ContainingType
.IsInterface;
125
ContainingType
.Name == ((ConstructorDeclarationSyntax)this.SyntaxNode).Identifier.ValueText)
151
else if (
ContainingType
.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride)
153
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(
ContainingType
), location, this);
155
else if (
ContainingType
.IsStatic && methodKind == MethodKind.Constructor)
178
((SourceMemberContainerTypeSymbol)
ContainingType
).IsNullableEnabledForConstructorsAndInitializers(IsStatic);
Symbols\Source\SourceConstructorSymbolBase.cs (4)
67
ContainingType
.Name == ((ConstructorDeclarationSyntax)this.SyntaxNode).Identifier.ValueText)
75
if (_lazyIsVararg && (IsGenericMethod ||
ContainingType
.IsGenericType || _lazyParameters.Length > 0 && _lazyParameters[_lazyParameters.Length - 1].IsParams))
235
var containingType = (SourceNamedTypeSymbol)this.
ContainingType
;
264
if (
ContainingType
.IsWellKnownSetsRequiredMembersAttribute())
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
370
: base((SourceNamedTypeSymbol)invoke.
ContainingType
, iAsyncResultType, syntax, MethodKind.Ordinary, DeclarationModifiers.Virtual | DeclarationModifiers.Public)
413
: base((SourceNamedTypeSymbol)invoke.
ContainingType
, invoke.ReturnTypeWithAnnotations, syntax, MethodKind.Ordinary, DeclarationModifiers.Virtual | DeclarationModifiers.Public)
Symbols\Source\SourceDestructorSymbol.cs (2)
131
var mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember:
ContainingType
.IsInterface, modifiers, DeclarationModifiers.None, allowedModifiers, location, diagnostics, out modifierErrors);
180
return (object)this.
ContainingType
.BaseTypeNoUseSiteDiagnostics == null;
Symbols\Source\SourceMemberMethodSymbol.cs (5)
277
if (
ContainingType
.HasFileLocalTypes())
284
diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Locations[0], returnType.Type,
ContainingType
);
291
diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Locations[0], param.Type,
ContainingType
);
845
if (IsDeclaredReadOnly && !
ContainingType
.IsReadOnly)
901
if (IsDeclaredReadOnly && !
ContainingType
.IsReadOnly)
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
67
if (!
ContainingType
.IsPartial())
146
TypeSymbol.CheckNullableReferenceTypeAndScopedMismatchOnImplementingMember(this.
ContainingType
, this, overriddenOrExplicitlyImplementedMethod, isExplicit: true, diagnostics);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (10)
154
(this.
ContainingType
.SpecialType == SpecialType.System_TypedReference || this.
ContainingType
.SpecialType == SpecialType.System_ArgIterator))
239
else if ((object)
ContainingType
.ContainingType != null)
241
diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, location,
ContainingType
.Name);
243
else if (!
ContainingType
.IsScriptClass && !(
ContainingType
.IsStatic &&
ContainingType
.Arity == 0))
509
var sourceContainer = this.
ContainingType
as SourceMemberContainerTypeSymbol;
527
return ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: true, isForInterfaceMember:
ContainingType
.IsInterface,
575
var tpEnclosing =
ContainingType
.FindEnclosingTypeParameter(name);
Symbols\Source\SourceOrdinaryMethodSymbolBase.cs (19)
205
bool isInterface = this.
ContainingType
.IsInterface;
255
if (
ContainingType
.IsStructType())
276
Debug.Assert(
ContainingType
.IsStructType());
322
Debug.Assert(!IsStatic ||
ContainingType
.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier.
324
bool isExplicitInterfaceImplementationInInterface = isExplicitInterfaceImplementation &&
ContainingType
.IsInterface;
361
else if (IsSealed &&
ContainingType
.TypeKind == TypeKind.Struct)
369
diagnostics.Add(ErrorFacts.GetStaticClassReturnCode(
ContainingType
.IsInterfaceType()), location, ReturnType);
383
else if (IsAbstract &&
ContainingType
.TypeKind == TypeKind.Struct)
388
else if (IsVirtual &&
ContainingType
.TypeKind == TypeKind.Struct)
398
else if (IsAbstract && !
ContainingType
.IsAbstract && (
ContainingType
.TypeKind == TypeKind.Class ||
ContainingType
.TypeKind == TypeKind.Submission))
401
diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this,
ContainingType
);
403
else if (IsVirtual &&
ContainingType
.IsSealed)
406
diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this,
ContainingType
);
416
else if (
ContainingType
.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride)
418
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(
ContainingType
), location, this);
420
else if (
ContainingType
.IsStatic && !IsStatic)
424
else if (isVararg && (IsGenericMethod ||
ContainingType
.IsGenericType || Parameters.Length > 0 && Parameters[Parameters.Length - 1].IsParams))
Symbols\Source\SourcePropertyAccessorSymbol.cs (12)
482
return
ContainingType
.IsStructType() &&
500
if (this.
ContainingType
.IsStructType())
507
bool isInterface = this.
ContainingType
.IsInterface;
528
if (IsAbstract && !
ContainingType
.IsAbstract && (
ContainingType
.TypeKind == TypeKind.Class ||
ContainingType
.TypeKind == TypeKind.Submission))
531
diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this,
ContainingType
);
533
else if (IsVirtual &&
ContainingType
.IsSealed &&
ContainingType
.TypeKind != TypeKind.Struct) // error CS0106 on struct already
536
diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this,
ContainingType
);
542
else if (
ContainingType
.IsSealed && localAccessibility.HasProtected() && !this.IsOverride)
544
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(
ContainingType
), location, this);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (7)
52
if (this.
ContainingType
.IsInterface &&
61
if (this.
ContainingType
.IsStatic)
278
if (this.
ContainingType
.IsStatic)
473
if ((
ContainingType
.SpecialType == SpecialType.System_Nullable_T)
695
return type.Equals(this.
ContainingType
, ComparisonForUserDefinedOperators);
709
return IsSelfConstrainedTypeParameter(type, this.
ContainingType
);
752
diagnostics.Add(ErrorCode.ERR_BadAbstractEqualityOperatorSignature, this.Locations[0], this.
ContainingType
);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
49
public new SourceMemberContainerTypeSymbol ContainingType => (SourceMemberContainerTypeSymbol)base.
ContainingType
;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (4)
39
TypeWithAnnotations.Create(
ContainingType
.BaseTypeNoUseSiteDiagnostics, NullableAnnotation.Annotated),
54
!overridden.ContainingType.Equals(
ContainingType
.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions))
56
diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, Locations[0], this,
ContainingType
.BaseTypeNoUseSiteDiagnostics);
76
ContainingType
.GetMembersUnordered().OfType<SynthesizedRecordObjEquals>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (7)
42
result |=
ContainingType
.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual;
45
if (
ContainingType
.IsAbstract)
88
NamedTypeSymbol baseType =
ContainingType
.BaseTypeNoUseSiteDiagnostics;
103
TypeWithAnnotations.Create(isNullableEnabled: true,
ContainingType
),
115
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
125
var members =
ContainingType
.InstanceConstructors;
130
ctor.Parameters[0].Type.Equals(
ContainingType
, TypeCompareKind.AllIgnoreOptions))
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
61
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
173
F.CloseMethod(F.Block(F.Return(F.Typeof(
ContainingType
))));
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperator.cs (4)
34
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
43
foreach (var member in
ContainingType
.GetMembers(WellKnownMemberNames.ObjectEquals))
47
candidate.Parameters[0].Type.Equals(
ContainingType
, TypeCompareKind.AllIgnoreOptions))
65
if (
ContainingType
.IsRecordStruct)
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (3)
68
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated;
72
TypeWithAnnotations.Create(
ContainingType
, annotation),
75
TypeWithAnnotations.Create(
ContainingType
, annotation),
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (9)
30
DeclarationModifiers result = DeclarationModifiers.Public | (
ContainingType
.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual);
40
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated;
44
TypeWithAnnotations.Create(
ContainingType
, annotation),
54
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
64
bool isRecordStruct =
ContainingType
.IsRecordStruct;
73
else if (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType())
111
MethodSymbol? baseEquals =
ContainingType
.GetMembersUnordered().OfType<SynthesizedRecordBaseEquals>().Single().OverriddenMethod;
113
if (baseEquals is null || !baseEquals.ContainingType.Equals(
ContainingType
.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions) ||
138
foreach (var f in
ContainingType
.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (3)
52
if (
ContainingType
.IsRecordStruct)
56
else if (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType())
96
foreach (var f in
ContainingType
.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordInequalityOperator.cs (2)
41
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
46
F.CloseMethod(F.Block(F.Return(F.Not(F.Call(receiver: null,
ContainingType
.GetMembers(WellKnownMemberNames.EqualityOperatorName).OfType<SynthesizedRecordEqualityOperator>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (5)
31
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated;
59
if (
ContainingType
.IsRecordStruct)
64
F.Is(paramAccess,
ContainingType
),
65
F.Call(F.This(), _typedRecordEquals, F.Convert(
ContainingType
, paramAccess)));
71
expression = F.Call(F.This(), _typedRecordEquals, F.As(paramAccess,
ContainingType
));
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (16)
40
var result = (
ContainingType
.IsRecordStruct || (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType() &&
ContainingType
.IsSealed)) ?
44
if (
ContainingType
.IsRecord && !
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType())
50
result |=
ContainingType
.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual;
62
if (
ContainingType
.IsRecordStruct)
92
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated;
111
!overridden.ContainingType.Equals(
ContainingType
.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions))
113
diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, Locations[0], this,
ContainingType
.BaseTypeNoUseSiteDiagnostics);
119
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
122
ImmutableArray<Symbol> printableMembers =
ContainingType
.GetMembers().WhereAsArray(m => isPrintable(m));
133
if (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType() ||
ContainingType
.IsRecordStruct)
143
if (!
ContainingType
.IsRecordStruct)
165
var basePrintCall = F.Call(receiver: F.Base(
ContainingType
.BaseTypeNoUseSiteDiagnostics), basePrintMethod, builder);
Symbols\Synthesized\Records\SynthesizedRecordToString.cs (3)
43
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated;
58
CSharpCompilation compilation =
ContainingType
.DeclaringCompilation;
69
block.Add(makeAppendString(F, builderLocal,
ContainingType
.Name));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (1)
85
if (!IsAbstract && !AssociatedEvent.IsWindowsRuntimeEvent && !
ContainingType
.IsStructType() &&
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
228
result = new InContainerBinder(
ContainingType
, result);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
FlowAnalysis\FlowTestBase.cs (2)
26
if (sourceSymbol == null || sourceSymbol.
ContainingType
.IsDelegateType())
31
var compilationState = new TypeCompilationState(sourceSymbol.
ContainingType
, compilation, null);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (21)
Semantics\ImplicitlyTypeArraysTests.cs (1)
40
var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.
ContainingType
, compilation, null), new BindingDiagnosticBag(diagnostics));
Semantics\OperatorTests.cs (1)
3204
var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.
ContainingType
, compilation, null), new BindingDiagnosticBag(diagnostics));
Semantics\OverloadResolutionTestBase.cs (1)
36
var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.
ContainingType
, compilation, null), new BindingDiagnosticBag(diagnostics));
Semantics\TopLevelStatementsTests.cs (18)
51
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
53
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9042
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
9044
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9045
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9097
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
9099
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9100
Assert.Equal(Accessibility.Public, entryPoint.
ContainingType
.DeclaredAccessibility);
9139
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
9141
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9142
Assert.Equal(Accessibility.Public, entryPoint.
ContainingType
.DeclaredAccessibility);
9164
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9186
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9215
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9217
Assert.True(entryPoint.
ContainingType
.IsReferenceType);
9313
Assert.Equal("Base", entryPoint.
ContainingType
.BaseType().ToTestDisplayString());
9314
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9315
Assert.False(entryPoint.
ContainingType
.IsStatic);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\ExpressionBodiedMethodTests.cs (1)
290
var implements = method.
ContainingType
.FindImplementationForInterfaceMember(iM);