| 490 | } |
| 491 | |
| 492 | Value jsArrayToValue(IJavaScriptContext& jsContext, |
| 493 | const JSValue& jsValue, |
| 494 | const ReferenceInfoBuilder& referenceInfoBuilder, |
| 495 | JSExceptionTracker& exceptionTracker) { |
| 496 | auto arrayLength = jsArrayGetLength(jsContext, jsValue, exceptionTracker); |
| 497 | if (!exceptionTracker) { |
| 498 | return Value::undefined(); |
| 499 | } |
| 500 | |
| 501 | auto array = Valdi::ValueArray::make(arrayLength); |
| 502 | |
| 503 | for (size_t i = 0; i < arrayLength; i++) { |
| 504 | auto propertyValue = jsContext.getObjectPropertyForIndex(jsValue, i, exceptionTracker); |
| 505 | if (!exceptionTracker) { |
| 506 | return Value::undefined(); |
| 507 | } |
| 508 | |
| 509 | auto convertedValue = |
| 510 | jsValueToValue(jsContext, propertyValue.get(), referenceInfoBuilder.withArrayIndex(i), exceptionTracker); |
| 511 | if (!exceptionTracker) { |
| 512 | return Value::undefined(); |
| 513 | } |
| 514 | |
| 515 | array->emplace(i, std::move(convertedValue)); |
| 516 | } |
| 517 | |
| 518 | return Value(array); |
| 519 | } |
| 520 | |
| 521 | STRING_CONST(refKey, "$ref"); |
| 522 |
no test coverage detected