From 19fc9fd9a26973d87fad437ce549ffaba479df54 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 31 May 2012 00:02:26 +0000 Subject: asy 2.16 sources git-svn-id: svn://tug.org/texlive/trunk@26734 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/exp.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'Build/source/utils/asymptote/exp.h') diff --git a/Build/source/utils/asymptote/exp.h b/Build/source/utils/asymptote/exp.h index 38a72cba7f5..af24523b6df 100644 --- a/Build/source/utils/asymptote/exp.h +++ b/Build/source/utils/asymptote/exp.h @@ -21,7 +21,7 @@ namespace trans { class coenv; class coder; -class label_t; +struct label_t; typedef label_t *label; class application; @@ -661,11 +661,18 @@ struct argument { class arglist : public gc { public: typedef mem::vector argvector; + argvector args; argument rest; + // As the language allows named arguments after rest arguments, store the + // index of the rest argument in order to ensure proper left-to-right + // execution. + static const size_t DUMMY_REST_POSITION = 9999; + size_t restPosition; + arglist() - : args(), rest() {} + : args(), rest(), restPosition(DUMMY_REST_POSITION) {} virtual ~arglist() {} @@ -679,11 +686,10 @@ public: } virtual void add(argument a) { - if (rest.val) { - // TODO: Handle keyword arguments after rest with proper left-to-right - // ordering. + if (rest.val && !a.name) { em.error(a.val->getPos()); - em << "argument after rest argument"; + em << "unnamed argument after rest argument"; + return; } args.push_back(a); } @@ -697,8 +703,13 @@ public: if (rest.val) { em.error(a.val->getPos()); em << "additional rest argument"; + return; } + rest = a; + + assert(restPosition == DUMMY_REST_POSITION); + restPosition = size(); } virtual void prettyprint(ostream &out, Int indent); -- cgit v1.2.3