public new static ReadonlyErr make(string msg, Err cause) { ReadonlyErr err = new ReadonlyErr(); make_(err, msg, cause); return(err); }
public virtual void set(object instance, object value, bool checkConst) { m_parent.finish(); // check const if ((m_flags & FConst.Const) != 0) { if (checkConst) { throw ReadonlyErr.make("Cannot set const field " + qname()).val; } else if (value != null && !isImmutable(value)) { throw ReadonlyErr.make("Cannot set const field " + qname() + " with mutable value").val; } } // check static if ((m_flags & FConst.Static) != 0) { throw ReadonlyErr.make("Cannot set static field " + qname()).val; } // check generic type (the .NET runtime will check non-generics) if (m_type.isGenericInstance() && value != null) { if (!@typeof(value).@is(m_type.toNonNullable())) { throw ArgErr.make("Wrong type for field " + qname() + ": " + m_type + " != " + @typeof(value)).val; } } if (m_setter != null) { m_setter.invoke(instance, new object[] { value }); return; } try { m_reflect.SetValue(instance, unbox(value)); } catch (ArgumentException e) { throw ArgErr.make(e).val; } catch (Exception e) { if (m_reflect == null) { throw Err.make("Field not mapped to System.Reflection correctly").val; } throw Err.make(e).val; } }
private void modify() { // if readonly then throw readonly exception if (m_isReadonly) { throw ReadonlyErr.make("Map is readonly").val; } // if we have a cached m_readonlyMap, then detach // it so it remains m_immutable if (m_readonlyMap != null) { m_readonlyMap.m_map = cloneMap(m_map); m_readonlyMap = null; } }
private void modify() { // if readonly then throw readonly exception if (m_isReadonly) { throw ReadonlyErr.make("List is readonly").val; } // if we have a cached readonlyList, then detach // it so it remains immutable if (m_readonlyList != null) { object[] temp = new object[m_size]; Array.Copy(m_values, temp, m_size); m_readonlyList.m_values = temp; m_readonlyList = null; } }
public static void make_(ReadonlyErr self, string msg, Err cause) { Err.make_(self, msg, cause); }
public static void make_(ReadonlyErr self, string msg) { make_(self, msg, null); }
public static void make_(ReadonlyErr self) { make_(self, null); }
public static new ReadonlyErr make(string msg, Err cause) { ReadonlyErr err = new ReadonlyErr(); make_(err, msg, cause); return err; }