private static void DirectSetObjectProperty(object obj, string rhs, object value) { ArrayObject ary = obj as ArrayObject; StringObject str = obj as StringObject; ScriptObject js_obj = obj as ScriptObject; bool is_js_obj = js_obj != null; if (is_js_obj) { InvalidateCacheEntry(js_obj, rhs); } // Numeric index? uint index; if (IsArrayIndex(rhs, out index)) { if (ary != null) { Hashtable elems = ary.elems; bool had_value = elems.ContainsKey(index); elems [index] = value; if (!had_value) { AdjustArrayLength(ary, index); } return; } else if (str != null) { return; } } if (!TrySetNativeProperty(obj, rhs, value) && is_js_obj) { FieldInfo field = js_obj.GetField(rhs); if (field == null) { field = js_obj.AddField(rhs); } field.SetValue(rhs, value); } }