fixes #1860; macro generating a wrong nkSymChoice node
This commit is contained in:
parent
b14cc1e3b2
commit
a155130cf2
2 changed files with 11 additions and 3 deletions
|
|
@ -46,7 +46,11 @@ proc considerQuotedIdent*(n: PNode, origin: PNode = nil): PIdent =
|
||||||
of nkSym: id.add(x.sym.name.s)
|
of nkSym: id.add(x.sym.name.s)
|
||||||
else: handleError(n, origin)
|
else: handleError(n, origin)
|
||||||
result = getIdent(id)
|
result = getIdent(id)
|
||||||
of nkOpenSymChoice, nkClosedSymChoice: result = n.sons[0].sym.name
|
of nkOpenSymChoice, nkClosedSymChoice:
|
||||||
|
if n[0].kind == nkSym:
|
||||||
|
result = n.sons[0].sym.name
|
||||||
|
else:
|
||||||
|
handleError(n, origin)
|
||||||
else:
|
else:
|
||||||
handleError(n, origin)
|
handleError(n, origin)
|
||||||
|
|
||||||
|
|
@ -379,7 +383,11 @@ proc initOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym =
|
||||||
result = errorSym(c, n.sons[1])
|
result = errorSym(c, n.sons[1])
|
||||||
of nkClosedSymChoice, nkOpenSymChoice:
|
of nkClosedSymChoice, nkOpenSymChoice:
|
||||||
o.mode = oimSymChoice
|
o.mode = oimSymChoice
|
||||||
|
if n[0].kind == nkSym:
|
||||||
result = n.sons[0].sym
|
result = n.sons[0].sym
|
||||||
|
else:
|
||||||
|
o.mode = oimDone
|
||||||
|
return nil
|
||||||
o.symChoiceIndex = 1
|
o.symChoiceIndex = 1
|
||||||
o.inSymChoice = initIntSet()
|
o.inSymChoice = initIntSet()
|
||||||
incl(o.inSymChoice, result.id)
|
incl(o.inSymChoice, result.id)
|
||||||
|
|
|
||||||
|
|
@ -2097,7 +2097,7 @@ proc shouldBeBracketExpr(n: PNode): bool =
|
||||||
let b = a[0]
|
let b = a[0]
|
||||||
if b.kind in nkSymChoices:
|
if b.kind in nkSymChoices:
|
||||||
for i in 0..<b.len:
|
for i in 0..<b.len:
|
||||||
if b[i].sym.magic == mArrGet:
|
if b[i].kind == nkSym and b[i].sym.magic == mArrGet:
|
||||||
let be = newNodeI(nkBracketExpr, n.info)
|
let be = newNodeI(nkBracketExpr, n.info)
|
||||||
for i in 1..<a.len: be.add(a[i])
|
for i in 1..<a.len: be.add(a[i])
|
||||||
n.sons[0] = be
|
n.sons[0] = be
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue