| 762 | } |
| 763 | if (!obj->IsObject()) { |
| 764 | exceptionTracker.onError("Cannot set property on non object"); |
| 765 | return; |
| 766 | } |
| 767 | auto key = fromValdiJSValue(_isolate, propertyName, exceptionTracker); |
| 768 | if (!exceptionTracker) { |
| 769 | return; |
| 770 | } |
| 771 | auto val = fromValdiJSValue(_isolate, object, exceptionTracker); |
| 772 | if (!exceptionTracker) { |
| 773 | return; |
| 774 | } |
| 775 | |
| 776 | if (key->IsName()) { |
| 777 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 778 | auto keyName = v8::Local<v8::Name>::Cast(key); |
| 779 | setObjectPropertyHelper(context, obj, keyName, val, enumerable, exceptionTracker); |
| 780 | } else if (key->IsInt32()) { |
| 781 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 782 | auto index = v8::Local<v8::Int32>::Cast(key)->Value(); |
| 783 | setObjectPropertyIndexHelper(context, obj, index, val, enumerable, exceptionTracker); |
| 784 | } else { |
| 785 | exceptionTracker.onError("Failed to set key object because it does not belong to a supported type"); |
| 786 | } |
| 787 | } |
nothing calls this directly
no test coverage detected