diff options
author | Amjad Ben Hedhili <amjadhedhili@outlook.com> | 2022-09-19 14:09:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-19 15:09:41 +0200 |
commit | 7a756bfaef29ff521059b3310b67a0344001f5fd (patch) | |
tree | c89fc86252ed19058278e39e235bdf771bcadf34 | |
parent | 97259a5ab37892bedca64b14ffc6e0b7d25dd789 (diff) | |
download | Nim-7a756bfaef29ff521059b3310b67a0344001f5fd.tar.gz |
Shorten JS block code (#20370)
-rw-r--r-- | compiler/jsgen.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index cacdb3fb9..116d31de4 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -971,12 +971,12 @@ proc genBlock(p: PProc, n: PNode, r: var TCompRes) = sym.loc.k = locOther sym.position = idx+1 let labl = p.unique - lineF(p, "Label$1: do {$n", [labl.rope]) + lineF(p, "Label$1: {$n", [labl.rope]) setLen(p.blocks, idx + 1) p.blocks[idx].id = - p.unique # negative because it isn't used yet gen(p, n[1], r) setLen(p.blocks, idx) - lineF(p, "} while (false);$n", [labl.rope]) + lineF(p, "};$n", [labl.rope]) proc genBreakStmt(p: PProc, n: PNode) = var idx: int @@ -2426,9 +2426,9 @@ proc genProcBody(p: PProc, prc: PSym): Rope = else: result = nil if p.beforeRetNeeded: - result.add p.indentLine(~"BeforeRet: do {$n") + result.add p.indentLine(~"BeforeRet: {$n") result.add p.body - result.add p.indentLine(~"} while (false);$n") + result.add p.indentLine(~"};$n") else: result.add(p.body) if prc.typ.callConv == ccSysCall: |