make Nimble compile with the changed compiler API

This commit is contained in:
Araq 2016-10-31 20:29:17 +01:00
commit 4ce6f2b395

View file

@ -8,10 +8,9 @@ import
compiler/ast, compiler/modules, compiler/passes, compiler/passaux, compiler/ast, compiler/modules, compiler/passes, compiler/passaux,
compiler/condsyms, compiler/sem, compiler/semdata, compiler/condsyms, compiler/sem, compiler/semdata,
compiler/llstream, compiler/vm, compiler/vmdef, compiler/commands, compiler/llstream, compiler/vm, compiler/vmdef, compiler/commands,
compiler/msgs, compiler/magicsys, compiler/lists compiler/msgs, compiler/magicsys, compiler/lists, compiler/idents
from compiler/scriptconfig import setupVM from compiler/scriptconfig import setupVM
from compiler/idents import getIdent
from compiler/astalgo import strTableGet from compiler/astalgo import strTableGet
import compiler/options as compiler_options import compiler/options as compiler_options
@ -67,6 +66,9 @@ proc extractRequires(ident: PSym, result: var seq[PkgTuple]) =
else: else:
raiseVariableError("requiresData", "seq[(string, VersionReq)]") raiseVariableError("requiresData", "seq[(string, VersionReq)]")
when declared(newIdentCache):
var identCache = newIdentCache()
proc setupVM(module: PSym; scriptName: string, proc setupVM(module: PSym; scriptName: string,
flags: StringTableRef): PEvalContext = flags: StringTableRef): PEvalContext =
## This procedure is exported in the compiler sources, but its implementation ## This procedure is exported in the compiler sources, but its implementation
@ -74,7 +76,10 @@ proc setupVM(module: PSym; scriptName: string,
## Specifically, the implementation of ``switch`` is problematic. Sooo ## Specifically, the implementation of ``switch`` is problematic. Sooo
## I simply copied it here and edited it :) ## I simply copied it here and edited it :)
result = newCtx(module) when declared(newIdentCache):
result = newCtx(module, identCache)
else:
result = newCtx(module)
result.mode = emRepl result.mode = emRepl
registerAdditionalOps(result) registerAdditionalOps(result)
@ -236,8 +241,12 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) =
cbApi getPkgDir: cbApi getPkgDir:
setResult(a, scriptName.splitFile.dir) setResult(a, scriptName.splitFile.dir)
compileSystemModule() when declared(newIdentCache):
processModule(m, llStreamOpen(scriptName, fmRead), nil) compileSystemModule(identCache)
processModule(m, llStreamOpen(scriptName, fmRead), nil, identCache)
else:
compileSystemModule()
processModule(m, llStreamOpen(scriptName, fmRead), nil)
proc cleanup() = proc cleanup() =
# ensure everything can be called again: # ensure everything can be called again: