diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-18 23:24:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-18 23:24:00 +0000 |
commit | 47fea6d4aa5c9cfb2e71c51f769dac3023630035 (patch) | |
tree | 6a4b15f0b85d8bb5602146e20241b49e938f409b /Build/source/utils/asymptote/env.cc | |
parent | 0dfdf5c49b160d464b74a9cae8882ea81cc47878 (diff) |
asy 1.99
git-svn-id: svn://tug.org/texlive/trunk@19047 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/env.cc')
-rw-r--r-- | Build/source/utils/asymptote/env.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/env.cc b/Build/source/utils/asymptote/env.cc index 6eedb8bec66..91edfd41754 100644 --- a/Build/source/utils/asymptote/env.cc +++ b/Build/source/utils/asymptote/env.cc @@ -96,6 +96,7 @@ bool protoenv::fastCastable(ty *target, ty *source) { // To avoid memory allocation, fill one static variable with new parameters // in each call. + // Warning: This is not re-entrant if asy ever goes multi-threaded. static types::function castFunc(primVoid(), primVoid()); castFunc.result = target; @@ -130,6 +131,25 @@ bool protoenv::fastCastable(ty *target, ty *source) { // routine. return source->kind == ty_null && target->isReference(); } + +access *protoenv::fastLookupCast(ty *target, ty *source) { + assert(target->kind != types::ty_overloaded); + assert(target->kind != types::ty_error); + assert(source->kind != types::ty_overloaded); + assert(source->kind != types::ty_error); + + // Warning: This is not re-entrant. + static types::function castFunc(primVoid(), primVoid()); + castFunc.result = target; + castFunc.sig.formals[0].t = source; + + varEntry *ve = lookupVarByType(symbol::castsym, &castFunc); + if (ve) + return ve->getLocation(); + + // Fall back on slow routine. + return lookupCast(target, source, symbol::castsym); +} #endif |