more progress on destructor based strings
This commit is contained in:
parent
5b59852406
commit
74bf316619
16 changed files with 279 additions and 244 deletions
|
|
@ -235,9 +235,20 @@ proc getTempName(m: BModule): Rope =
|
|||
result = m.tmpBase & rope(m.labels)
|
||||
inc m.labels
|
||||
|
||||
proc rdLoc(a: TLoc): Rope =
|
||||
# 'read' location (deref if indirect)
|
||||
result = a.r
|
||||
if lfIndirect in a.flags: result = "(*$1)" % [result]
|
||||
|
||||
proc lenField(p: BProc): Rope =
|
||||
result = rope(if p.module.compileToCpp: "len" else: "Sup.len")
|
||||
|
||||
proc lenExpr(p: BProc; a: TLoc): Rope =
|
||||
if p.config.selectedGc == gcDestructors:
|
||||
result = rdLoc(a) & ".len"
|
||||
else:
|
||||
result = "($1 ? $1->$2 : 0)" % [rdLoc(a), lenField(p)]
|
||||
|
||||
proc dataField(p: BProc): Rope =
|
||||
result = rope"->data"
|
||||
|
||||
|
|
@ -246,11 +257,6 @@ include ccgtypes
|
|||
|
||||
# ------------------------------ Manager of temporaries ------------------
|
||||
|
||||
proc rdLoc(a: TLoc): Rope =
|
||||
# 'read' location (deref if indirect)
|
||||
result = a.r
|
||||
if lfIndirect in a.flags: result = "(*$1)" % [result]
|
||||
|
||||
proc addrLoc(conf: ConfigRef; a: TLoc): Rope =
|
||||
result = a.r
|
||||
if lfIndirect notin a.flags and mapType(conf, a.t) != ctArray:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue