EmitLoadLocal() public static method

public static EmitLoadLocal ( ILGenerator generator, LocalBuilder builder ) : void
generator System.Reflection.Emit.ILGenerator
builder System.Reflection.Emit.LocalBuilder
return void
            private void BeginEmitPopLocal(LocalAddress address)
            {
                string localName = mLambdaNode.locals[address.index];

                if (mHeapEnvFieldBuilders.ContainsKey(localName))
                {
                    JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder);
                }
                else if (address.index < mLambdaNode.formalCount)
                {
                    //
                }
                else
                {
                    //
                }
            }
            private void EmitLoadLocal(LocalAddress address)
            {
                string localName = mLambdaNode.locals[address.index];

                if (mHeapEnvFieldBuilders.ContainsKey(localName))
                {
                    JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder);
                    mILGenerator.Emit(OpCodes.Ldfld, mHeapEnvFieldBuilders[localName]);
                }
                else if (address.index < mLambdaNode.formalCount)
                {
                    JITInterpreter_DS.EmitLoadArg(mILGenerator, HasThisArgument(), mArgBuilders[address.index]);
                }
                else
                {
                    JITInterpreter_DS.EmitLoadLocal(mILGenerator, mLocalBuilders[address.index - mLambdaNode.formalCount]);
                }
            }
            private void EmitInitHeapEnv()
            {
                if (!HasHeapEnv())
                {
                    return;
                }

                mHeapEnvBuilder = mILGenerator.DeclareLocal(mHeapEnvTypeBuilder);
                if (JITInterpreter_DS.Instance().HasSymbolInfo())
                {
                    mHeapEnvBuilder.SetLocalSymInfo(HEAP_ENV_LOCAL_NAME);
                }

                var constructor = mHeapEnvTypeBuilder.DefineDefaultConstructor(MethodAttributes.Public);

                mILGenerator.Emit(OpCodes.Newobj, constructor);
                EmitStoreLocal(mILGenerator, mHeapEnvBuilder);

                if (mLambdaNode.childrenFreeAddresses.Where(v => v.envIndex > 0).GetEnumerator().MoveNext())
                {
                    var fieldBuilder = mHeapEnvTypeBuilder.DefineField(PREV_ENV_FIELD_NAME, mEnvTypeBuilder, FieldAttributes.Public);
                    mHeapEnvFieldBuilders[PREV_ENV_FIELD_NAME] = fieldBuilder;
                    JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder);
                    JITInterpreter_DS.EmitLoadThis(mILGenerator);
                    mILGenerator.Emit(OpCodes.Stfld, fieldBuilder);
                }

                var heapLocals = mLambdaNode.childrenFreeAddresses.Where(a => a.envIndex == 0).Select(a => a.index).OrderBy(a => a).ToList();

                foreach (var index in heapLocals)
                {
                    var fieldBuilder = mHeapEnvTypeBuilder.DefineField(mLambdaNode.locals[index], typeof(object), FieldAttributes.Public);
                    mHeapEnvFieldBuilders[mLambdaNode.locals[index]] = fieldBuilder;

                    if (index < mLambdaNode.formalCount)
                    {
                        JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder);
                        JITInterpreter_DS.EmitLoadArg(mILGenerator, HasThisArgument(), mArgBuilders[index]);
                        mILGenerator.Emit(OpCodes.Stfld, fieldBuilder);
                    }
                }
            }
            public void Visit(ASTNode_Lambda node)
            {
                var methodBuilder = new ASTNodeVisitor_JITCompiler(this, mHeapEnvTypeBuilder, node).MethodBuilder;

                if (methodBuilder.IsStatic)
                {
                    mILGenerator.Emit(OpCodes.Ldnull);
                    mILGenerator.Emit(OpCodes.Ldftn, methodBuilder);
                    mILGenerator.Emit(OpCodes.Newobj,
                                      JITInterpreter_DS.Instance().GetDelegateType(node.formalCount).
                                      GetConstructor(new Type[] { typeof(object), typeof(IntPtr) }));
                }
                else
                {
                    JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder);
                    mILGenerator.Emit(OpCodes.Ldftn, methodBuilder);
                    mILGenerator.Emit(OpCodes.Newobj,
                                      JITInterpreter_DS.Instance().GetDelegateType(node.formalCount)
                                      .GetConstructor(new Type[] { typeof(object), typeof(IntPtr) }));
                }
            }