Exemplo n.º 1
0
 internal override void AttachSingleton(RObjectBase obj)
 {
     if (iv_tbl == null)
     {
         iv_tbl = new st_table();
     }
     iv_tbl[ruby.intern("__attached__")] = obj;
 }
Exemplo n.º 2
0
 public override object IVarSet(uint uid, object val)
 {
     IVarCheck();
     if (iv_tbl == null)
     {
         iv_tbl = new st_table();
     }
     iv_tbl[uid] = val;
     return(val);
 }
Exemplo n.º 3
0
 internal RMetaObject(NetRuby rb, string name, RMetaObject sp, RMetaObject meta)
     : base(rb, meta)
 {
     super = sp;
     m_tbl = new st_table();
     if (name != null)
     {
         uint id = rb.intern(name);
         IVarSet("__classid__", Symbol.ID2SYM(id));
     }
 }
Exemplo n.º 4
0
        internal object FindClassPath()
        {
            fc_result arg = new fc_result(0, this, ruby.cObject, null);

            if (ruby.cObject.iv_tbl != null)
            {
                lock (ruby.cObject.iv_tbl.SyncRoot)
                {
                    foreach (DictionaryEntry entry in ruby.cObject.iv_tbl)
                    {
                        if (fc_i((uint)entry.Key, entry.Value, arg))
                        {
                            break;
                        }
                    }
                }
            }
            if (arg.path == null)
            {
                lock (ruby.class_tbl.SyncRoot)
                {
                    foreach (DictionaryEntry entry in ruby.class_tbl)
                    {
                        if (fc_i((uint)entry.Key, entry.Value, arg))
                        {
                            break;
                        }
                    }
                }
            }
            if (arg.path != null)
            {
                lock (this)
                {
                    if (iv_tbl == null)
                    {
                        iv_tbl = new st_table();
                    }
                    iv_tbl[ruby.intern("__classpath__")] = arg.path;
                }
            }
            return((string)arg.path);
        }
Exemplo n.º 5
0
 internal object LocalASet(uint key, object val)
 {
     lock (this)
     {
         if (locals == null)
         {
             locals = new st_table();
         }
         if (val == null)
         {
             locals.Remove(id);
         }
         else
         {
             locals[id] = val;
         }
     }
     return(val);
 }
Exemplo n.º 6
0
        void valSet(uint id, object val, bool isconst)
        {
            string dest = (isconst) ? "constant" : "class variable";

            CVarCheck(dest);
            lock (this)
            {
                if (iv_tbl == null)
                {
                    iv_tbl = new st_table();
                }
                else if (isconst)
                {
                    if (iv_tbl.ContainsKey(id) ||
                        (this == ruby.cObject && ruby.class_tbl.ContainsKey(id)))
                    {
                        ruby.warn(String.Format("already initialized {0} {1}",
                                                dest, ruby.id2name(id)));
                    }
                }
                iv_tbl[id] = val;
            }
        }