While.AST.Procedure.CompileSignature C# (CSharp) Méthode

CompileSignature() public méthode

Compiles the signature for the procedure but not the body. This needs to be done first so that other methods can call this method, this way we don't have problems with; dependencies between methods.
public CompileSignature ( ModuleBuilder module ) : MethodBuilder
module System.Reflection.Emit.ModuleBuilder
Résultat System.Reflection.Emit.MethodBuilder
        public MethodBuilder CompileSignature(ModuleBuilder module)
        {
            Type[] argTypes = new Type[ArgumentCount];

            for (int i = 0; i < argTypes.Length; i++) {
                argTypes[i] = typeof(int);
            }

            if (HasResultArgument) {
                argTypes[argTypes.Length - 1] = typeof(int).MakeByRefType();
            }

            MethodBuilder method = module.DefineGlobalMethod(_name, MethodAttributes.HideBySig | MethodAttributes.Static | MethodAttributes.Public, typeof(void), argTypes);
            int pos = 1;
            foreach (Variable arg in ValueArguments) {
                SymbolTable.DefineArgument(arg.Name);
                method.DefineParameter(pos, ParameterAttributes.In, arg.Name);
                pos++;
            }

            if (HasResultArgument) {
                SymbolTable.DefineArgument(ResultArgument.Name);
                method.DefineParameter(pos, ParameterAttributes.Out, ResultArgument.Name);
            }
            SymbolTable.Clear();
            return method;
        }