| 4576 | } |
| 4577 | |
| 4578 | void fxRunExtends(txMachine* the) |
| 4579 | { |
| 4580 | txSlot* constructor; |
| 4581 | txSlot* prototype; |
| 4582 | |
| 4583 | constructor = fxGetInstance(the, the->stack); |
| 4584 | if (!mxIsConstructor(constructor)) |
| 4585 | mxTypeError("extends: class is not a constructor"); |
| 4586 | mxPushUndefined(); |
| 4587 | prototype = the->stack; |
| 4588 | fxBeginHost(the); |
| 4589 | mxPushReference(constructor); |
| 4590 | mxGetID(mxID(_prototype)); |
| 4591 | *prototype = *the->stack; |
| 4592 | fxEndHost(the); |
| 4593 | if (the->stack->kind == XS_NULL_KIND) { |
| 4594 | mxPop(); |
| 4595 | fxNewInstance(the); |
| 4596 | } |
| 4597 | else if (the->stack->kind == XS_REFERENCE_KIND) { |
| 4598 | if (the->stack->value.reference->value.instance.prototype == mxGeneratorPrototype.value.reference) |
| 4599 | mxTypeError("extends: class is a generator"); |
| 4600 | fxNewHostInstance(the); |
| 4601 | } |
| 4602 | else |
| 4603 | mxTypeError("extends: class prototype is not an object"); |
| 4604 | } |
| 4605 | |
| 4606 | void fxRunEval(txMachine* the) |
| 4607 | { |
no test coverage detected