diff options
author | Ori Bernstein <ori@eigenstate.org> | 2018-04-27 18:15:45 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2018-04-27 18:16:17 -0700 |
commit | 89331eff71ab876a5b6b534141b1422b2ca42e0b (patch) | |
tree | 8172fa0cad3e0a050a18a173dd96de04b89691ac /6 | |
parent | 32ff704e0db8256cb6535341ae789a15e143745f (diff) | |
download | mc-89331eff71ab876a5b6b534141b1422b2ca42e0b.tar.gz |
Extract slices recursively.
This fixes deeply nestedl slices of arrays of slices
of arrays.
Diffstat (limited to '6')
-rw-r--r-- | 6/blob.c | 2 | ||||
-rw-r--r-- | 6/simp.c | 1 |
2 files changed, 2 insertions, 1 deletions
@@ -205,7 +205,7 @@ blobslice(Blob *seq, Htab *globls, Htab *strtab, Node *n) 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"); @@ -1479,6 +1479,7 @@ extractsub(Simp *s, Node *e) 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]); |