bugfix: 'not x of y' requires ()
This commit is contained in:
parent
5f943cf4bc
commit
1ad1980f1f
1 changed files with 9 additions and 3 deletions
|
|
@ -329,7 +329,7 @@ proc atom(n: PNode): string =
|
||||||
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
||||||
result = $n.floatVal & "\'f32"
|
result = $n.floatVal & "\'f32"
|
||||||
else:
|
else:
|
||||||
f = n.floatVal
|
f = n.floatVal.float32
|
||||||
result = litAux(n, (cast[PInt32](addr(f)))[], 4) & "\'f32"
|
result = litAux(n, (cast[PInt32](addr(f)))[], 4) & "\'f32"
|
||||||
of nkFloat64Lit:
|
of nkFloat64Lit:
|
||||||
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
||||||
|
|
@ -407,7 +407,8 @@ proc lsub(n: PNode): int =
|
||||||
result = result + lcomma(n, 1)
|
result = result + lcomma(n, 1)
|
||||||
of nkExprColonExpr: result = lsons(n) + 2
|
of nkExprColonExpr: result = lsons(n) + 2
|
||||||
of nkInfix: result = lsons(n) + 2
|
of nkInfix: result = lsons(n) + 2
|
||||||
of nkPrefix: result = lsons(n) + 1
|
of nkPrefix:
|
||||||
|
result = lsons(n)+1+(if n.len > 0 and n.sons[1].kind == nkInfix: 2 else: 0)
|
||||||
of nkPostfix: result = lsons(n)
|
of nkPostfix: result = lsons(n)
|
||||||
of nkCallStrLit: result = lsons(n)
|
of nkCallStrLit: result = lsons(n)
|
||||||
of nkPragmaExpr: result = lsub(n.sons[0]) + lcomma(n, 1)
|
of nkPragmaExpr: result = lsub(n.sons[0]) + lcomma(n, 1)
|
||||||
|
|
@ -939,7 +940,12 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
|
||||||
gsub(g, n.sons[0])
|
gsub(g, n.sons[0])
|
||||||
if n.len > 1:
|
if n.len > 1:
|
||||||
put(g, tkSpaces, space)
|
put(g, tkSpaces, space)
|
||||||
gsub(g, n.sons[1])
|
if n.sons[1].kind == nkInfix:
|
||||||
|
put(g, tkParLe, "(")
|
||||||
|
gsub(g, n.sons[1])
|
||||||
|
put(g, tkParRi, ")")
|
||||||
|
else:
|
||||||
|
gsub(g, n.sons[1])
|
||||||
of nkPostfix:
|
of nkPostfix:
|
||||||
gsub(g, n.sons[1])
|
gsub(g, n.sons[1])
|
||||||
gsub(g, n.sons[0])
|
gsub(g, n.sons[0])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue