diff options
author | Araq <rumpf_a@web.de> | 2013-08-30 12:16:18 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-08-30 12:16:18 +0200 |
commit | 1ad1980f1f9ebf68501a62de55a614207d8a5ec5 (patch) | |
tree | 88a43a9bc33eb207b55e7a09f8eca40c29966f75 /compiler/renderer.nim | |
parent | 5f943cf4bc5f9d34ab58bc2247a64a265c51dbd6 (diff) | |
download | Nim-1ad1980f1f9ebf68501a62de55a614207d8a5ec5.tar.gz |
bugfix: 'not x of y' requires ()
Diffstat (limited to 'compiler/renderer.nim')
-rw-r--r-- | compiler/renderer.nim | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 70ce5c27d..efa4ecaba 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -329,7 +329,7 @@ proc atom(n: PNode): string = if n.flags * {nfBase2, nfBase8, nfBase16} == {}: result = $n.floatVal & "\'f32" else: - f = n.floatVal + f = n.floatVal.float32 result = litAux(n, (cast[PInt32](addr(f)))[], 4) & "\'f32" of nkFloat64Lit: if n.flags * {nfBase2, nfBase8, nfBase16} == {}: @@ -407,7 +407,8 @@ proc lsub(n: PNode): int = result = result + lcomma(n, 1) of nkExprColonExpr: 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 nkCallStrLit: result = lsons(n) 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]) if n.len > 1: 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: gsub(g, n.sons[1]) gsub(g, n.sons[0]) |