make Nimble compile with the changed compiler API
This commit is contained in:
parent
e3682c96b3
commit
4ce6f2b395
1 changed files with 14 additions and 5 deletions
|
|
@ -8,10 +8,9 @@ import
|
|||
compiler/ast, compiler/modules, compiler/passes, compiler/passaux,
|
||||
compiler/condsyms, compiler/sem, compiler/semdata,
|
||||
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/idents import getIdent
|
||||
from compiler/astalgo import strTableGet
|
||||
import compiler/options as compiler_options
|
||||
|
||||
|
|
@ -67,6 +66,9 @@ proc extractRequires(ident: PSym, result: var seq[PkgTuple]) =
|
|||
else:
|
||||
raiseVariableError("requiresData", "seq[(string, VersionReq)]")
|
||||
|
||||
when declared(newIdentCache):
|
||||
var identCache = newIdentCache()
|
||||
|
||||
proc setupVM(module: PSym; scriptName: string,
|
||||
flags: StringTableRef): PEvalContext =
|
||||
## 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
|
||||
## 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
|
||||
registerAdditionalOps(result)
|
||||
|
||||
|
|
@ -236,8 +241,12 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) =
|
|||
cbApi getPkgDir:
|
||||
setResult(a, scriptName.splitFile.dir)
|
||||
|
||||
compileSystemModule()
|
||||
processModule(m, llStreamOpen(scriptName, fmRead), nil)
|
||||
when declared(newIdentCache):
|
||||
compileSystemModule(identCache)
|
||||
processModule(m, llStreamOpen(scriptName, fmRead), nil, identCache)
|
||||
else:
|
||||
compileSystemModule()
|
||||
processModule(m, llStreamOpen(scriptName, fmRead), nil)
|
||||
|
||||
proc cleanup() =
|
||||
# ensure everything can be called again:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue