//---------------------------------------------------------------------------- // Overloaded .Has methods that convert their argument into either a string // (property) or uint32 (index) and fowards the call to the correct .Has //---------------------------------------------------------------------------- public bool Delete(BoxedValue index) { uint i = 0; if (TypeConverter.TryToIndex(index, out i)) { return(this.Delete(i)); } return(this.Delete(TypeConverter.ToString(index))); }
public bool Delete(double index) { uint parsed = 0; if (TypeConverter.TryToIndex(index, out parsed)) { return(this.Delete(parsed)); } return(this.Delete(TypeConverter.ToString(index))); }
//---------------------------------------------------------------------------- // Overloaded .Get methods that convert their argument into either a string // or uint32 and forwards the call to the correct .Get method //---------------------------------------------------------------------------- public BoxedValue Get(BoxedValue index) { uint i = 0; if (TypeConverter.TryToIndex(index, out i)) { return(this.Get(i)); } return(this.Get(TypeConverter.ToString(index))); }
public BoxedValue Get(double index) { uint parsed = 0; if (TypeConverter.TryToIndex(index, out parsed)) { return(this.Get(parsed)); } return(this.Get(TypeConverter.ToString(index))); }
public bool Has(CommonObject index) { string s = TypeConverter.ToString(index); uint parsed = 0; if (TypeConverter.TryToIndex(s, out parsed)) { return(this.Has(parsed)); } return(this.Has(s)); }
public BoxedValue Get(CommonObject index) { string s = TypeConverter.ToString(index); uint parsed = 0; if (TypeConverter.TryToIndex(s, out parsed)) { return(this.Get(parsed)); } return(this.Get(s)); }
public bool Delete(object index) { string name = TypeConverter.ToString(index); uint parsed = 0; if (TypeConverter.TryToIndex(name, out parsed)) { return(this.Delete(parsed)); } return(this.Delete(name)); }
public void Put(double index, BoxedValue value) { uint parsed = 0; if (TypeConverter.TryToIndex(index, out parsed)) { this.Put(parsed, value); } else { this.Put(TypeConverter.ToString(index), value); } }
public void Put(double index, object value, uint tag) { uint parsed = 0; if (TypeConverter.TryToIndex(index, out parsed)) { this.Put(parsed, value, tag); } else { this.Put(TypeConverter.ToString(index), value, tag); } }
//---------------------------------------------------------------------------- // Put methods for setting indexes to doubles //---------------------------------------------------------------------------- public void Put(BoxedValue index, object value, uint tag) { uint i = 0; if (TypeConverter.TryToIndex(index, out i)) { this.Put(i, value, tag); } else { this.Put(TypeConverter.ToString(index), value, tag); } }
//---------------------------------------------------------------------------- // Put methods for setting indexes to doubles //---------------------------------------------------------------------------- public void Put(BoxedValue index, double value) { uint i = 0; if (TypeConverter.TryToIndex(index, out i)) { this.Put(i, value); } else { this.Put(TypeConverter.ToString(index), value); } }
public void Put(object index, object value, uint tag) { var s = TypeConverter.ToString(index); var parsed = 0u; if (TypeConverter.TryToIndex(s, out parsed)) { this.Put(parsed, value, tag); } else { this.Put(s, value, tag); } }
public void Put(object index0, double value) { string index = TypeConverter.ToString(index0); uint parsed = 0; if (TypeConverter.TryToIndex(index, out parsed)) { this.Put(parsed, value); } else { this.Put(index, value); } }
public void Put(object index, BoxedValue value) { string s = TypeConverter.ToString(index); uint parsed = 0; if (TypeConverter.TryToIndex(s, out parsed)) { this.Put(parsed, value); } else { this.Put(s, value); } }
public void Put(CommonObject index, object value, uint tag) { string s = TypeConverter.ToString(index); uint parsed = 0; if (TypeConverter.TryToIndex(s, out parsed)) { this.Put(parsed, value, tag); } else { this.Put(s, value, tag); } }
/// <summary> /// Implements the binary `in` operator. /// </summary> public static bool @in(Environment env, BoxedValue l, BoxedValue r) { if (!r.IsObject) { return(env.RaiseTypeError <bool>("Right operand is not a object")); } uint index = 0; if (TypeConverter.TryToIndex(l, out index)) { return(r.Object.Has(index)); } string name = TypeConverter.ToString(l); return(r.Object.Has(name)); }
public override void Put(string name, double value) { if (name == "length") { this.PutLength(TypeConverter.ToNumber(value)); this.SetAttrs("length", DescriptorAttrs.DontEnum); //TODO: Shouldn't `PutLength` keep the `DontEnum` flag? return; } uint index; if (TypeConverter.TryToIndex(name, out index)) //TODO: I changed this to use TryToIndex, but that forgoes checking that `index.ToString() == name`, which may be necessary. { this.Put(index, value); return; } base.Put(name, value); }