diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-03-25 20:34:24 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-03-25 20:34:24 +0200 |
| commit | eaf2d360120a4cab12c27ed51961cd5d224042ff (patch) | |
| tree | 888b4715a1edf7ec74fed1bd26c31213c548650d /src/scope.c | |
| parent | 3bd9103ce0b18f6900ba544a8b2786145868524f (diff) | |
| download | ek-eaf2d360120a4cab12c27ed51961cd5d224042ff.tar.gz ek-eaf2d360120a4cab12c27ed51961cd5d224042ff.zip | |
initial constant struct stuff
Diffstat (limited to 'src/scope.c')
| -rw-r--r-- | src/scope.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/scope.c b/src/scope.c index 2091fc4..7346b40 100644 --- a/src/scope.c +++ b/src/scope.c @@ -419,9 +419,6 @@ static struct ast_node *match_macro(int global, struct scope *scope, return NULL; } -static int implements(struct scope *scope, - struct ast_node *arg_type, struct ast_node *param_type); - static struct ast_node *match_proc(int global, struct scope *scope, struct ast_node *id, struct ast_node *args); @@ -537,7 +534,7 @@ not_implemented: return 0; } -static int implements(struct scope *scope, +int implements(struct scope *scope, struct ast_node *arg_type, struct ast_node *param_type) { /* if both types are null, they are uninitialized and we'll assume they @@ -556,6 +553,16 @@ static int implements(struct scope *scope, /* at this point, we should always have some type for the argument */ assert(arg_type); + if (param_type->_type.kind == AST_TYPE_ALIAS) { + if (implements(scope, arg_type, param_type->_type.alias.actual)) + return 0; + } + + if (arg_type->_type.kind == AST_TYPE_ALIAS) { + if (implements(scope, arg_type->_type.alias.actual, param_type)) + return 0; + } + /* TODO: do aliases and templates have to be converted to types? Are * there any situations where a template will have to be followed by * some other type? */ |
