summaryrefslogtreecommitdiff
path: root/parse/infer.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2019-02-26 13:03:14 -0800
committerOri Bernstein <ori@markovcorp.com>2019-02-26 13:03:14 -0800
commit02201160614e5f25a7a73d86ed26a1f90fa4f5bb (patch)
treece958c6982673794612cf2ea91ab8b353bf4c243 /parse/infer.c
parent16a7bb8f8cc86b22ce157e0944f66f60a556590f (diff)
downloadmc-02201160614e5f25a7a73d86ed26a1f90fa4f5bb.tar.gz
Add support for `__fini__` functions.
Diffstat (limited to 'parse/infer.c')
-rw-r--r--parse/infer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/parse/infer.c b/parse/infer.c
index 30d8747..4e640af 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2654,6 +2654,7 @@ verifyop(Node *n)
static void
typesub(Node *n, int noerr)
{
+ char *name;
size_t i;
if (!n)
@@ -2675,9 +2676,10 @@ typesub(Node *n, int noerr)
if (!maincompatible(tybase(decltype(n))))
fatal(n, "main must be (->void) or (byte[:][:] -> void), got %s",
tystr(decltype(n)));
- if (streq(declname(n), "__init__"))
+ name = declname(n);
+ if (streq(name, "__init__") || streq(name, "__fini__"))
if (!initcompatible(tybase(decltype(n))))
- fatal(n, "__init__ must be (->void), got %s", tystr(decltype(n)));
+ fatal(n, "%s must be (->void), got %s", name, tystr(decltype(n)));
popenv(n->decl.env);
break;
case Nblock: