Beispiel #1
0
 private void ImportLoadInt(long value, StackValueKind kind)
 {
     if (kind == StackValueKind.Int32)
     {
         _interpreter.EvaluationStack.Push(StackItem.FromInt32((int)value));
     }
     else if (kind == StackValueKind.Int64)
     {
         _interpreter.EvaluationStack.Push(StackItem.FromInt64(value));
     }
 }
        public static StackItem ToStackItem(this object value, Type type)
        {
            switch (Type.GetTypeCode(type))
            {
            case TypeCode.Boolean:
            case TypeCode.Byte:
            case TypeCode.Char:
            case TypeCode.Int16:
            case TypeCode.Int32:
            case TypeCode.SByte:
            case TypeCode.UInt16:
            case TypeCode.UInt32:
                return(StackItem.FromInt32((int)value));

            case TypeCode.DateTime:
                break;

            case TypeCode.Decimal:
            case TypeCode.Double:
            case TypeCode.Single:
                return(StackItem.FromDouble((double)value));

            case TypeCode.Int64:
            case TypeCode.UInt64:
                return(StackItem.FromInt64((long)value));

            case TypeCode.Empty:
            case TypeCode.Object:
            case TypeCode.String:
                return(StackItem.FromObjectRef(value));

            default:
                throw new NotImplementedException();
            }

            throw new NotImplementedException();
        }