示例#1
0
        public static object toImmutable(object obj)
        {
            if (obj == null)
            {
                return(null);
            }

            // TODO - this isn't quite right, need to clean up with FanObj.isImmutable
            if (obj is Double)
            {
                return(((Double)obj).doubleValue());
            }
            if (obj is Long)
            {
                return(((Long)obj).longValue());
            }

            if (FanObj.isImmutable(obj))
            {
                return(obj);
            }
            if (obj is List)
            {
                return(((List)obj).toImmutable());
            }
            if (obj is Map)
            {
                return(((Map)obj).toImmutable());
            }
            throw NotImmutableErr.make(FanObj.@typeof(obj).toStr()).val;
        }
示例#2
0
文件: Func.cs 项目: syatanic/fantom
 public override object toImmutable()
 {
     if (isImmutable())
     {
         return(this);
     }
     throw NotImmutableErr.make().val;
 }