summary refs log tree commit diff stats
path: root/compiler/sem.nim
Commit message (Expand)AuthorAgeFilesLines
...
* extended system.type/typeof to support an upcoming 'collect' macro that works...Andreas Rumpf2018-09-111-4/+4
* change runnableExamples implementation; fixes #8641; fixes #7135; runnableExa...Andreas Rumpf2018-09-021-23/+0
* WIP: disallow 'nil' for strings and seqsAndreas Rumpf2018-08-131-1/+1
* fixes merge conflictAraq2018-08-071-1/+2
|\
| * runnableExamples: keep (gitignored) generated foo_examples.nim for inspection...Timothee Cour2018-08-071-1/+2
* | use slashes instead of dots for pathsAndreas Rumpf2018-08-061-2/+2
|/
* fixes #8323 : avoid polluting git status after `nim doc foo` (#8415)Timothee Cour2018-07-301-3/+5
* make runnableExamples use a private nimcache so that they can be tested in pa...skilchen2018-07-121-2/+9
* Check the RHS when building a set (#8159)LemonBoy2018-06-301-1/+1
* Return an error symbol as macro output if needed (#8116)LemonBoy2018-06-271-1/+6
* allow referencing other parameters in default parameter valuesZahary Karadjov2018-06-161-7/+11
* fixes #7222; fixes #5595; fixes #3747Zahary Karadjov2018-06-161-1/+1
* A minimal patch enabling the new typedesc and static types syntaxZahary Karadjov2018-06-161-0/+3
* implements a --nep1:on switch to make the compiler enforce the naming convent...Andreas Rumpf2018-06-131-1/+1
* fixex merge conflictsAraq2018-06-081-2/+4
|\
| * fixes #7906, array and openarray arg vs. ptr/ref generic (#7909)andri lim2018-06-041-2/+4
* | fixed merge conflictAndreas Rumpf2018-06-041-1/+1
|\|
| * fixes #7818, correct internal representation of generic objects array constru...andri lim2018-05-291-1/+1
* | incremental compilation: implemented basic replay logicAndreas Rumpf2018-06-021-8/+5
* | baby steps for incremental compilationAndreas Rumpf2018-05-301-7/+2
* | runnableExamples: use the self exe to test the examplesAndreas Rumpf2018-05-301-1/+1
* | refactoring: move DB model to incremental.nimAndreas Rumpf2018-05-301-2/+2
* | refactoring: remove idents.legacy global variable and pass the IdentCache aro...Andreas Rumpf2018-05-271-7/+7
* | more refactoringAndreas Rumpf2018-05-271-1/+1
* | Merge branch 'devel' into araq-big-refactoringAndreas Rumpf2018-05-271-0/+1
|\|
| * fix #7883; fix #7829Zahary Karadjov2018-05-261-0/+1
* | remove more global variables in the Nim compilerAndreas Rumpf2018-05-271-16/+16
* | preparations of making compiler/msgs.nim free of global variablesAndreas Rumpf2018-05-171-1/+1
* | remove ast.emptyNode global; cleanup configuration.nimAraq2018-05-161-1/+1
|/
* options.nim: no global variables anymoreAndreas Rumpf2018-05-131-5/+5
* sem pass compiles againAndreas Rumpf2018-05-121-22/+22
* more modules compile againAndreas Rumpf2018-05-121-13/+16
* more modules compile againAndreas Rumpf2018-05-121-24/+27
* compiler refactoring, pass config around explicitlyAndreas Rumpf2018-05-051-3/+3
* fixes #7601, array construction of ptr generics (#7671)andri lim2018-04-271-2/+3
* allow setting template/macro recursive evaluation limits (#7652)jcosborn2018-04-191-1/+1
* introduce nkTupleConstr AST node for unary tuple construction; breaking changeAndreas Rumpf2018-04-131-1/+1
* symbol files: delay the emission of forwarded procsAraq2018-02-211-0/+1
* symbol files: more progressAraq2018-02-201-1/+2
* new .rod file implementation; part 1: writing of the fileAraq2018-02-171-1/+2
* fixes #6946Andreas Rumpf2018-02-051-5/+10
* preparations for language extensions: 'sink' and 'lent' typesAndreas Rumpf2018-01-071-2/+2
* symbol files: fixes the logic for multi-methodsAraq2018-01-031-0/+4
* fixes #6972Araq2017-12-291-3/+3
* Implement language feature #6885 (#6954)cooldome2017-12-241-0/+13
* first steps in adding template/macro calls to stack tracesAraq2017-12-211-1/+1
* the documentation generator now supports system.runnableExamplesAraq2017-11-261-0/+13
* deprecated unary '<'Andreas Rumpf2017-10-291-1/+1
* Add sections (type, var, let, const, using) support for reorder pragma (#6326)BigEpsilon2017-10-281-1/+1
* destructors: work in progressAraq2017-10-261-8/+12
, {skTemplate, skMacro, skFunc, skMethod, skProc, skConverter}) proc callRoutine*(i: Interpreter; routine: PSym; args: openArray[PNode]): PNode = assert i != nil result = vm.execProc(PCtx i.graph.vm, routine, args) proc getGlobalValue*(i: Interpreter; letOrVar: PSym): PNode = result = vm.getGlobalValue(PCtx i.graph.vm, letOrVar) proc implementRoutine*(i: Interpreter; pkg, module, name: string; impl: proc (a: VmArgs) {.closure, gcsafe.}) = assert i != nil let vm = PCtx(i.graph.vm) vm.registerCallback(pkg & "." & module & "." & name, impl) proc evalScript*(i: Interpreter; scriptStream: PLLStream = nil) = ## This can also be used to *reload* the script. assert i != nil assert i.mainModule != nil, "no main module selected" initStrTable(i.mainModule.semtab(i.graph)) i.mainModule.ast = nil let s = if scriptStream != nil: scriptStream else: llStreamOpen(findFile(i.graph.config, i.scriptName), fmRead) processModule(i.graph, i.mainModule, i.idgen, s) proc findNimStdLib*(): string = ## Tries to find a path to a valid "system.nim" file. ## Returns "" on failure. try: let nimexe = os.findExe("nim") # this can't work with choosenim shims, refs https://github.com/dom96/choosenim/issues/189 # it'd need `nim dump --dump.format:json . | jq -r .libpath` # which we should simplify as `nim dump --key:libpath` if nimexe.len == 0: return "" result = nimexe.splitPath()[0] /../ "lib" if not fileExists(result / "system.nim"): when defined(unix): result = nimexe.expandSymlink.splitPath()[0] /../ "lib" if not fileExists(result / "system.nim"): return "" except OSError, ValueError: return "" proc findNimStdLibCompileTime*(): string = ## Same as `findNimStdLib` but uses source files used at compile time, ## and asserts on error. result = querySetting(libPath) doAssert fileExists(result / "system.nim"), "result:" & result proc createInterpreter*(scriptName: string; searchPaths: openArray[string]; flags: TSandboxFlags = {}, defines = @[("nimscript", "true")], registerOps = true): Interpreter = var conf = newConfigRef() var cache = newIdentCache() var graph = newModuleGraph(cache, conf) connectCallbacks(graph) initDefines(conf.symbols) for define in defines: defineSymbol(conf.symbols, define[0], define[1]) registerPass(graph, semPass) registerPass(graph, evalPass) for p in searchPaths: conf.searchPaths.add(AbsoluteDir p) if conf.libpath.isEmpty: conf.libpath = AbsoluteDir p var m = graph.makeModule(scriptName) incl(m.flags, sfMainModule) var idgen = idGeneratorFromModule(m) var vm = newCtx(m, cache, graph, idgen) vm.mode = emRepl vm.features = flags if registerOps: vm.registerAdditionalOps() # Required to register parts of stdlib modules graph.vm = vm graph.compileSystemModule() result = Interpreter(mainModule: m, graph: graph, scriptName: scriptName, idgen: idgen) proc destroyInterpreter*(i: Interpreter) = ## destructor. discard "currently nothing to do." proc registerErrorHook*(i: Interpreter, hook: proc (config: ConfigRef; info: TLineInfo; msg: string; severity: Severity) {.gcsafe.}) = i.graph.config.structuredErrorHook = hook proc runRepl*(r: TLLRepl; searchPaths: openArray[string]; supportNimscript: bool) = ## deadcode but please don't remove... might be revived var conf = newConfigRef() var cache = newIdentCache() var graph = newModuleGraph(cache, conf) for p in searchPaths: conf.searchPaths.add(AbsoluteDir p) if conf.libpath.isEmpty: conf.libpath = AbsoluteDir p conf.cmd = cmdInteractive # see also `setCmd` conf.setErrorMaxHighMaybe initDefines(conf.symbols) defineSymbol(conf.symbols, "nimscript") if supportNimscript: defineSymbol(conf.symbols, "nimconfig") when hasFFI: defineSymbol(graph.config.symbols, "nimffi") registerPass(graph, verbosePass) registerPass(graph, semPass) registerPass(graph, evalPass) var m = graph.makeStdinModule() incl(m.flags, sfMainModule) var idgen = idGeneratorFromModule(m) if supportNimscript: graph.vm = setupVM(m, cache, "stdin", graph, idgen) graph.compileSystemModule() processModule(graph, m, idgen, llStreamOpenStdIn(r))