From 4ce6f2b39526f6570834a8c0eb786b098bbf52e8 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 31 Oct 2016 20:29:17 +0100 Subject: [PATCH] make Nimble compile with the changed compiler API --- src/nimblepkg/nimscriptsupport.nim | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index c528c8b..093a64a 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -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: