bug fix
This commit is contained in:
@@ -82,6 +82,11 @@ static const InstrInfo instr_table[] = {
|
||||
[OPCODE_JUMP] = {"JUMP", 1, (OperandType[]) {OPTP_INT}},
|
||||
};
|
||||
|
||||
const char *Executable_GetOpcodeName(Opcode opcode)
|
||||
{
|
||||
return instr_table[opcode].name;
|
||||
}
|
||||
|
||||
Executable *Executable_Copy(Executable *exe)
|
||||
{
|
||||
assert(exe != NULL);
|
||||
|
||||
@@ -70,6 +70,7 @@ _Bool Executable_SetSource(Executable *exe, Source *src);
|
||||
Source *Executable_GetSource(Executable *exe);
|
||||
int Executable_GetInstrOffset(Executable *exe, int index);
|
||||
int Executable_GetInstrLength(Executable *exe, int index);
|
||||
const char *Executable_GetOpcodeName(Opcode opcode);
|
||||
|
||||
ExeBuilder *ExeBuilder_New(BPAlloc *alloc);
|
||||
_Bool ExeBuilder_Append(ExeBuilder *exeb, Error *error, Opcode opcode, Operand *opv, int opc, int off, int len);
|
||||
|
||||
+13
-2
@@ -530,7 +530,7 @@ static Object *do_relational_op(Object *lop, Object *rop, Opcode opcode, Heap *h
|
||||
static _Bool step(Runtime *runtime, Error *error)
|
||||
{
|
||||
assert(runtime != NULL);
|
||||
assert(error->occurred != 0);
|
||||
assert(error->occurred == 0);
|
||||
Opcode opcode;
|
||||
Operand ops[3];
|
||||
int opc = sizeof(ops) / sizeof(ops[0]);
|
||||
@@ -815,18 +815,29 @@ static _Bool step(Runtime *runtime, Error *error)
|
||||
if(!Runtime_Pop(runtime, error, 2))
|
||||
return 0;
|
||||
|
||||
Object *val = Object_Select(col, key, runtime->heap, error);
|
||||
assert(error->occurred == 0);
|
||||
|
||||
Error dummy;
|
||||
Error_Init(&dummy); // We want to catch the error reported by this Object_Select.
|
||||
|
||||
Object *val = Object_Select(col, key, runtime->heap, &dummy);
|
||||
|
||||
if(val == NULL)
|
||||
{
|
||||
Error_Free(&dummy);
|
||||
|
||||
val = Object_NewNone(runtime->heap, error);
|
||||
|
||||
if(val == NULL)
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(error->occurred == 0);
|
||||
|
||||
if(!Runtime_Push(runtime, error, val))
|
||||
return 0;
|
||||
|
||||
assert(error->occurred == 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user