- added a 'new' intrinsic to create new objects from inside scripts.

This is not tested yet and likely to not working correctly yet. Will be fixed once I get far enough to use it later.
This commit is contained in:
Christoph Oelckers 2017-02-03 22:56:03 +01:00
commit 8578a5a12e
6 changed files with 106 additions and 0 deletions

View file

@ -759,6 +759,14 @@ begin:
assert(0);
NEXTOP;
OP(NEW_K):
OP(NEW):
{
PClass *cls = (PClass*)(op == OP_NEW ? reg.a[C] : konsta[C].v);
reg.a[B] = cls->CreateNew();
NEXTOP;
}
OP(TRY):
assert(try_depth < MAX_TRY_DEPTH);
if (try_depth >= MAX_TRY_DEPTH)