1 write to Context
Microsoft.CodeAnalysis (1)
PEWriter\MetadataWriter.cs (1)
111
this.
Context
= context;
140 references to Context
Microsoft.CodeAnalysis (140)
Emit\EditAndContinue\DeltaMetadataWriter.cs (12)
287
if (!_methodDefs.IsAddedNotChanged(def) && def.GetBody(
Context
)?.SequencePoints.Length > 0)
497
module.OnCreatedIndices(this.
Context
.Diagnostics);
561
foreach (var eventDef in typeDef.GetEvents(this.
Context
))
587
foreach (var fieldDef in typeDef.GetFields(this.
Context
))
593
foreach (var methodDef in typeDef.GetMethods(this.
Context
))
611
foreach (var propertyDef in typeDef.GetProperties(this.
Context
))
639
foreach (var methodImpl in typeDef.GetExplicitImplementationOverrides(
Context
))
641
var methodDef = (IMethodDefinition?)methodImpl.ImplementingMethod.AsDefinition(this.
Context
);
799
Context
.Diagnostics.Add(messageProvider.CreateDiagnostic(
872
translatedType =
Context
.Module.EncTranslateType(typeSymbol,
Context
.Diagnostics);
1760
Visit(module.GetTopLevelTypeDefinitions(metadataWriter.
Context
));
NativePdbWriter\PdbWriter.cs (4)
64
private EmitContext Context => _metadataWriter.
Context
;
382
typeReference = nestedType.GetContainingType(_metadataWriter.
Context
);
422
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)
383
foreach (MethodImplementation methodImplementation in typeDef.GetExplicitImplementationOverrides(
Context
))
388
foreach (IEventDefinition eventDef in typeDef.GetEvents(
Context
))
394
foreach (IFieldDefinition fieldDef in typeDef.GetFields(
Context
))
400
foreach (IMethodDefinition methodDef in typeDef.GetMethods(
Context
))
406
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)
498
foreach (INamespaceTypeDefinition typeDef in module.GetTopLevelTypeDefinitions(
Context
))
523
foreach (var nestedType in typeDef.GetNestedTypes(
Context
))
531
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
548
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
584
if (methodDef.ParameterCount == 0 && !(methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(
Context
))))
597
if (methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(
Context
)))
611
IteratorHelper.EnumerableIsNotEmpty(parDef.GetAttributes(
Context
)))
664
foreach (IAssemblyReference assemblyRef in this.module.GetAssemblyReferences(
Context
))
674
foreach (IFileReference fileRef in module.GetFiles(
Context
))
687
var containingAssembly = this.module.GetContainingAssembly(
Context
);
721
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
724
methodDef = methodReference.GetResolvedMethod(
Context
);
824
IUnitReference definingUnit = GetDefiningUnitReference(fieldReference.GetContainingType(
Context
),
Context
);
827
fieldDef = fieldReference.GetResolvedField(
Context
);
887
IUnitReference uref = namespaceRef.GetUnit(
Context
);
894
aref = mref.GetContainingAssembly(
Context
);
895
return aref == null || ReferenceEquals(aref, this.module.GetContainingAssembly(
Context
))
937
ITypeDefinition parentTypeDef = memberRef.GetContainingType(
Context
).AsTypeDefinition(
Context
);
955
if (this.TryGetMethodDefinitionHandle(methodRef.GetResolvedMethod(
Context
), out methodHandle))
968
var containingType = memberRef.GetContainingType(
Context
);
977
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
980
methodDef = methodReference.GetResolvedMethod(
Context
);
1063
var encoder = new BlobEncoder(builder).MethodSpecificationSignature(methodInstanceReference.GetGenericMethod(
Context
).GenericParameterCount);
1065
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
);
1790
if (
Context
.RebuildData is { } rebuildData)
1863
entryPointHandle = entryPoint != null ? (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)entryPoint.AsDefinition(
Context
)) : default(MethodDefinitionHandle);
1869
debugEntryPointHandle = (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)debugEntryPoint.AsDefinition(
Context
));
2035
this.module.GetSourceAssemblyAttributes(
Context
.IsRefAssembly),
2070
resolutionScope: GetResolutionScopeHandle(module.GetCorLibrary(
Context
)),
2091
AddCustomAttributesToTable(parentHandle, parent.GetAttributes(
Context
));
2101
AddCustomAttributesToTable(parentHandle, parent.GetAttributes(
Context
));
2118
IMethodReference constructor = customAttribute.Constructor(
Context
, reportDiagnostics: true);
2193
type: GetTypeHandle(eventDef.GetType(
Context
)));
2204
var exportedTypes = module.GetExportedTypes(
Context
.Diagnostics);
2361
var constant = fieldDef.GetCompileTimeValue(
Context
);
2374
var defaultValue = parDef.GetDefaultValue(
Context
);
2432
foreach (var refWithAttributes in genericParameter.GetConstraints(
Context
))
2471
foreach (var interfaceImpl in typeDef.Interfaces(
Context
))
2493
foreach (var resource in this.module.GetResources(
Context
))
2553
method: GetMethodDefinitionOrReferenceHandle(genericMethodInstanceReference.GetGenericMethod(
Context
)),
2568
implAttributes: methodDef.GetImplementationAttributes(
Context
),
2589
foreach (IMethodReference accessorMethod in propertyDef.GetAccessors(
Context
))
2608
methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(
Context
)));
2615
foreach (IMethodReference accessorMethod in eventDef.GetAccessors(
Context
))
2638
methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(
Context
)));
2718
INamespaceTypeDefinition namespaceType = typeDef.AsNamespaceTypeDefinition(
Context
);
2720
var moduleBuilder =
Context
.Module;
2724
ITypeReference baseType = typeDef.GetBaseClass(
Context
);
2740
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
2787
scopeTypeRef = sneTypeRef.GetUnspecializedVersion(
Context
).GetContainingType(
Context
);
2791
scopeTypeRef = nestedTypeRef.GetContainingType(
Context
);
2811
resolutionScope = this.GetResolutionScopeHandle(namespaceTypeRef.GetUnit(
Context
));
2903
body = method.GetBody(
Context
);
3119
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3137
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3362
var type = parameterTypeInformation.GetType(
Context
);
3385
SerializeTypeReference(typeEncoder, fieldReference.GetType(
Context
));
3390
var argsEncoder = new BlobEncoder(builder).MethodSpecificationSignature(genericMethodInstanceReference.GetGenericMethod(
Context
).GenericParameterCount);
3391
foreach (ITypeReference genericArgument in genericMethodInstanceReference.GetGenericArguments(
Context
))
3403
Context
.Module,
3404
Context
.Diagnostics,
3405
metadataOnly:
Context
.MetadataOnly,
3406
includePrivateMembers:
Context
.IncludePrivateMembers,
3407
rebuildData:
Context
.RebuildData,
3410
return
Context
;
3415
var parameters = customAttribute.Constructor(
Context
, reportDiagnostics: false).GetParameters(
Context
);
3416
var arguments = customAttribute.GetArguments(
Context
);
3427
SerializeMetadataExpression(in attributeContext, fixedArgsEncoder.AddArgument(), arguments[i], parameters[i].GetType(
Context
));
3435
foreach (IMetadataNamedArgument namedArgument in customAttribute.GetNamedArguments(
Context
))
3488
targetElementType = targetArrayType.GetElementType(this.
Context
);
3561
object marshaller = marshallingInformation.GetCustomMarshaller(
Context
);
3612
var elementType = marshallingInformation.GetSafeArrayElementUserDefinedSubtype(
Context
);
3639
writer.WriteSerializedString(typeReference.GetSerializedTypeName(this.
Context
));
3694
EmitContext context = this.
Context
;
3723
var declaredParameters = signature.GetParameters(
Context
);
3724
var returnType = signature.GetType(
Context
);
3799
typeReference = pointerTypeReference.GetTargetType(
Context
);
3823
typeReference = arrayTypeReference.GetElementType(
Context
);
3856
ITypeReference uninstantiatedTypeReference = typeReference.GetUninstantiatedGenericType(
Context
);
3862
typeReference.GetConsolidatedTypeArguments(consolidatedTypeArguments, this.
Context
);
3967
var elementType = arrayTypeReference.GetElementType(
Context
);
4069
encoder = encoder.AddModifier(GetTypeHandle(modifier.GetModifier(
Context
)), modifier.IsOptional);
4084
nestedType = specializedNestedType.GetUnspecializedVersion(
Context
);
4088
type = nestedType.GetContainingType(
Context
);
4093
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
)