fixes #9633
This commit is contained in:
parent
d0a02fe66b
commit
05683e3aab
2 changed files with 25 additions and 6 deletions
|
|
@ -702,8 +702,11 @@ proc namedParams(p: var TParser, callee: PNode,
|
||||||
# progress guaranteed
|
# progress guaranteed
|
||||||
exprColonEqExprListAux(p, endTok, result)
|
exprColonEqExprListAux(p, endTok, result)
|
||||||
|
|
||||||
proc commandParam(p: var TParser, isFirstParam: var bool): PNode =
|
proc commandParam(p: var TParser, isFirstParam: var bool; mode: TPrimaryMode): PNode =
|
||||||
result = parseExpr(p)
|
if mode == pmTypeDesc:
|
||||||
|
result = simpleExpr(p, mode)
|
||||||
|
else:
|
||||||
|
result = parseExpr(p)
|
||||||
if p.tok.tokType == tkDo:
|
if p.tok.tokType == tkDo:
|
||||||
result = postExprBlocks(p, result)
|
result = postExprBlocks(p, result)
|
||||||
elif p.tok.tokType == tkEquals and not isFirstParam:
|
elif p.tok.tokType == tkEquals and not isFirstParam:
|
||||||
|
|
@ -776,7 +779,7 @@ proc primarySuffix(p: var TParser, r: PNode,
|
||||||
when true:
|
when true:
|
||||||
# progress NOT guaranteed
|
# progress NOT guaranteed
|
||||||
p.hasProgress = false
|
p.hasProgress = false
|
||||||
addSon result, commandParam(p, isFirstParam)
|
addSon result, commandParam(p, isFirstParam, mode)
|
||||||
if not p.hasProgress: break
|
if not p.hasProgress: break
|
||||||
else:
|
else:
|
||||||
while p.tok.tokType != tkEof:
|
while p.tok.tokType != tkEof:
|
||||||
|
|
@ -1366,12 +1369,12 @@ proc parseExprStmt(p: var TParser): PNode =
|
||||||
while true:
|
while true:
|
||||||
getTok(p)
|
getTok(p)
|
||||||
optInd(p, result)
|
optInd(p, result)
|
||||||
addSon(result, commandParam(p, isFirstParam))
|
addSon(result, commandParam(p, isFirstParam, pmNormal))
|
||||||
if p.tok.tokType != tkComma: break
|
if p.tok.tokType != tkComma: break
|
||||||
elif p.tok.indent < 0 and isExprStart(p):
|
elif p.tok.indent < 0 and isExprStart(p):
|
||||||
result = newNode(nkCommand, a.info, @[a])
|
result = newNode(nkCommand, a.info, @[a])
|
||||||
while true:
|
while true:
|
||||||
addSon(result, commandParam(p, isFirstParam))
|
addSon(result, commandParam(p, isFirstParam, pmNormal))
|
||||||
if p.tok.tokType != tkComma: break
|
if p.tok.tokType != tkComma: break
|
||||||
getTok(p)
|
getTok(p)
|
||||||
optInd(p, result)
|
optInd(p, result)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''holla
|
output: '''holla
|
||||||
true
|
true
|
||||||
defabc 4'''
|
defabc 4
|
||||||
|
0'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Test top level semicolon works properly:
|
# Test top level semicolon works properly:
|
||||||
|
|
@ -24,3 +25,18 @@ echo "def".foo[:string, string]("abc"), " ", 4.bar[:int]
|
||||||
proc isFalse(a: int): bool = false
|
proc isFalse(a: int): bool = false
|
||||||
|
|
||||||
assert not isFalse(3)
|
assert not isFalse(3)
|
||||||
|
|
||||||
|
# bug #9633
|
||||||
|
|
||||||
|
type
|
||||||
|
MyField = object
|
||||||
|
b: seq[string]
|
||||||
|
|
||||||
|
MyObject = object
|
||||||
|
f: MyField
|
||||||
|
|
||||||
|
proc getX(x: MyObject): lent MyField {.inline.} =
|
||||||
|
x.f
|
||||||
|
|
||||||
|
let a = MyObject()
|
||||||
|
echo a.getX.b.len
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue