6868
6969 CodeGen * {.acyclic .} = ref object
7070 # # a code generator for a module or proc.
71- includePath : Option [string ]
71+ includeBasePath : Option [string ]
7272 # # the base path for including partials
7373 script: Script
7474 # the script all procs go into
@@ -1547,7 +1547,9 @@ proc genProc*(node: Node, isInstantiation = false): Sym {.codegen.} =
15471547 # add the proc into the script
15481548 gen.script.procs.add (theProc)
15491549 if sym.procExport:
1550- # export the proc if needed (exported procs need to be in procsExport for the runtime to find them, but they also need to be in procs for the compiler to compile them, so we add them to both)
1550+ # export the proc if needed (exported procs need to be in procsExport
1551+ # for the runtime to find them, but they also need to be in procs for
1552+ # the compiler to compile them, so we add them to both)
15511553 gen.script.procsExport.add (theProc)
15521554
15531555 # compile the proc's body
@@ -2328,13 +2330,13 @@ proc genImport*(node: Node) {.codegen.} =
23282330
23292331 # generate the module's script based
23302332 # on the parsed module AST program
2331- moduleGen.genScript (astProgram, gen.includePath )
2333+ moduleGen.genScript (astProgram, gen.includeBasePath )
23322334
23332335 # once the module is generated, we can load it
23342336 # into the current module
23352337 if not gen.module.load (moduleGen.module, fromOtherModule = true ):
23362338 node.warn (WarnModuleAlreadyImported % pathNode.stringVal)
2337-
2339+
23382340 # add the module to the current script's modules
23392341 gen.script.scripts[importChunk.file] = moduleGen.script
23402342
@@ -2343,13 +2345,13 @@ proc genImport*(node: Node) {.codegen.} =
23432345 gen.chunk.emit (gen.chunk.getString (importChunk.file))
23442346
23452347 of nkInclude:
2346- if gen.includePath.isSome:
2347- # if the include path is set,
2348- # we can use it to resolve the module
2349- path = absolutePath (gen.includePath.get () / path)
2348+ if gen.includeBasePath.isSome:
2349+ # if the include path is set, we can use it to resolve the module
2350+ path = absolutePath (gen.includeBasePath.get () / path)
23502351
23512352 # resolve the module's path
23522353 let aFile = absolutePath (gen.module.src.get ())
2354+
23532355 try :
23542356 gen.resolver.resolveFile (aFile, path)
23552357 except ResolverError as e:
@@ -2429,7 +2431,7 @@ proc genBlock*(node: Node, isStmt: bool): Sym {.codegen.} =
24292431proc genScript * (program: Ast , includePath: Option [string ],
24302432 emitHalt: static bool = true ) {.codegen .} =
24312433 # # Generates the code for a full script.
2432- gen.includePath = includePath
2434+ gen.includeBasePath = includePath
24332435 for node in program.nodes:
24342436 gen.genStmt (node)
24352437 when emitHalt == true :
0 commit comments