fixes some regressions
This commit is contained in:
parent
5aaf2f0c31
commit
bf698fbc2a
4 changed files with 18 additions and 5 deletions
|
|
@ -581,6 +581,11 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode =
|
||||||
localError(n.info, errInvalidExpression)
|
localError(n.info, errInvalidExpression)
|
||||||
result = n
|
result = n
|
||||||
|
|
||||||
|
proc stupidStmtListExpr(n: PNode): bool =
|
||||||
|
for i in 0 .. n.len-2:
|
||||||
|
if n[i].kind notin {nkEmpty, nkCommentStmt}: return false
|
||||||
|
result = true
|
||||||
|
|
||||||
result = n
|
result = n
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkIdent:
|
of nkIdent:
|
||||||
|
|
@ -606,6 +611,12 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode =
|
||||||
localError(n.info, errInvalidExpression)
|
localError(n.info, errInvalidExpression)
|
||||||
else:
|
else:
|
||||||
localError(n.info, errInvalidExpression)
|
localError(n.info, errInvalidExpression)
|
||||||
|
of nkStmtList, nkStmtListExpr:
|
||||||
|
if stupidStmtListExpr(n):
|
||||||
|
result = semPatternBody(c, n.lastSon)
|
||||||
|
else:
|
||||||
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
|
result.sons[i] = semPatternBody(c, n.sons[i])
|
||||||
of nkCallKinds:
|
of nkCallKinds:
|
||||||
let s = qualifiedLookUp(c.c, n.sons[0], {})
|
let s = qualifiedLookUp(c.c, n.sons[0], {})
|
||||||
if s != nil:
|
if s != nil:
|
||||||
|
|
|
||||||
|
|
@ -1461,6 +1461,8 @@ proc evalConstExprAux(module, prc: PSym, n: PNode, mode: TEvalMode): PNode =
|
||||||
let n = transformExpr(module, n)
|
let n = transformExpr(module, n)
|
||||||
setupGlobalCtx(module)
|
setupGlobalCtx(module)
|
||||||
var c = globalCtx
|
var c = globalCtx
|
||||||
|
let oldMode = c.mode
|
||||||
|
defer: c.mode = oldMode
|
||||||
c.mode = mode
|
c.mode = mode
|
||||||
let start = genExpr(c, n, requiresValue = mode!=emStaticStmt)
|
let start = genExpr(c, n, requiresValue = mode!=emStaticStmt)
|
||||||
if c.code[start].opcode == opcEof: return emptyNode
|
if c.code[start].opcode == opcEof: return emptyNode
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tbind2.nim"
|
file: "tbind2.nim"
|
||||||
line: 14
|
line: 12
|
||||||
errormsg: "ambiguous call"
|
errormsg: "ambiguous call"
|
||||||
"""
|
"""
|
||||||
# Test the new ``bind`` keyword for templates
|
# Test the new ``bind`` keyword for templates
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: "'"
|
output: "####"
|
||||||
file: "sequtils.nim"
|
|
||||||
line: 435
|
|
||||||
"""
|
"""
|
||||||
# unfortunately our tester doesn't support multiple lines of compiler
|
# unfortunately our tester doesn't support multiple lines of compiler
|
||||||
# error messages yet...
|
# error messages yet...
|
||||||
|
|
@ -29,4 +27,6 @@ when ATTEMPT == 0:
|
||||||
# bug #1543
|
# bug #1543
|
||||||
import sequtils
|
import sequtils
|
||||||
|
|
||||||
(var i= @[""];i).mapIt(it)
|
(var i = @[""];i).mapIt(it)
|
||||||
|
# now works:
|
||||||
|
echo "##", i[0], "##"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue