From 4e8485b0ddecb55f72929dd6233f254a1e7bf5b0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 11 Jul 2010 22:39:53 +0000 Subject: asy 2.02 git-svn-id: svn://tug.org/texlive/trunk@19378 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/stm.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Build/source/utils/asymptote/stm.cc') 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) // forStm(pos, -- cgit v1.2.3