diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cgen.nim | 2 | ||||
-rw-r--r-- | compiler/docgen.nim | 10 | ||||
-rw-r--r-- | compiler/installer.ini | 1 | ||||
-rw-r--r-- | compiler/semexprs.nim | 2 | ||||
-rw-r--r-- | compiler/vm.nim | 10 | ||||
-rw-r--r-- | compiler/vmgen.nim | 3 |
6 files changed, 20 insertions, 8 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 2db92bc21..3040f98da 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -707,7 +707,7 @@ proc containsResult(n: PNode): bool = for i in 0..<n.safeLen: if containsResult(n[i]): return true -const harmless = {nkConstSection, nkTypeSection, nkEmpty, nkCommentStmt} + +const harmless = {nkConstSection, nkTypeSection, nkEmpty, nkCommentStmt, nkTemplateDef, nkMacroDef} + declarativeDefs proc easyResultAsgn(n: PNode): PNode = diff --git a/compiler/docgen.nim b/compiler/docgen.nim index e7920ad06..83dd5de2a 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -976,10 +976,12 @@ proc commandRstAux(cache: IdentCache, conf: ConfigRef; # Nim's convention: every path is relative to the file it was written in: outp = splitFile(d.filename).dir.AbsoluteDir / RelativeFile(filename) writeFile(outp, content) - let cmd = cmd % quoteShell(outp) - rawMessage(conf, hintExecuting, cmd) - if execShellCmd(cmd) != status: - rawMessage(conf, errGenerated, "executing of external program failed: " & cmd) + let c = if cmd.startsWith("nim "): os.getAppFilename() & cmd.substr(3) + else: cmd + let c2 = c % quoteShell(outp) + rawMessage(conf, hintExecuting, c2) + if execShellCmd(c2) != status: + rawMessage(conf, errGenerated, "executing of external program failed: " & c2) d.isPureRst = true var rst = parseRst(readFile(filen.string), filen.string, 0, 1, d.hasToc, diff --git a/compiler/installer.ini b/compiler/installer.ini index 79eb7178a..2d3a92b32 100644 --- a/compiler/installer.ini +++ b/compiler/installer.ini @@ -68,6 +68,7 @@ Files: "compiler" Files: "doc" Files: "doc/html" Files: "tools" +Files: "nimpretty" Files: "nimsuggest" Files: "nimsuggest/tests/*.nim" Files: "web/website.ini" diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 61c530f61..e683984c5 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1560,6 +1560,8 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode = rhsTyp = rhsTyp.lastSon if cmpTypes(c, lhs.typ, rhsTyp) in {isGeneric, isEqual}: internalAssert c.config, c.p.resultSym != nil + # Make sure the type is valid for the result variable + typeAllowedCheck(c.config, n.info, rhsTyp, skResult) lhs.typ = rhsTyp c.p.resultSym.typ = rhsTyp c.p.owner.typ.sons[0] = rhsTyp diff --git a/compiler/vm.nim b/compiler/vm.nim index e38642de8..faff81697 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -557,11 +557,15 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = # a = b.c decodeBC(rkNode) let src = regs[rb].node - if src.kind notin {nkEmpty..nkNilLit}: - let n = src.sons[rc + ord(src.kind == nkObjConstr)].skipColon + case src.kind + of nkEmpty..nkNilLit: + stackTrace(c, tos, pc, errNilAccess) + of nkObjConstr: + let n = src.sons[rc + 1].skipColon regs[ra].node = n else: - stackTrace(c, tos, pc, errNilAccess) + let n = src.sons[rc] + regs[ra].node = n of opcWrObj: # a.b = c decodeBC(rkNode) diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index e87347ec8..b6b5bf4f2 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -1842,6 +1842,9 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) = let s = n.sons[0].sym if s.magic != mNone: genMagic(c, n, dest, s.magic) + elif s.kind == skMethod: + localError(c.config, n.info, "cannot call method " & s.name.s & + " at compile time") elif matches(s, "stdlib", "marshal", "to"): # XXX marshal load&store should not be opcodes, but use the # general callback mechanisms. |