private static void VisitMethodReference(Cci.IMethodReference methodReference, EmitContext context) { RoslynDebug.Assert(methodReference != null); // Visit containing type VisitTypeReference(methodReference.GetContainingType(context), context); // Visit generic arguments if any Cci.IGenericMethodInstanceReference?genericInstance = methodReference.AsGenericMethodInstanceReference; if (genericInstance != null) { foreach (var arg in genericInstance.GetGenericArguments(context)) { VisitTypeReference(arg, context); } methodReference = genericInstance.GetGenericMethod(context); } // Translate substituted method to original definition Cci.ISpecializedMethodReference?specializedMethod = methodReference.AsSpecializedMethodReference; if (specializedMethod != null) { methodReference = specializedMethod.UnspecializedVersion; } VisitSignature(methodReference, context); if (methodReference.AcceptsExtraArguments) { VisitParameters(methodReference.ExtraParameters, context); } }
internal void SetPEEntryPoint(TMethodSymbol method, DiagnosticBag diagnostics) { Debug.Assert(method == null || IsSourceDefinition((IMethodSymbol)method)); Debug.Assert(_outputKind.IsApplication()); _peEntryPoint = Translate(method, diagnostics, needDeclaration: true); }
public ExpandedVarargsMethodReference(Cci.IMethodReference underlyingMethod, ImmutableArray<Cci.IParameterTypeInformation> argListParams) { Debug.Assert(underlyingMethod.AcceptsExtraArguments); Debug.Assert(!argListParams.IsEmpty); _underlyingMethod = underlyingMethod; _argListParams = argListParams; }
public ExpandedVarargsMethodReference(Cci.IMethodReference underlyingMethod, ImmutableArray <Cci.IParameterTypeInformation> argListParams) { Debug.Assert(underlyingMethod.AcceptsExtraArguments); Debug.Assert(!argListParams.IsEmpty); this.underlyingMethod = underlyingMethod; this.argListParams = argListParams; }
public MethodImplementation( Cci.IMethodDefinition ImplementingMethod, Cci.IMethodReference ImplementedMethod ) { this.ImplementingMethod = ImplementingMethod; this.ImplementedMethod = ImplementedMethod; }
internal void EmitArrayBlockInitializer(ImmutableArray <byte> data, SyntaxNode syntaxNode, DiagnosticBag diagnostics) { // get helpers Cci.IMethodReference initializeArray = module.GetInitArrayHelper(); // map a field to the block (that makes it addressable via a token) Cci.IFieldReference field = module.GetFieldForData(data, syntaxNode, diagnostics); // emit call to the helper EmitOpCode(ILOpCode.Dup); //array EmitOpCode(ILOpCode.Ldtoken); EmitToken(field, syntaxNode, diagnostics); //block EmitOpCode(ILOpCode.Call, -2); EmitToken(initializeArray, syntaxNode, diagnostics); }
private static void VisitMethodReference(Cci.IMethodReference methodReference, EmitContext context) { Debug.Assert(methodReference != null); // Visit containing type VisitTypeReference(methodReference.GetContainingType(context), context); // Visit generic arguments if any Cci.IGenericMethodInstanceReference genericInstance = methodReference.AsGenericMethodInstanceReference; if (genericInstance != null) { foreach (var arg in genericInstance.GetGenericArguments(context)) { VisitTypeReference(arg, context); } methodReference = genericInstance.GetGenericMethod(context); } // Translate substituted method to original definition Cci.ISpecializedMethodReference specializedMethod = methodReference.AsSpecializedMethodReference; if (specializedMethod != null) { methodReference = specializedMethod.UnspecializedVersion; } // Visit parameter types VisitParameters(methodReference.GetParameters(context), context); if (methodReference.AcceptsExtraArguments) { VisitParameters(methodReference.ExtraParameters, context); } // Visit return value type VisitTypeReference(methodReference.GetType(context), context); foreach (var typeModifier in methodReference.RefCustomModifiers) { VisitTypeReference(typeModifier.GetModifier(context), context); } foreach (var typeModifier in methodReference.ReturnValueCustomModifiers) { VisitTypeReference(typeModifier.GetModifier(context), context); } }
public static void VisitReference(Cci.IReference reference, EmitContext context) { Cci.ITypeReference typeReference = reference as Cci.ITypeReference; if (typeReference != null) { VisitTypeReference(typeReference, context); return; } Cci.IMethodReference methodReference = reference as Cci.IMethodReference; if (methodReference != null) { VisitMethodReference(methodReference, context); return; } Cci.IFieldReference fieldReference = reference as Cci.IFieldReference; if (fieldReference != null) { VisitFieldReference(fieldReference, context); return; } }
internal void SetDebugEntryPoint(TMethodSymbol method, DiagnosticBag diagnostics) { Debug.Assert(method == null || IsSourceDefinition((IMethodSymbol)method)); _debugEntryPoint = Translate(method, diagnostics, needDeclaration: true); }
public MethodImplementation(Cci.IMethodDefinition ImplementingMethod, Cci.IMethodReference ImplementedMethod) { this.ImplementingMethod = ImplementingMethod; this.ImplementedMethod = ImplementedMethod; }