diff options
| author | gingerBill <bill@gingerbill.org> | 2020-04-13 15:48:56 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-04-13 15:48:56 +0100 |
| commit | f229084baa383ebd81c5d04db1ede5dc71017904 (patch) | |
| tree | b2f5f4ace82547fd96e1e6bf3279dd300272c928 /src/entity.cpp | |
| parent | f09b6a4c90805a562b2252430f844e85d06f1ee1 (diff) | |
Basic polymorphic named procedure parameters for procedures and records
Diffstat (limited to 'src/entity.cpp')
| -rw-r--r-- | src/entity.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/entity.cpp b/src/entity.cpp index a64e767d6..f4888d072 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -357,3 +357,23 @@ Entity *alloc_entity_dummy_variable(Scope *scope, Token token) { return alloc_entity_variable(scope, token, nullptr); } + +Entity *entity_from_expr(Ast *expr); + +Entity *strip_entity_wrapping(Entity *e) { + if (e == nullptr) { + return nullptr; + } + if (e->kind != Entity_Constant) { + return e; + } + if (e->Constant.value.kind == ExactValue_Procedure) { + return strip_entity_wrapping(e->Constant.value.value_procedure); + } + return e; +} + +Entity *strip_entity_wrapping(Ast *expr) { + Entity *e = entity_from_expr(expr); + return strip_entity_wrapping(e); +} |