diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgcalls.nim | 1 | ||||
-rw-r--r-- | compiler/ccgexprs.nim | 2 | ||||
-rw-r--r-- | compiler/ccgtypes.nim | 4 | ||||
-rw-r--r-- | compiler/docgen.nim | 6 | ||||
-rw-r--r-- | compiler/parser.nim | 5 | ||||
-rw-r--r-- | compiler/renderer.nim | 10 | ||||
-rw-r--r-- | compiler/vmdef.nim | 2 |
7 files changed, 19 insertions, 11 deletions
diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index 4c8fa7147..cefa89289 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -20,6 +20,7 @@ proc hasNoInit(call: PNode): bool {.inline.} = proc fixupCall(p: BProc, le, ri: PNode, d: var TLoc, callee, params: Rope) = + genLineDir(p, ri) var pl = callee & ~"(" & params # getUniqueType() is too expensive here: var typ = skipTypes(ri.sons[0].typ, abstractInst) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 7de5e5606..28aa875bc 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2453,7 +2453,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = putIntoDest(p, d, n, genLiteral(p, n)) of nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: - genLineDir(p, n) + genLineDir(p, n) # may be redundant, it is generated in fixupCall as well let op = n.sons[0] if n.typ.isNil: # discard the value: diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 51f04d076..f4864180e 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -246,8 +246,8 @@ proc cacheGetType(tab: TypeCache; sig: SigHash): Rope = result = tab.getOrDefault(sig) proc addAbiCheck(m: BModule, t: PType, name: Rope) = - if isDefined(m.config, "checkabi"): - addf(m.s[cfsTypeInfo], "NIM_CHECK_SIZE($1, $2);$n", [name, rope(getSize(m.config, t))]) + if isDefined(m.config, "checkabi") and (let size = getSize(m.config, t); size != szUnknownSize): + addf(m.s[cfsTypeInfo], "NIM_CHECK_SIZE($1, $2);$n", [name, rope(size)]) proc ccgIntroducedPtr(conf: ConfigRef; s: PSym): bool = var pt = skipTypes(s.typ, typedescInst) diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 34baacfb9..2c7e52c67 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -344,9 +344,9 @@ proc nodeToHighlightedHtml(d: PDoc; n: PNode; result: var Rope; renderFlags: TRe if procTokenPos == tokenPos-2 and procLink != nil: dispA(d.conf, result, "<a href=\"#$2\"><span class=\"Identifier\">$1</span></a>", "\\spanIdentifier{$1}", [rope(esc(d.target, literal)), procLink]) - elif s != nil and s.kind == skType and sfExported in s.flags and - s.owner != nil and belongsToPackage(d.conf, s.owner) and - d.target == outHtml: + elif s != nil and s.kind in {skType, skVar, skLet, skConst} and + sfExported in s.flags and s.owner != nil and + belongsToPackage(d.conf, s.owner) and d.target == outHtml: let external = externalDep(d, s.owner) result.addf "<a href=\"$1#$2\"><span class=\"Identifier\">$3</span></a>", [rope changeFileExt(external, "html"), rope literal, diff --git a/compiler/parser.nim b/compiler/parser.nim index 1acfe1b98..95ec5f765 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -400,7 +400,8 @@ proc exprList(p: var TParser, endTok: TTokType, result: PNode) = proc exprColonEqExprListAux(p: var TParser, endTok: TTokType, result: PNode) = assert(endTok in {tkCurlyRi, tkCurlyDotRi, tkBracketRi, tkParRi}) getTok(p) - optInd(p, result) + flexComment(p, result) + optPar(p) # progress guaranteed while p.tok.tokType != endTok and p.tok.tokType != tkEof: var a = exprColonEqExpr(p) @@ -2085,7 +2086,7 @@ proc parseConstant(p: var TParser): PNode = addSon(result, p.emptyNode) eat(p, tkEquals) optInd(p, result) - addSon(result, parseExpr(p)) + addSon(result, parseStmtListExpr(p)) indAndComment(p, result) proc parseBind(p: var TParser, k: TNodeKind): PNode = diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 2fef1234a..832add378 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -1217,8 +1217,14 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = else: put(g, tkDistinct, "distinct") of nkTypeDef: - gsub(g, n, 0) - gsub(g, n, 1) + if n.sons[0].kind == nkPragmaExpr: + # generate pragma after generic + gsub(g, n.sons[0], 0) + gsub(g, n, 1) + gsub(g, n.sons[0], 1) + else: + gsub(g, n, 0) + gsub(g, n, 1) put(g, tkSpaces, Space) if n.len > 2 and n.sons[2].kind != nkEmpty: putWithSpace(g, tkEquals, "=") diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index 6099bfb9f..608f20526 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -17,7 +17,7 @@ const byteExcess* = 128 # we use excess-K for immediates wordExcess* = 32768 - MaxLoopIterations* = 3_000_000 # max iterations of all loops + MaxLoopIterations* = 10_000_000 # max iterations of all loops type |