コード例 #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 bool isImmutable()
 {
     if (this.m_isImmutable == null)
     {
         bool isImmutable = false;
         if (m_orig.isImmutable())
         {
             isImmutable = true;
             for (int i = 0; i < m_bound.sz(); ++i)
             {
                 object obj = m_bound.get(i);
                 if (obj != null && !FanObj.isImmutable(obj))
                 {
                     isImmutable = false; break;
                 }
             }
         }
         this.m_isImmutable = Boolean.valueOf(isImmutable);
     }
     return(this.m_isImmutable.booleanValue());
 }