fewer ropes (#11037)

This commit is contained in:
Arne Döring 2019-04-19 09:05:31 +02:00 • committed by Andreas Rumpf
commit abb05ab645
8 changed files with 380 additions and 213 deletions

View file

@ -206,15 +206,15 @@ proc indentLine(p: BProc, r: Rope): Rope =
prepend(result, "\t".rope)
template appcg(m: BModule, c: var Rope, frmt: FormatStr,
args: varargs[untyped]) =
args: untyped) =
add(c, ropecg(m, frmt, args))
template appcg(m: BModule, sec: TCFileSection, frmt: FormatStr,
args: varargs[untyped]) =
args: untyped) =
add(m.s[sec], ropecg(m, frmt, args))
template appcg(p: BProc, sec: TCProcSection, frmt: FormatStr,
args: varargs[untyped]) =
args: untyped) =
add(p.s(sec), ropecg(p.module, frmt, args))
template line(p: BProc, sec: TCProcSection, r: Rope) =
@ -224,7 +224,7 @@ template line(p: BProc, sec: TCProcSection, r: string) =
add(p.s(sec), indentLine(p, r.rope))
template lineF(p: BProc, sec: TCProcSection, frmt: FormatStr,
args: openarray[Rope]) =
args: untyped) =
add(p.s(sec), indentLine(p, frmt % args))
template lineCg(p: BProc, sec: TCProcSection, frmt: FormatStr,
@ -484,7 +484,7 @@ proc localVarDecl(p: BProc; n: PNode): Rope =
add(result, " ")
add(result, s.loc.r)
else:
result = s.cgDeclFrmt % [result, s.loc.r]
result = runtimeFormat(s.cgDeclFrmt, [result, s.loc.r])
proc assignLocalVar(p: BProc, n: PNode) =
#assert(s.loc.k == locNone) # not yet assigned
@ -535,7 +535,7 @@ proc assignGlobalVar(p: BProc, n: PNode) =
if sfVolatile in s.flags: add(decl, " volatile")
addf(decl, " $1;$n", [s.loc.r])
else:
decl = (s.cgDeclFrmt & ";$n") % [td, s.loc.r]
decl = runtimeFormat(s.cgDeclFrmt & ";$n", [td, s.loc.r])
add(p.module.s[cfsVars], decl)
if p.withinLoop > 0:
# fixes tests/run/tzeroarray: