summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/application.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-05-28 02:18:52 +0000
committerKarl Berry <karl@freefriends.org>2011-05-28 02:18:52 +0000
commitc59fe5fe4739f0c61560f05d4e42b4e552219b27 (patch)
tree8cf79e85e394b3177a28d374415840a4e0a025ad /Build/source/utils/asymptote/application.cc
parent771db15706dbf3f4af8b630dcb15646a3e5fda00 (diff)
asy 2.10
git-svn-id: svn://tug.org/texlive/trunk@22633 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/application.cc')
-rw-r--r--Build/source/utils/asymptote/application.cc29
1 files changed, 9 insertions, 20 deletions
diff --git a/Build/source/utils/asymptote/application.cc b/Build/source/utils/asymptote/application.cc
index 0e6ad4421f6..25221357010 100644
--- a/Build/source/utils/asymptote/application.cc
+++ b/Build/source/utils/asymptote/application.cc
@@ -34,11 +34,7 @@ bool castable(env &e, formal& target, formal& source) {
score castScore(env &e, formal& target, formal& source) {
return equivalent(target.t,source.t) ? EXACT :
(!target.Explicit &&
-#ifdef FASTCAST
e.fastCastable(target.t,source.t)) ? CAST : FAIL;
-#else
- e.castable(target.t,source.t, symbol::castsym)) ? CAST : FAIL;
-#endif
}
@@ -189,7 +185,12 @@ bool application::matchAtSpot(size_t spot, env &e, formal &source,
{
formal &target=sig->getFormal(spot);
score s=castScore(e, target, source);
- if (s!=FAIL) {
+
+ if (s == FAIL)
+ return false;
+ else if (sig->formalIsKeywordOnly(spot) && source.name == symbol::nullsym)
+ return false;
+ else {
// The argument matches.
args[spot]=seq.addArg(a, target.t, evalIndex);
if (spot==index)
@@ -197,8 +198,6 @@ bool application::matchAtSpot(size_t spot, env &e, formal &source,
scores.push_back(s);
return true;
}
- else
- return false;
}
bool application::matchArgument(env &e, formal &source,
@@ -257,6 +256,7 @@ bool application::matchSignature(env &e, types::signature *source,
#if 0
cout << "num args: " << f.size() << endl;
+ cout << "num keyword-only: " << sig->numKeywordOnly << endl;
#endif
// First, match all of the named (non-rest) arguments.
@@ -485,20 +485,13 @@ bool halfExactMightMatch(env &e,
assert(formals[0].t);
assert(formals[1].t);
-#ifdef FASTCAST
-# define CASTABLE fastCastable
-#else
-# define CASTABLE castable
-#endif
-
// These casting tests if successful will be repeated again by
// application::match. It would be nice to avoid this somehow, but the
// additional complexity is probably not worth the minor speed improvement.
if (equivalent(formals[0].t, t1))
- return e.CASTABLE(formals[1].t, t2);
+ return e.fastCastable(formals[1].t, t2);
else
- return equivalent(formals[1].t, t2) && e.CASTABLE(formals[0].t, t1);
-#undef CASTABLE
+ return equivalent(formals[1].t, t2) && e.fastCastable(formals[0].t, t1);
}
// Most common after exact matches are cases such as
@@ -666,7 +659,6 @@ app_list multimatch(env &e,
types::signature *source,
arglist &al)
{
-#ifdef EXACT_MATCH
app_list a = exactMultimatch(e, o, source, al);
if (!a.empty()) {
#if DEBUG_CACHE
@@ -681,14 +673,11 @@ app_list multimatch(env &e,
a = halfExactMultimatch(e, o, source, al);
if (!a.empty()) {
#if DEBUG_CACHE
- // Make sure that exactMultimatch and the fallback return the same
- // application(s).
sameApplications(a, inexactMultimatch(e, o, source, al), DONT_TEST_EXACT);
#endif
return a;
}
-#endif
// Slow but most general method.
return inexactMultimatch(e, o, source, al);