summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/ccgexprs.nim9
-rw-r--r--compiler/ccgliterals.nim4
2 files changed, 3 insertions, 10 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index baf51a8f2..9f4d57359 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -808,18 +808,15 @@ proc genFieldCheck(p: BProc, e: PNode, obj: Rope, field: PSym) =
     v.r.add(".")
     v.r.add(disc.sym.loc.r)
     genInExprAux(p, it, u, v, test)
-    let id = nodeTableTestOrSet(p.module.dataCache,
-                               newStrNode(nkStrLit, field.name.s), p.module.labels)
-    let strLit = if id == p.module.labels: genStringLiteralDataOnly(p.module, field.name.s, e.info)
-                 else: p.module.tmpBase & rope(id)
+    let strLit = genStringLiteral(p.module, newStrNode(nkStrLit, field.name.s))
     if op.magic == mNot:
       linefmt(p, cpsStmts,
               "if ($1) #raiseFieldError($2);$n",
-              [rdLoc(test), genStringLiteralFromData(p.module, strLit, e.info)])
+              [rdLoc(test), strLit])
     else:
       linefmt(p, cpsStmts,
               "if (!($1)) #raiseFieldError($2);$n",
-              [rdLoc(test), genStringLiteralFromData(p.module, strLit, e.info)])
+              [rdLoc(test), strLit])
 
 proc genCheckedRecordField(p: BProc, e: PNode, d: var TLoc) =
   if optFieldCheck in p.options:
diff --git a/compiler/ccgliterals.nim b/compiler/ccgliterals.nim
index f5372f050..da3668028 100644
--- a/compiler/ccgliterals.nim
+++ b/compiler/ccgliterals.nim
@@ -97,10 +97,6 @@ proc genStringLiteralDataOnly(m: BModule; s: string; info: TLineInfo): Rope =
   else:
     localError(m.config, info, "cannot determine how to produce code for string literal")
 
-proc genStringLiteralFromData(m: BModule; data: Rope; info: TLineInfo): Rope =
-  result = ropecg(m, "((#NimStringDesc*) &$1)",
-                [data])
-
 proc genNilStringLiteral(m: BModule; info: TLineInfo): Rope =
   result = ropecg(m, "((#NimStringDesc*) NIM_NIL)", [])