Shorten JS block code (#20370)
This commit is contained in:
parent
97259a5ab3
commit
7a756bfaef
1 changed files with 4 additions and 4 deletions
|
|
@ -971,12 +971,12 @@ proc genBlock(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
sym.loc.k = locOther
|
sym.loc.k = locOther
|
||||||
sym.position = idx+1
|
sym.position = idx+1
|
||||||
let labl = p.unique
|
let labl = p.unique
|
||||||
lineF(p, "Label$1: do {$n", [labl.rope])
|
lineF(p, "Label$1: {$n", [labl.rope])
|
||||||
setLen(p.blocks, idx + 1)
|
setLen(p.blocks, idx + 1)
|
||||||
p.blocks[idx].id = - p.unique # negative because it isn't used yet
|
p.blocks[idx].id = - p.unique # negative because it isn't used yet
|
||||||
gen(p, n[1], r)
|
gen(p, n[1], r)
|
||||||
setLen(p.blocks, idx)
|
setLen(p.blocks, idx)
|
||||||
lineF(p, "} while (false);$n", [labl.rope])
|
lineF(p, "};$n", [labl.rope])
|
||||||
|
|
||||||
proc genBreakStmt(p: PProc, n: PNode) =
|
proc genBreakStmt(p: PProc, n: PNode) =
|
||||||
var idx: int
|
var idx: int
|
||||||
|
|
@ -2426,9 +2426,9 @@ proc genProcBody(p: PProc, prc: PSym): Rope =
|
||||||
else:
|
else:
|
||||||
result = nil
|
result = nil
|
||||||
if p.beforeRetNeeded:
|
if p.beforeRetNeeded:
|
||||||
result.add p.indentLine(~"BeforeRet: do {$n")
|
result.add p.indentLine(~"BeforeRet: {$n")
|
||||||
result.add p.body
|
result.add p.body
|
||||||
result.add p.indentLine(~"} while (false);$n")
|
result.add p.indentLine(~"};$n")
|
||||||
else:
|
else:
|
||||||
result.add(p.body)
|
result.add(p.body)
|
||||||
if prc.typ.callConv == ccSysCall:
|
if prc.typ.callConv == ccSysCall:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue