Remove genToArray in jsgen, a PHP remnant (#13466)

This commit is contained in:
hlaaftana
2020-02-22 22:04:46 +03:00
committed by GitHub
parent c11b91d52d
commit 13d292786e

View File

@@ -1795,26 +1795,6 @@ proc genConStrStr(p: PProc, n: PNode, r: var TCompRes) =
else:
r.res.add("$1 || [])" % [a.res])
proc genToArray(p: PProc; n: PNode; r: var TCompRes) =
# we map mArray to PHP's array constructor, a mild hack:
var a, b: TCompRes
r.kind = resExpr
r.res = rope("array(")
let x = skipConv(n[1])
if x.kind == nkBracket:
for i in 0..<x.len:
let it = x[i]
if it.kind in {nkPar, nkTupleConstr} and it.len == 2:
if i > 0: r.res.add(", ")
gen(p, it[0], a)
gen(p, it[1], b)
r.res.add("$# => $#" % [a.rdLoc, b.rdLoc])
else:
localError(p.config, it.info, "'toArray' needs tuple constructors")
else:
localError(p.config, x.info, "'toArray' needs an array literal")
r.res.add(")")
proc genReprAux(p: PProc, n: PNode, r: var TCompRes, magic: string, typ: Rope = nil) =
useMagic(p, magic)
r.res.add(magic & "(")