Ejemplo n.º 1
0
        /// <summary>
        /// Emits IL instructions that load actual parameters and optionally add a new stack frame to
        /// current <see cref="PHP.Core.ScriptContext.Stack"/>.
        /// </summary>
        /// <param name="codeGenerator">Code generator.</param>
        /// <remarks>
        /// Nothing is expected on the evaluation stack. Nothing is left on the evaluation stack.
        /// </remarks>
        internal void EmitLoadOnPhpStack(CodeGenerator /*!*/ codeGenerator)
        {
            List <ActualParam> parameters    = this.parameters;
            List <TypeRef>     genericParams = this.genericParams;

            PhpStackBuilder.EmitAddFrame(codeGenerator.IL, codeGenerator.ScriptContextPlace, genericParams.Count, parameters.Count,
                                         delegate(ILEmitter il, int i)
            {
                // generic arguments:
                genericParams[i].EmitLoadTypeDesc(codeGenerator, ResolveTypeFlags.UseAutoload | ResolveTypeFlags.ThrowErrors);
            },
                                         delegate(ILEmitter il, int i)
            {
                // regular arguments:
                codeGenerator.EmitBoxing(parameters[i].Emit(codeGenerator));
            }
                                         );
        }
Ejemplo n.º 2
0
            /// <summary>
            /// Emits IL instructions that load actual parameters and optionally add a new stack frame to
            /// current <see cref="PHP.Core.ScriptContext.Stack"/>.
            /// </summary>
            /// <param name="node">Instance.</param>
            /// <param name="codeGenerator">Code generator.</param>
            /// <remarks>
            /// Nothing is expected on the evaluation stack. Nothing is left on the evaluation stack.
            /// </remarks>
            public void EmitLoadOnPhpStack(CallSignature /*!*/ node, CodeGenerator /*!*/ codeGenerator)
            {
                var parameters    = node.Parameters;
                var genericParams = node.GenericParams;

                PhpStackBuilder.EmitAddFrame(codeGenerator.IL, codeGenerator.ScriptContextPlace, genericParams.Length, parameters.Length,
                                             delegate(ILEmitter il, int i)
                {
                    // generic arguments:
                    genericParams[i].EmitLoadTypeDesc(codeGenerator, ResolveTypeFlags.UseAutoload | ResolveTypeFlags.ThrowErrors);
                },
                                             delegate(ILEmitter il, int i)
                {
                    // regular arguments:
                    var p = parameters[i];
                    codeGenerator.EmitBoxing(p.NodeCompiler <ActualParamCompiler>().Emit(p, codeGenerator));
                }
                                             );
            }