1 write to Context
Microsoft.CodeAnalysis (1)
PEWriter\MetadataWriter.cs (1)
116
this.
Context
= context;
140 references to Context
Microsoft.CodeAnalysis (140)
Emit\EditAndContinue\DeltaMetadataWriter.cs (12)
282
if (!_methodDefs.IsAddedNotChanged(def) && def.GetBody(
Context
)?.SequencePoints.Length > 0)
492
module.OnCreatedIndices(this.
Context
.Diagnostics);
633
foreach (var eventDef in typeDef.GetEvents(this.
Context
))
644
foreach (var fieldDef in typeDef.GetFields(this.
Context
))
650
foreach (var methodDef in typeDef.GetMethods(this.
Context
))
668
foreach (var propertyDef in typeDef.GetProperties(this.
Context
))
682
foreach (var methodImpl in typeDef.GetExplicitImplementationOverrides(
Context
))
684
var methodDef = (IMethodDefinition?)methodImpl.ImplementingMethod.AsDefinition(this.
Context
);
844
Context
.Diagnostics.Add(messageProvider.CreateDiagnostic(
917
translatedType =
Context
.Module.EncTranslateType(typeSymbol,
Context
.Diagnostics);
1834
Visit(module.GetTopLevelTypeDefinitions(metadataWriter.
Context
));
NativePdbWriter\PdbWriter.cs (4)
64
private EmitContext Context => _metadataWriter.
Context
;
382
typeReference = nestedType.GetContainingType(_metadataWriter.
Context
);
421
var allAliases = _metadataWriter.
Context
.Module.GetAssemblyReferenceAliases(_metadataWriter.
Context
);
NativePdbWriter\SymWriterMetadataProvider.cs (4)
51
if ((namespaceTypeDef = t.AsNamespaceTypeDefinition(_writer.
Context
)) != null)
65
attributes = _writer.GetTypeAttributes(t.GetResolvedType(_writer.
Context
));
74
declaringTypeToken = MetadataTokens.GetToken(_writer.GetTypeHandle(m.GetContainingType(_writer.
Context
)));
87
enclosingTypeToken = MetadataTokens.GetToken(_writer.GetTypeHandle(nt.GetContainingType(_writer.
Context
)));
PEWriter\FullMetadataWriter.cs (5)
382
foreach (MethodImplementation methodImplementation in typeDef.GetExplicitImplementationOverrides(
Context
))
387
foreach (IEventDefinition eventDef in typeDef.GetEvents(
Context
))
393
foreach (IFieldDefinition fieldDef in typeDef.GetFields(
Context
))
399
foreach (IMethodDefinition methodDef in typeDef.GetMethods(
Context
))
405
foreach (IPropertyDefinition propertyDef in typeDef.GetProperties(
Context
))
PEWriter\MemberRefComparer.cs (2)
28
if (x.GetContainingType(_metadataWriter.
Context
) != y.GetContainingType(_metadataWriter.
Context
))
PEWriter\MetadataWriter.cs (104)
500
foreach (INamespaceTypeDefinition typeDef in module.GetTopLevelTypeDefinitions(
Context
))
524
foreach (var nestedType in typeDef.GetNestedTypes(
Context
))
537
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
554
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
590
if (methodDef.ParameterCount == 0 && !(methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(
Context
))))
603
if (methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(
Context
)))
617
IteratorHelper.EnumerableIsNotEmpty(parDef.GetAttributes(
Context
)))
670
foreach (IAssemblyReference assemblyRef in this.module.GetAssemblyReferences(
Context
))
680
foreach (IFileReference fileRef in module.GetFiles(
Context
))
693
var containingAssembly = this.module.GetContainingAssembly(
Context
);
727
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
730
methodDef = methodReference.GetResolvedMethod(
Context
);
830
IUnitReference definingUnit = GetDefiningUnitReference(fieldReference.GetContainingType(
Context
),
Context
);
833
fieldDef = fieldReference.GetResolvedField(
Context
);
898
IUnitReference uref = namespaceRef.GetUnit(
Context
);
905
aref = mref.GetContainingAssembly(
Context
);
906
return aref == null || ReferenceEquals(aref, this.module.GetContainingAssembly(
Context
))
927
ITypeDefinition parentTypeDef = memberRef.GetContainingType(
Context
).AsTypeDefinition(
Context
);
945
if (this.TryGetMethodDefinitionHandle(methodRef.GetResolvedMethod(
Context
), out methodHandle))
958
var containingType = memberRef.GetContainingType(
Context
);
967
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
970
methodDef = methodReference.GetResolvedMethod(
Context
);
1053
var encoder = new BlobEncoder(builder).MethodSpecificationSignature(methodInstanceReference.GetGenericMethod(
Context
).GenericParameterCount);
1055
foreach (ITypeReference typeReference in methodInstanceReference.GetGenericArguments(
Context
))
1172
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
1175
methodDef = methodReference.GetResolvedMethod(
Context
);
1305
aref = mref.GetContainingAssembly(
Context
);
1307
if (aref != null && aref != module.GetContainingAssembly(
Context
))
1357
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, name));
1366
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, path));
1390
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, namespaceName + "." + mangledTypeName));
1400
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbUsingNameTooLong, location, usingString));
1412
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbLocalNameTooLong, localDefinition.Location, name));
1462
return GetTypeAttributes(typeDef,
Context
);
1612
GetTypeReferenceHandle(nestedTypeRef.GetContainingType(this.
Context
));
1663
var typeDefinition = typeReference.AsTypeDefinition(this.
Context
);
1798
if (
Context
.RebuildData is { } rebuildData)
1876
entryPointHandle = entryPoint != null ? (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)entryPoint.AsDefinition(
Context
)) : default(MethodDefinitionHandle);
1882
debugEntryPointHandle = (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)debugEntryPoint.AsDefinition(
Context
));
2044
this.module.GetSourceAssemblyAttributes(
Context
.IsRefAssembly),
2079
resolutionScope: GetResolutionScopeHandle(module.GetCorLibrary(
Context
)),
2106
AddCustomAttributesToTable(parentHandle, parent.GetAttributes(
Context
));
2122
AddCustomAttributesToTable(parentHandle, parent.GetAttributes(
Context
));
2136
IMethodReference constructor = customAttribute.Constructor(
Context
, reportDiagnostics: true);
2214
type: GetTypeHandle(eventDef.GetType(
Context
)));
2225
var exportedTypes = module.GetExportedTypes(
Context
.Diagnostics);
2388
var constant = fieldDef.GetCompileTimeValue(
Context
);
2401
var defaultValue = parDef.GetDefaultValue(
Context
);
2460
foreach (var refWithAttributes in genericParameter.GetConstraints(
Context
))
2499
foreach (var interfaceImpl in typeDef.Interfaces(
Context
))
2525
foreach (var resource in this.module.GetResources(
Context
))
2608
method: GetMethodDefinitionOrReferenceHandle(genericMethodInstanceReference.GetGenericMethod(
Context
)),
2623
implAttributes: methodDef.GetImplementationAttributes(
Context
),
2644
foreach (IMethodReference accessorMethod in propertyDef.GetAccessors(
Context
))
2663
methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(
Context
)));
2670
foreach (IMethodReference accessorMethod in eventDef.GetAccessors(
Context
))
2693
methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(
Context
)));
2773
INamespaceTypeDefinition namespaceType = typeDef.AsNamespaceTypeDefinition(
Context
);
2775
var moduleBuilder =
Context
.Module;
2779
ITypeReference baseType = typeDef.GetBaseClass(
Context
);
2795
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
2842
scopeTypeRef = sneTypeRef.GetUnspecializedVersion(
Context
).GetContainingType(
Context
);
2846
scopeTypeRef = nestedTypeRef.GetContainingType(
Context
);
2866
resolutionScope = this.GetResolutionScopeHandle(namespaceTypeRef.GetUnit(
Context
));
2960
body = method.GetBody(
Context
);
3169
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3187
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3412
var type = parameterTypeInformation.GetType(
Context
);
3435
SerializeTypeReference(typeEncoder, fieldReference.GetType(
Context
));
3440
var argsEncoder = new BlobEncoder(builder).MethodSpecificationSignature(genericMethodInstanceReference.GetGenericMethod(
Context
).GenericParameterCount);
3441
foreach (ITypeReference genericArgument in genericMethodInstanceReference.GetGenericArguments(
Context
))
3453
Context
.Module,
3454
Context
.Diagnostics,
3455
metadataOnly:
Context
.MetadataOnly,
3456
includePrivateMembers:
Context
.IncludePrivateMembers,
3457
rebuildData:
Context
.RebuildData,
3460
return
Context
;
3465
var parameters = customAttribute.Constructor(
Context
, reportDiagnostics: false).GetParameters(
Context
);
3466
var arguments = customAttribute.GetArguments(
Context
);
3477
SerializeMetadataExpression(in attributeContext, fixedArgsEncoder.AddArgument(), arguments[i], parameters[i].GetType(
Context
));
3485
foreach (IMetadataNamedArgument namedArgument in customAttribute.GetNamedArguments(
Context
))
3538
targetElementType = targetArrayType.GetElementType(this.
Context
);
3611
object marshaller = marshallingInformation.GetCustomMarshaller(
Context
);
3662
var elementType = marshallingInformation.GetSafeArrayElementUserDefinedSubtype(
Context
);
3689
writer.WriteSerializedString(typeReference.GetSerializedTypeName(this.
Context
));
3744
EmitContext context = this.
Context
;
3773
var declaredParameters = signature.GetParameters(
Context
);
3774
var returnType = signature.GetType(
Context
);
3849
typeReference = pointerTypeReference.GetTargetType(
Context
);
3873
typeReference = arrayTypeReference.GetElementType(
Context
);
3906
ITypeReference uninstantiatedTypeReference = typeReference.GetUninstantiatedGenericType(
Context
);
3912
typeReference.GetConsolidatedTypeArguments(consolidatedTypeArguments, this.
Context
);
4017
var elementType = arrayTypeReference.GetElementType(
Context
);
4119
encoder = encoder.AddModifier(GetTypeHandle(modifier.GetModifier(
Context
)), modifier.IsOptional);
4134
nestedType = specializedNestedType.GetUnspecializedVersion(
Context
);
4138
type = nestedType.GetContainingType(
Context
);
4143
type = nestedType.GetContainingType(
Context
);
PEWriter\MetadataWriter.PortablePdb.cs (5)
158
if (
Context
.Module.CommonCompilation.Options.EnableEditAndContinue && IsFullMetadata)
419
foreach (AssemblyReferenceAlias alias in module.GetAssemblyReferenceAliases(
Context
))
460
foreach (UsedNamespaceOrType import in scope.GetUsedNamespaces(
Context
))
879
if (this.
Context
.RebuildData is { } rebuildData)
1020
foreach (var (definition, documents) in module.GetTypeToDebugDocumentMap(
Context
))
PEWriter\MethodSpecComparer.cs (3)
29
_metadataWriter.GetMethodDefinitionOrReferenceHandle(x.GetGenericMethod(_metadataWriter.
Context
)) == _metadataWriter.GetMethodDefinitionOrReferenceHandle(y.GetGenericMethod(_metadataWriter.
Context
)) &&
36
_metadataWriter.GetMethodDefinitionOrReferenceHandle(methodInstanceReference.GetGenericMethod(_metadataWriter.
Context
)).GetHashCode(),
PEWriter\ReferenceIndexer.cs (1)
21
: base(metadataWriter.
Context
)