implemented nullable type notation
This commit is contained in:
@@ -653,6 +653,32 @@ static _Bool step(Runtime *runtime, Error *error)
|
||||
return 1;
|
||||
}
|
||||
|
||||
case OPCODE_NLB:
|
||||
{
|
||||
ASSERT(opc == 0);
|
||||
|
||||
if(runtime->frame->used == 0)
|
||||
{
|
||||
Error_Report(error, 1, "Frame doesn't have enough items on the stack to execute NLB");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Object *top = Stack_Top(runtime->stack, 0);
|
||||
|
||||
if(!Runtime_Pop(runtime, error, 1))
|
||||
return 0;
|
||||
|
||||
ASSERT(top != NULL);
|
||||
|
||||
Object *nullable = Object_NewNullable(top, runtime->heap, error);
|
||||
if(nullable == NULL)
|
||||
return 0;
|
||||
|
||||
if(!Runtime_Push(runtime, error, nullable))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
case OPCODE_ADD:
|
||||
case OPCODE_SUB:
|
||||
case OPCODE_MUL:
|
||||
|
||||
Reference in New Issue
Block a user