Mono.CSharp.Method.Emit C# (CSharp) Method

Emit() public method

public Emit ( ) : void
return void
        public override void Emit()
        {
            try {
                if (IsPartialDefinition) {
                    //
                    // Use partial method implementation builder for partial method declaration attributes
                    //
                    if (partialMethodImplementation != null) {
                        MethodBuilder = partialMethodImplementation.MethodBuilder;
                    }

                    return;
                }

                if ((ModFlags & Modifiers.PARTIAL) != 0 && (caching_flags & Flags.PartialDefinitionExists) == 0) {
                    Report.Error (759, Location, "A partial method `{0}' implementation is missing a partial method declaration",
                        GetSignatureForError ());
                }

                if (CurrentTypeParameters != null) {
                    var ge = type_expr as GenericTypeExpr;
                    if (ge != null)
                        ge.CheckConstraints (this);

                    foreach (Parameter p in parameters.FixedParameters) {
                        ge = p.TypeExpression as GenericTypeExpr;
                        if (ge != null)
                            ge.CheckConstraints (this);
                    }

                    for (int i = 0; i < CurrentTypeParameters.Length; ++i) {
                        var tp = CurrentTypeParameters [i];
                        tp.CheckGenericConstraints ();
                        tp.Emit ();
                    }
                }

                base.Emit ();

                if ((ModFlags & Modifiers.METHOD_EXTENSION) != 0)
                    Module.PredefinedAttributes.Extension.EmitAttribute (MethodBuilder);
            } catch {
                Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}",
                           Location, MethodBuilder);
                throw;
            }
        }