feat: implement relative import resolution with normalized paths and update all test modules

Replace the flat module name-to-path mapping with a proper relative import resolver that handles "./" and "../" prefixes relative to the importer's directory. This is a breaking change: existing imports in user code that assume paths are relative to the entrypoint file will now fail. Stack trace output and host API calls now use the resolved module string instead of the short import name. Update all test fixtures to use "./" relative imports and adjust C test files to pass the full resolved module path to wrenGetVariable.
This commit is contained in:
Bob Nystrom
2018-03-24 18:10:36 +00:00
parent c4532102e8
commit 80bb3ebad7
41 changed files with 152 additions and 107 deletions
+4
View File
@@ -0,0 +1,4 @@
class Cthulu {
construct new() {}
message { "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn" }
}
+8
View File
@@ -0,0 +1,8 @@
import "./cthulu" for Cthulu
class Lovecraft {
construct new() {}
say() { Cthulu.new().message }
}
System.print(Lovecraft.new().say())