| 453 | } |
| 454 | |
| 455 | void fxConstructArrayBufferResult(txMachine* the, txSlot* constructor, txInteger length) |
| 456 | { |
| 457 | txSlot* instance; |
| 458 | if (constructor) |
| 459 | mxPushSlot(constructor); |
| 460 | else { |
| 461 | mxPushSlot(mxThis); |
| 462 | mxGetID(mxID(_constructor)); |
| 463 | fxToSpeciesConstructor(the, &mxArrayBufferConstructor); |
| 464 | } |
| 465 | mxNew(); |
| 466 | mxPushInteger(length); |
| 467 | mxRunCount(1); |
| 468 | if (the->stack->kind != XS_REFERENCE_KIND) |
| 469 | mxTypeError("not an object"); |
| 470 | instance = the->stack->value.reference; |
| 471 | if (!(instance->next) || (instance->next->kind != XS_ARRAY_BUFFER_KIND)) |
| 472 | mxTypeError("not an ArrayBuffer instance"); |
| 473 | if (!constructor && (mxThis->value.reference == instance)) |
| 474 | mxTypeError("same ArrayBuffer instance"); |
| 475 | if (instance->next->next->value.bufferInfo.length < length) |
| 476 | mxTypeError("smaller ArrayBuffer instance"); |
| 477 | mxPullSlot(mxResult); |
| 478 | } |
| 479 | |
| 480 | txSlot* fxNewArrayBufferInstance(txMachine* the) |
| 481 | { |
no test coverage detected