cleanups
This commit is contained in:
@@ -56,6 +56,23 @@ struct xRuntime {
|
||||
Heap *heap;
|
||||
};
|
||||
|
||||
const char *Runtime_GetCurrentScriptAbsolutePath(Runtime *runtime)
|
||||
{
|
||||
Executable *exe = Runtime_GetCurrentExecutable(runtime);
|
||||
assert(exe != NULL);
|
||||
|
||||
Source *src = Executable_GetSource(exe);
|
||||
if(src == NULL)
|
||||
return NULL;
|
||||
|
||||
const char *path = Source_GetAbsolutePath(src);
|
||||
if(path == NULL)
|
||||
return NULL;
|
||||
|
||||
assert(path[0] != '\0');
|
||||
return path;
|
||||
}
|
||||
|
||||
Stack *Runtime_GetStack(Runtime *runtime)
|
||||
{
|
||||
return Stack_Copy(runtime->stack, 1);
|
||||
|
||||
@@ -51,6 +51,7 @@ Object* Runtime_GetBuiltins(Runtime *runtime);
|
||||
void Runtime_SetBuiltins(Runtime *runtime, Object *builtins);
|
||||
int Runtime_GetCurrentIndex(Runtime *runtime);
|
||||
Executable *Runtime_GetCurrentExecutable(Runtime *runtime);
|
||||
const char *Runtime_GetCurrentScriptAbsolutePath(Runtime *runtime);
|
||||
Snapshot *Snapshot_New(Runtime *runtime);
|
||||
void Snapshot_Free(Snapshot *snapshot);
|
||||
void Snapshot_Print(Snapshot *snapshot, FILE *fp);
|
||||
|
||||
Reference in New Issue
Block a user