/// <summary>
        /// You can't actually set anything on NoneType, we just override this to get the correct error.
        /// </summary>
        public override void SetAttr(ICallerContext context, object self, SymbolId name, object value)
        {
            for (int i = 0; i < noneAttrs.Length; i++)
            {
                if (noneAttrs[i] == name)
                {
                    throw Ops.AttributeError("'NoneType' object attribute '{0}' is read-only", SymbolTable.IdToString(name));
                }
            }

            throw Ops.AttributeError("'NoneType' object has no attribute '{0}'", SymbolTable.IdToString(name));
        }
        public virtual object GetAttr(ICallerContext context, object self, SymbolId name)
        {
            object ret;

            if (TryGetAttr(context, self, name, out ret))
            {
                return(ret);
            }
            throw Ops.AttributeError("'{0}' object has no attribute '{1}'", this.__name__, SymbolTable.IdToString(name));
        }
 public virtual void SetAttr(ICallerContext context, object self, SymbolId name, object value)
 {
     throw Ops.AttributeError("'{0}' object has no attribute '{1}'", this.__name__, SymbolTable.IdToString(name));
 }
Beispiel #4
0
 public override void SetValue(object component, object value)
 {
     Ops.SetAttr(DefaultContext.Default, component, SymbolTable.StringToId(_name), value);
 }
Beispiel #5
0
 public override object GetValue(object component)
 {
     return(Ops.GetAttr(DefaultContext.Default, component, SymbolTable.StringToId(_name)));
 }
Beispiel #6
0
 bool IAttributesCollection.Remove(SymbolId name)
 {
     return(((IDictionary <object, object>) this).Remove(SymbolTable.IdToString(name)));
 }
Beispiel #7
0
 bool IAttributesCollection.ContainsKey(SymbolId name)
 {
     return(__contains__(SymbolTable.IdToString(name)));
 }
Beispiel #8
0
        /* IAttributesDictionary is implemented on our built-in
         * dictionaries to allow users to assign dictionaries into
         * classes.  These dictionaries will resolve their key via
         * the field table, but only get used when the user does
         * explicit dictionary assignment.
         *
         */

        #region IAttributesCollection Members

        void IAttributesCollection.Add(SymbolId name, object value)
        {
            this[SymbolTable.IdToString(name)] = value;
        }