示例#1
0
        LocalVarSig GetLocalVarSig(VariableDefinitionCollection vars)
        {
            LocalVarSig lvs = new LocalVarSig();

            lvs.CallingConvention |= 0x7;
            lvs.Count              = vars.Count;
            lvs.LocalVariables     = new LocalVarSig.LocalVariable [lvs.Count];
            for (int i = 0; i < lvs.Count; i++)
            {
                LocalVarSig.LocalVariable lv   = new LocalVarSig.LocalVariable();
                TypeReference             type = vars [i].VariableType;

                lv.CustomMods = m_reflectWriter.GetCustomMods(type);

                if (type is PinnedType)
                {
                    lv.Constraint |= Constraint.Pinned;
                    type           = (type as PinnedType).ElementType;
                }

                if (type is ReferenceType)
                {
                    lv.ByRef = true;
                    type     = (type as ReferenceType).ElementType;
                }

                lv.Type = m_reflectWriter.GetSigType(type);

                lvs.LocalVariables [i] = lv;
            }
            return(lvs);
        }
示例#2
0
        public LocalVarSig.LocalVariable GetLocalVariableSig(VariableDefinition var)
        {
            LocalVarSig.LocalVariable lv   = new LocalVarSig.LocalVariable();
            TypeReference             type = var.VariableType;

            lv.CustomMods = m_reflectWriter.GetCustomMods(type);

            if (type is PinnedType)
            {
                lv.Constraint |= Constraint.Pinned;
                type           = (type as PinnedType).ElementType;
            }

            if (type is ReferenceType)
            {
                lv.ByRef = true;
                type     = (type as ReferenceType).ElementType;
            }

            lv.Type = m_reflectWriter.GetSigType(type);

            return(lv);
        }