1 write to Context
Microsoft.CodeAnalysis (1)
PEWriter\MetadataWriter.cs (1)
115
this.
Context
= context;
142 references to Context
Microsoft.CodeAnalysis (142)
Emit\EditAndContinue\DeltaMetadataWriter.cs (13)
134
var changes =
Context
.Module.EncSymbolChanges;
293
if (!_methodDefs.IsAddedNotChanged(def) && def.GetBody(
Context
)?.SequencePoints.Length > 0)
503
module.OnCreatedIndices(this.
Context
.Diagnostics);
666
foreach (var eventDef in typeDef.GetEvents(this.
Context
))
677
foreach (var fieldDef in typeDef.GetFields(this.
Context
))
683
foreach (var methodDef in typeDef.GetMethods(this.
Context
))
718
foreach (var propertyDef in typeDef.GetProperties(this.
Context
))
732
foreach (var methodImpl in typeDef.GetExplicitImplementationOverrides(
Context
))
734
var methodDef = (IMethodDefinition?)methodImpl.ImplementingMethod.AsDefinition(this.
Context
);
894
Context
.Diagnostics.Add(messageProvider.CreateDiagnostic(
967
translatedType =
Context
.Module.EncTranslateType(typeSymbol,
Context
.Diagnostics);
1882
Visit(module.GetTopLevelTypeDefinitions(metadataWriter.
Context
));
NativePdbWriter\PdbWriter.cs (4)
63
private EmitContext Context => _metadataWriter.
Context
;
381
typeReference = nestedType.GetContainingType(_metadataWriter.
Context
);
420
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)
381
foreach (MethodImplementation methodImplementation in typeDef.GetExplicitImplementationOverrides(
Context
))
386
foreach (IEventDefinition eventDef in typeDef.GetEvents(
Context
))
392
foreach (IFieldDefinition fieldDef in typeDef.GetFields(
Context
))
398
foreach (IMethodDefinition methodDef in typeDef.GetMethods(
Context
))
404
foreach (IPropertyDefinition propertyDef in typeDef.GetProperties(
Context
))
PEWriter\MemberRefComparer.cs (2)
28
if (x.GetContainingType(_metadataWriter.
Context
) != y.GetContainingType(_metadataWriter.
Context
))
PEWriter\MetadataWriter.cs (105)
499
foreach (INamespaceTypeDefinition typeDef in module.GetTopLevelTypeDefinitions(
Context
))
523
foreach (var nestedType in typeDef.GetNestedTypes(
Context
))
536
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
552
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
589
if (methodDef.ParameterCount == 0 && !(methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(
Context
))))
602
if (methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(
Context
)))
616
IteratorHelper.EnumerableIsNotEmpty(parDef.GetAttributes(
Context
)))
669
foreach (IAssemblyReference assemblyRef in this.module.GetAssemblyReferences(
Context
))
679
foreach (IFileReference fileRef in module.GetFiles(
Context
))
692
var containingAssembly = this.module.GetContainingAssembly(
Context
);
726
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
729
methodDef = methodReference.GetResolvedMethod(
Context
);
829
IUnitReference definingUnit = GetDefiningUnitReference(fieldReference.GetContainingType(
Context
),
Context
);
832
fieldDef = fieldReference.GetResolvedField(
Context
);
897
IUnitReference uref = namespaceRef.GetUnit(
Context
);
904
aref = mref.GetContainingAssembly(
Context
);
905
return aref == null || ReferenceEquals(aref, this.module.GetContainingAssembly(
Context
))
926
ITypeDefinition parentTypeDef = memberRef.GetContainingType(
Context
).AsTypeDefinition(
Context
);
944
if (this.TryGetMethodDefinitionHandle(methodRef.GetResolvedMethod(
Context
), out methodHandle))
957
var containingType = memberRef.GetContainingType(
Context
);
966
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
969
methodDef = methodReference.GetResolvedMethod(
Context
);
1052
var encoder = new BlobEncoder(builder).MethodSpecificationSignature(methodInstanceReference.GetGenericMethod(
Context
).GenericParameterCount);
1054
foreach (ITypeReference typeReference in methodInstanceReference.GetGenericArguments(
Context
))
1171
IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(
Context
),
Context
);
1174
methodDef = methodReference.GetResolvedMethod(
Context
);
1304
aref = mref.GetContainingAssembly(
Context
);
1306
if (aref != null && aref != module.GetContainingAssembly(
Context
))
1356
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, name));
1365
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, path));
1389
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, namespaceName + "." + mangledTypeName));
1399
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbUsingNameTooLong, location, usingString));
1411
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbLocalNameTooLong, localDefinition.Location, name));
1461
return GetTypeAttributes(typeDef,
Context
);
1611
GetTypeReferenceHandle(nestedTypeRef.GetContainingType(this.
Context
));
1662
var typeDefinition = typeReference.AsTypeDefinition(this.
Context
);
1800
if (
Context
.RebuildData is { } rebuildData)
1881
entryPointHandle = entryPoint != null ? (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)entryPoint.AsDefinition(
Context
)) : default(MethodDefinitionHandle);
1887
debugEntryPointHandle = (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)debugEntryPoint.AsDefinition(
Context
));
2049
this.module.GetSourceAssemblyAttributes(
Context
.IsRefAssembly),
2084
resolutionScope: GetResolutionScopeHandle(module.GetCorLibrary(
Context
)),
2111
AddCustomAttributesToTable(parentHandle, parent.GetAttributes(
Context
));
2121
AddCustomAttributesToTable(parentHandle, parent.GetAttributes(
Context
));
2135
IMethodReference constructor = customAttribute.Constructor(
Context
, reportDiagnostics: true);
2213
type: GetTypeHandle(eventDef.GetType(
Context
)));
2224
var exportedTypes = module.GetExportedTypes(
Context
);
2394
var constant = fieldDef.GetCompileTimeValue(
Context
);
2407
var defaultValue = parDef.GetDefaultValue(
Context
);
2466
foreach (var refWithAttributes in genericParameter.GetConstraints(
Context
))
2505
foreach (var interfaceImpl in typeDef.Interfaces(
Context
))
2531
foreach (var resource in this.module.GetResources(
Context
))
2604
Context
.Diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_EncUpdateRequiresEmittingExplicitInterfaceImplementationNotSupportedByTheRuntime, NoLocation.Singleton));
2626
method: GetMethodDefinitionOrReferenceHandle(genericMethodInstanceReference.GetGenericMethod(
Context
)),
2641
implAttributes: methodDef.GetImplementationAttributes(
Context
),
2668
foreach (IMethodReference accessorMethod in propertyDef.GetAccessors(
Context
))
2687
methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(
Context
)));
2700
foreach (IMethodReference accessorMethod in eventDef.GetAccessors(
Context
))
2723
methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(
Context
)));
2803
INamespaceTypeDefinition namespaceType = typeDef.AsNamespaceTypeDefinition(
Context
);
2805
var moduleBuilder =
Context
.Module;
2809
ITypeReference baseType = typeDef.GetBaseClass(
Context
);
2825
INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(
Context
);
2872
scopeTypeRef = sneTypeRef.GetUnspecializedVersion(
Context
).GetContainingType(
Context
);
2876
scopeTypeRef = nestedTypeRef.GetContainingType(
Context
);
2896
resolutionScope = this.GetResolutionScopeHandle(namespaceTypeRef.GetUnit(
Context
));
2990
body = method.GetBody(
Context
);
3199
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3217
this.
Context
.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3442
var type = parameterTypeInformation.GetType(
Context
);
3465
SerializeTypeReference(typeEncoder, fieldReference.GetType(
Context
));
3470
var argsEncoder = new BlobEncoder(builder).MethodSpecificationSignature(genericMethodInstanceReference.GetGenericMethod(
Context
).GenericParameterCount);
3471
foreach (ITypeReference genericArgument in genericMethodInstanceReference.GetGenericArguments(
Context
))
3483
Context
.Module,
3484
Context
.Diagnostics,
3485
metadataOnly:
Context
.MetadataOnly,
3486
includePrivateMembers:
Context
.IncludePrivateMembers,
3487
rebuildData:
Context
.RebuildData,
3490
return
Context
;
3495
var parameters = customAttribute.Constructor(
Context
, reportDiagnostics: false).GetParameters(
Context
);
3496
var arguments = customAttribute.GetArguments(
Context
);
3507
SerializeMetadataExpression(in attributeContext, fixedArgsEncoder.AddArgument(), arguments[i], parameters[i].GetType(
Context
));
3515
foreach (IMetadataNamedArgument namedArgument in customAttribute.GetNamedArguments(
Context
))
3568
targetElementType = targetArrayType.GetElementType(this.
Context
);
3641
object marshaller = marshallingInformation.GetCustomMarshaller(
Context
);
3692
var elementType = marshallingInformation.GetSafeArrayElementUserDefinedSubtype(
Context
);
3719
writer.WriteSerializedString(typeReference.GetSerializedTypeName(this.
Context
));
3774
EmitContext context = this.
Context
;
3803
var declaredParameters = signature.GetParameters(
Context
);
3804
var returnType = signature.GetType(
Context
);
3877
typeReference = pointerTypeReference.GetTargetType(
Context
);
3901
typeReference = arrayTypeReference.GetElementType(
Context
);
3934
ITypeReference uninstantiatedTypeReference = typeReference.GetUninstantiatedGenericType(
Context
);
3940
typeReference.GetConsolidatedTypeArguments(consolidatedTypeArguments, this.
Context
);
4045
var elementType = arrayTypeReference.GetElementType(
Context
);
4147
encoder = encoder.AddModifier(GetTypeHandle(modifier.GetModifier(
Context
)), modifier.IsOptional);
4162
nestedType = specializedNestedType.GetUnspecializedVersion(
Context
);
4166
type = nestedType.GetContainingType(
Context
);
4177
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
)