Boo.Lang.Compiler.Steps.EmitAssembly.EmitLoadLiteralField C# (CSharp) Метод

EmitLoadLiteralField() приватный Метод

private EmitLoadLiteralField ( Node node, IField fieldInfo ) : void
node Node
fieldInfo IField
Результат void
        void EmitLoadLiteralField(Node node, IField fieldInfo)
        {
            object value = GetStaticValue(fieldInfo);
            IType type = fieldInfo.Type;
            if (type.IsEnum){
                Type underlyingType = GetEnumUnderlyingType(type);
                type = TypeSystemServices.Map(underlyingType);
                value = Convert.ChangeType(value, underlyingType);
            }

            if (null == value)
            {
                _il.Emit(OpCodes.Ldnull);
            }
            else if (type == TypeSystemServices.BoolType)
            {
                _il.Emit(((bool) value) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
            }
            else if (type == TypeSystemServices.StringType)
            {
                _il.Emit(OpCodes.Ldstr, (string) value);
            }
            else if (type == TypeSystemServices.CharType)
            {
                EmitLoadLiteral(type, (long)(char) value);
            }
            else if (type == TypeSystemServices.IntType)
            {
                EmitLoadLiteral(type, (long)(int) value);
            }
            else if (type == TypeSystemServices.UIntType)
            {
                EmitLoadLiteral(type, unchecked((long)(uint) value));
            }
            else if (IsLong(type))
            {
                EmitLoadLiteral(type, (long) value);
            }
            else if (type == TypeSystemServices.ULongType)
            {
                EmitLoadLiteral(type, unchecked((long)(ulong) value));
            }
            else if (type == TypeSystemServices.SingleType)
            {
                EmitLoadLiteral(type, (double)(float) value);
            }
            else if (type == TypeSystemServices.DoubleType)
            {
                EmitLoadLiteral(type, (double) value);
            }
            else if (type == TypeSystemServices.SByteType)
            {
                EmitLoadLiteral(type, (long)(sbyte) value);
            }
            else if (type == TypeSystemServices.ByteType)
            {
                EmitLoadLiteral(type, (long)(byte) value);
            }
            else if (type == TypeSystemServices.ShortType)
            {
                EmitLoadLiteral(type, (long)(short) value);
            }
            else if (type == TypeSystemServices.UShortType)
            {
                EmitLoadLiteral(type, (long)(ushort) value);
            }
            else
            {
                NotImplemented(node, "Literal field type: " + type.ToString());
            }
        }
EmitAssembly