ref: 89331eff71ab876a5b6b534141b1422b2ca42e0b
parent: 32ff704e0db8256cb6535341ae789a15e143745f
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Apr 27 14:15:45 EDT 2018
Extract slices recursively. This fixes deeply nestedl slices of arrays of slices of arrays.
--- a/6/blob.c
+++ b/6/blob.c
@@ -205,7 +205,7 @@
sz = tysize(tybase(exprtype(base))->sub[0]);
lbl = htget(globls, base);
slbase = mkblobref(lbl, loval*sz, 1);
- } else if (exprop(base) == Olit) {
+ } else if (exprop(base) == Olit || exprop(base) == Oarr) {
slbase = mkblobi(Bti64, getintlit(base, "invalid base expr"));
} else {
fatal(base, "slice base is not a constant value");
--- a/6/simp.c
+++ b/6/simp.c
@@ -1479,6 +1479,7 @@
switch (exprop(e)) {
case Oslice:
sub = e->expr.args[0];
+ extractsub(s, sub);
if (exprop(sub) == Oarr) {
if (sub->expr.nargs > 0) {
e->expr.args[0] = simpblob(s, e->expr.args[0]);