@@ -46,7 +46,6 @@ import std/options as std_options
46
46
47
47
from compiler/ ast/ ast import newSym, newType, rawAddSon
48
48
from compiler/ sem/ semdata import makeVarType
49
- from compiler/ front/ msgs import internalAssert
50
49
51
50
when defined (nimCompilerStacktraceHints):
52
51
import compiler/ utils/ debugutils
@@ -167,13 +166,6 @@ proc newDefaultCall(info: TLineInfo, typ: PType): CgNode =
167
166
# # Produces the tree for a ``default`` magic call.
168
167
newExpr (cnkCall, info, typ, [newMagicNode (mDefault, info)])
169
168
170
- proc wrapInHiddenAddr (cl: TranslateCl , n: CgNode ): CgNode =
171
- # # Restores the ``cnkHiddenAddr`` around lvalue expressions passed to ``var``
172
- # # parameters. The code-generators operating on ``CgNode``-IR depend on the
173
- # # hidden addr to be present
174
- cl.graph.config.internalAssert (n.typ.skipTypes (abstractInst).kind != tyVar, n.info)
175
- newOp (cnkHiddenAddr, n.info, makeVarType (cl.owner, n.typ, cl.idgen), n)
176
-
177
169
proc genObjConv (n: CgNode , to: PType , info: TLineInfo ): CgNode =
178
170
# # Depending on the type relationship between `n` and `to`, wraps `n` in
179
171
# # either an up- or down-conversion. Returns `nil` if no up- or down-
@@ -415,7 +407,10 @@ proc callToIr(tree: MirBody, cl: var TranslateCl, n: MirNode,
415
407
# XXX: prevent this case from happening
416
408
arg = newOp (cnkDerefView, arg.info, arg.typ.base, arg)
417
409
elif mutable:
418
- arg = wrapInHiddenAddr (cl, arg)
410
+ # much like in PNode AST, the CGIR AST also needs a ``cnkHiddenAddr``
411
+ # tree wrapped around expressions in var argument positions
412
+ arg = newOp (cnkHiddenAddr, arg.info,
413
+ makeVarType (cl.owner, arg.typ, cl.idgen), arg)
419
414
420
415
result .add arg
421
416
0 commit comments