static bool set(ExecState* exec, JSValue& object, const String& keyPathElement, JSValue jsValue) { if (!canSet(object, keyPathElement)) return false; Identifier identifier = Identifier::fromString(&exec->vm(), keyPathElement.utf8().data()); asObject(object)->putDirect(exec->vm(), identifier, jsValue); return true; }
static bool canInjectNthValueOnKeyPath(ExecState* exec, JSValue rootValue, const Vector<String>& keyPathElements, size_t index) { if (!rootValue.isObject()) return false; JSValue currentValue(rootValue); ASSERT(index <= keyPathElements.size()); for (size_t i = 0; i < index; ++i) { JSValue parentValue(currentValue); const String& keyPathElement = keyPathElements[i]; if (!get(exec, parentValue, keyPathElement, currentValue)) return canSet(parentValue, keyPathElement); } return true; }
static bool canInjectNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index, v8::Isolate* isolate) { if (!rootValue->IsObject()) return false; v8::Handle<v8::Value> currentValue(rootValue); ASSERT(index <= keyPathElements.size()); for (size_t i = 0; i < index; ++i) { v8::Handle<v8::Value> parentValue(currentValue); const String& keyPathElement = keyPathElements[i]; if (!get(parentValue, keyPathElement, currentValue, isolate)) return canSet(parentValue, keyPathElement); } return true; }
static bool set(v8::Handle<v8::Value>& object, const String& keyPathElement, const v8::Handle<v8::Value>& v8Value, v8::Isolate* isolate) { return canSet(object, keyPathElement) && setValue(object, v8String(isolate, keyPathElement), v8Value); }
static bool set(v8::Handle<v8::Value>& object, const String& keyPathElement, const v8::Handle<v8::Value>& v8Value) { return canSet(object, keyPathElement) && setValue(object, deprecatedV8String(keyPathElement), v8Value); }