aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/type.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prc1/type.c')
-rw-r--r--src/prc1/type.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/prc1/type.c b/src/prc1/type.c
index 72940c8..36e222e 100644
--- a/src/prc1/type.c
+++ b/src/prc1/type.c
@@ -166,22 +166,43 @@ const struct type *type_ufind(const struct fn *fn, const char *tr,
const char *s)
{
const struct td *td = fn->td;
- const struct type *t;
+ const struct type *t, *op = NULL;
if (fn->parent && (t = type_find(fn->parent, tr, s)))
- return t;
- else if ((t = triplet_type(tr, s)))
- return t;
+ {
+ if (t->type == OP)
+ op = t;
+ else
+ return t;
+ }
+
+ if ((t = triplet_type(tr, s)))
+ {
+ if (t->type == OP)
+ op = t;
+ else
+ return t;
+ }
else if (td)
for (const struct type *t = td->types; t; t = t->next)
if (!strcmp(t->tk->s, s))
- return t;
+ {
+ if (t->type == OP)
+ op = t;
+ else
+ return t;
+ }
for (size_t i = 0; i < fn->nimps; i++)
if ((t = type_ufind(fn->imps[i].ast.fns, tr, s)))
- return t;
+ {
+ if (t->type == OP)
+ op = t;
+ else
+ return t;
+ }
- return NULL;
+ return op;
}
const struct type *type_find(const struct fn *fn, const char *tr, const char *s)