Expose an API to let the host resolve relative import strings.

This is a breaking API change: wrenInterpret() now takes an additional
parameter for the module name to interpret the code in.
This commit is contained in:
Bob Nystrom
2018-03-23 07:54:09 -07:00
parent c5befa72cf
commit 8a71735e0f
12 changed files with 290 additions and 20 deletions
+2 -2
View File
@@ -228,7 +228,7 @@ void runFile(const char* path)
initVM();
WrenInterpretResult result = wrenInterpret(vm, source);
WrenInterpretResult result = wrenInterpret(vm, "main", source);
if (afterLoadFn != NULL) afterLoadFn(vm);
@@ -256,7 +256,7 @@ int runRepl()
printf("\\\\/\"-\n");
printf(" \\_/ wren v%s\n", WREN_VERSION_STRING);
wrenInterpret(vm, "import \"repl\"\n");
wrenInterpret(vm, "main", "import \"repl\"\n");
uv_run(loop, UV_RUN_DEFAULT);