Ejemplo n.º 1
0
        public PropertyMap.DeleteStatus DeletePropertyDescriptor(ref DValue field)
        {
            switch (field.ValueType)
            {
            case ValueTypes.Undefined: return(DeletePropertyDescriptor(Runtime.Instance.DefaultDUndefined.ToString()));

            case ValueTypes.String: return(DeletePropertyDescriptor(field.AsString()));

            case ValueTypes.Char: return(DeletePropertyDescriptor(field.AsChar()));

            case ValueTypes.Boolean: return(DeletePropertyDescriptor(field.AsBoolean()));

            case ValueTypes.Float: return(DeletePropertyDescriptor(field.AsFloat()));

            case ValueTypes.Double: return(DeletePropertyDescriptor(field.AsDouble()));

            case ValueTypes.Int8: return(DeletePropertyDescriptor(field.AsInt8()));

            case ValueTypes.Int16: return(DeletePropertyDescriptor(field.AsInt16()));

            case ValueTypes.Int32: return(DeletePropertyDescriptor(field.AsInt32()));

            case ValueTypes.Int64: return(DeletePropertyDescriptor(field.AsInt64()));

            case ValueTypes.UInt8: return(DeletePropertyDescriptor(field.AsUInt8()));

            case ValueTypes.UInt16: return(DeletePropertyDescriptor(field.AsUInt16()));

            case ValueTypes.UInt32: return(DeletePropertyDescriptor(field.AsUInt32()));

            case ValueTypes.UInt64: return(DeletePropertyDescriptor(field.AsUInt64()));

            case ValueTypes.Object:
            case ValueTypes.Function:
            case ValueTypes.Array:
                //case ValueTypes.Property:
                return(DeletePropertyDescriptor(field.AsDObject().ToString()));

            case ValueTypes.Null: return(DeletePropertyDescriptor(Runtime.Instance.DefaultDNull.ToString()));
                //default:
                //    return DeletePropertyDescriptor(field.ToString()); //This should never happen
            }
            Trace.Fail(new InvalidOperationException(string.Format("Cannot delete property using field index type {0}", field.ValueType)));
            return(PropertyMap.DeleteStatus.NotFound);
        }
Ejemplo n.º 2
0
 public virtual sbyte ToInt8()
 {
     return(PrimitiveValue.AsInt8());
 }