bug fixed. GOTO jumped over the definition of the returned variable
This commit is contained in:
+10
-4
@@ -577,6 +577,7 @@ static _Bool step(Runtime *runtime, Error *error)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Heap *heap = Runtime_GetHeap(runtime);
|
Heap *heap = Runtime_GetHeap(runtime);
|
||||||
|
assert(heap != NULL);
|
||||||
|
|
||||||
if(Object_IsInt(top))
|
if(Object_IsInt(top))
|
||||||
{
|
{
|
||||||
@@ -667,7 +668,7 @@ static _Bool step(Runtime *runtime, Error *error)
|
|||||||
|
|
||||||
if(!Runtime_Push(runtime, error, res))
|
if(!Runtime_Push(runtime, error, res))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OPCODE_EQL:
|
case OPCODE_EQL:
|
||||||
@@ -843,7 +844,12 @@ static _Bool step(Runtime *runtime, Error *error)
|
|||||||
// NOTE: Every local object reference is invalidated from here.
|
// NOTE: Every local object reference is invalidated from here.
|
||||||
|
|
||||||
if(obj == NULL)
|
if(obj == NULL)
|
||||||
|
{
|
||||||
|
assert(error->occurred != 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(error->occurred == 0);
|
||||||
|
|
||||||
if(!Runtime_Push(runtime, error, obj))
|
if(!Runtime_Push(runtime, error, obj))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1269,6 +1275,9 @@ Object *run(Runtime *runtime, Error *error, Executable *exe, int index, Object *
|
|||||||
runtime->depth += 1;
|
runtime->depth += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is what the function will return.
|
||||||
|
Object *result = NULL;
|
||||||
|
|
||||||
// Push the initial values of the frame.
|
// Push the initial values of the frame.
|
||||||
for(int i = 0; i < argc; i += 1)
|
for(int i = 0; i < argc; i += 1)
|
||||||
if(!Runtime_Push(runtime, error, argv[i]))
|
if(!Runtime_Push(runtime, error, argv[i]))
|
||||||
@@ -1306,9 +1315,6 @@ Object *run(Runtime *runtime, Error *error, Executable *exe, int index, Object *
|
|||||||
//printf("%2.2f%% percent.\n", Heap_GetUsagePercentage(runtime->heap));
|
//printf("%2.2f%% percent.\n", Heap_GetUsagePercentage(runtime->heap));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is what the function will return.
|
|
||||||
Object *result = NULL;
|
|
||||||
|
|
||||||
// If an error occurred, we want to return NULL.
|
// If an error occurred, we want to return NULL.
|
||||||
if(error->occurred == 0)
|
if(error->occurred == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user