aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@axiomatics.org>2016-02-08 00:25:37 -0800
committerGabriel Dos Reis <gdr@axiomatics.org>2016-02-08 00:25:37 -0800
commite4c7fc35015d5a0c5bceb993ecdb9d5da5ddbb61 (patch)
treee9821c0feb8fa1b20a3c5858ebcb835e171a98de
parent4c8c8f82ac22278f998bc5325770b17c4e9c7fa5 (diff)
downloadopen-axiom-e4c7fc35015d5a0c5bceb993ecdb9d5da5ddbb61.tar.gz
Tidy gerCapsuleDirectoryEntry
Factor out candidatesForSlot.
-rw-r--r--src/interp/c-util.boot11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index cc77d040..70675bf0 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1478,13 +1478,20 @@ makeCapsuleFunctionContext(db,fun) ==
| symbolEq?(fun,rest impl)]
or systemError ['"cannot find context for",:bright fun]
+++ Return the list of implementations candidate for a given domain slot.
+candidatesForSlot(db,slot) ==
+ [x for x in dbCapsuleDefinitions db | x is [.,=slot,:.]]
+
++ Return the linkage name of the exported operation associated with
++ slot number `slot'. A nil result means that either the operation
++ is not defined, or the scope predicates don't match.
getCapsuleDirectoryEntry(fc,slot) ==
pred' := fcPredicate fc
- or/[rest impl for [[.,:pred],:impl] in dbCapsuleDefinitions fcDatabase fc
- | first impl = slot and (pred is true or pred = pred')]
+ candidates := candidatesForSlot(fcDatabase fc ,slot) =>
+ -- FIXME: consider subsumption? How often does this occur?
+ or/[func for [[.,:pred],.,:func] in candidates
+ | pred = pred' or pred is true]
+ nil
++ `defs' is a list of function definitions from the current domain.
++ Walk that list and replace references to unconditional operations