summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/stm.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-07-11 22:39:53 +0000
committerKarl Berry <karl@freefriends.org>2010-07-11 22:39:53 +0000
commit4e8485b0ddecb55f72929dd6233f254a1e7bf5b0 (patch)
tree354324ee6f54d46053b3ce88fe9dc4acf8e2ed81 /Build/source/utils/asymptote/stm.cc
parent713bb91ad0467fb3b12acad03cae2fa105ed2caa (diff)
asy 2.02
git-svn-id: svn://tug.org/texlive/trunk@19378 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/stm.cc')
-rw-r--r--Build/source/utils/asymptote/stm.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/Build/source/utils/asymptote/stm.cc b/Build/source/utils/asymptote/stm.cc
index acc00f0082b..43f56aea042 100644
--- a/Build/source/utils/asymptote/stm.cc
+++ b/Build/source/utils/asymptote/stm.cc
@@ -357,6 +357,17 @@ void extendedForStm::trans(coenv &e) {
// Get the start type. Handle type inference as a special case.
types::ty *t = start->trans(e, true);
if (t->kind == types::ty_inferred) {
+
+ // First ensure the array expression is an unambiguous array.
+ types::ty *at = set->cgetType(e);
+ if (at->kind != ty_array) {
+ em.error(set->getPos());
+ em << "expression is not an array of inferable type";
+
+ // On failure, don't bother trying to translate the loop.
+ return;
+ }
+
// var a=set;
tyEntryTy tet(pos, primInferred());
decid dec1(pos, new decidstart(pos, a), set);
@@ -378,13 +389,6 @@ void extendedForStm::trans(coenv &e) {
b.add(new vardec(pos, start, &dec2));
b.add(body);
- // If there are errors already, just report errors in the body and don't try
- // to translate the for loop.
- if (em.errors()) {
- b.trans(e);
- return;
- }
-
// for (int i=0; i < a.length; ++i)
// <block>
forStm(pos,