fixes yet another gensym regression (#12145)
This commit is contained in:
parent
0882a09986
commit
488f3ed085
4 changed files with 34 additions and 10 deletions
|
|
@ -251,15 +251,15 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
|
||||||
of OverloadableSyms:
|
of OverloadableSyms:
|
||||||
result = symChoice(c, n, s, scOpen, isField)
|
result = symChoice(c, n, s, scOpen, isField)
|
||||||
of skGenericParam:
|
of skGenericParam:
|
||||||
if isField: result = n
|
if isField and sfGenSym in s.flags: result = n
|
||||||
else: result = newSymNodeTypeDesc(s, n.info)
|
else: result = newSymNodeTypeDesc(s, n.info)
|
||||||
of skParam:
|
of skParam:
|
||||||
result = n
|
result = n
|
||||||
of skType:
|
of skType:
|
||||||
if isField: result = n
|
if isField and sfGenSym in s.flags: result = n
|
||||||
else: result = newSymNodeTypeDesc(s, n.info)
|
else: result = newSymNodeTypeDesc(s, n.info)
|
||||||
else:
|
else:
|
||||||
if isField: result = n
|
if isField and sfGenSym in s.flags: result = n
|
||||||
else: result = newSymNode(s, n.info)
|
else: result = newSymNode(s, n.info)
|
||||||
|
|
||||||
proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode =
|
proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode =
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,18 @@ template templ*(): int =
|
||||||
bind gx, gy
|
bind gx, gy
|
||||||
gx + gy
|
gx + gy
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
const
|
||||||
|
codeField = "foobar"
|
||||||
|
messageField = "more"
|
||||||
|
|
||||||
|
template trap*(path: string, body: untyped): untyped =
|
||||||
|
#bind codeField, messageField
|
||||||
|
try:
|
||||||
|
body
|
||||||
|
except:
|
||||||
|
let msg = getCurrentExceptionMsg()
|
||||||
|
#debug "Error occurred within RPC ", path = path, errorMessage = msg
|
||||||
|
result = %*{codeField: "SERVER_ERROR", messageField: msg}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ a
|
||||||
hi
|
hi
|
||||||
Hello, World!
|
Hello, World!
|
||||||
(e: 42)
|
(e: 42)
|
||||||
|
hey
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -235,3 +236,12 @@ var
|
||||||
x = X.fails(42)
|
x = X.fails(42)
|
||||||
|
|
||||||
echo x
|
echo x
|
||||||
|
|
||||||
|
import mtempl5
|
||||||
|
|
||||||
|
|
||||||
|
proc foo(): auto =
|
||||||
|
trap "foo":
|
||||||
|
echo "hey"
|
||||||
|
|
||||||
|
discard foo()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue