ref: f2986bc748579e5b8cd88bff678b5ce875581e08
parent: aca3176dbcded47fd46782e844da16fea02e86e5
author: Ori Bernstein <[email protected]>
date: Sat Sep 6 17:18:49 EDT 2014
Error on declared but unimplemented functions.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -955,14 +955,17 @@
ng = getdcl(globls, k[i]);
/* if an export has an initializer, it shouldn't be declared in the
* body */
- if (nx->decl.init && ng)
- fatal(nx->line, "Export %s double-defined on line %d", ctxstr(st, nx), ng->line);
- if (ng && nx->decl.isgeneric != ng->decl.isgeneric)
- fatal(nx->line, "Export %s defined with different genericness on line %d", ctxstr(st, nx), ng->line);
- if (!ng)
- putdcl(globls, nx);
- else
+ if (ng) {
+ if (nx->decl.init)
+ fatal(nx->line, "Export %s double-defined on line %d", ctxstr(st, nx), ng->line);
+ if (nx->decl.isgeneric != ng->decl.isgeneric)
+ fatal(nx->line, "Export %s defined with different genericness on line %d", ctxstr(st, nx), ng->line);
unify(st, nx, type(st, ng), type(st, nx));
+ } else {
+ if (!nx->decl.isextern && !nx->decl.isimport && !nx->decl.init && (nx->decl.isconst || nx->decl.isgeneric))
+ fatal(nx->line, "Export %s defined but not implemented", ctxstr(st, nx));
+ putdcl(globls, nx);
+ }
}
free(k);
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -268,6 +268,7 @@
char isgeneric;
char isextern;
char ishidden;
+ char isimport;
} decl;
struct {
--- a/parse/use.c
+++ b/parse/use.c
@@ -168,6 +168,7 @@
n->decl.isconst = rdbool(fd);
n->decl.isgeneric = rdbool(fd);
n->decl.isextern = rdbool(fd);
+ n->decl.isimport = 1;
if (n->decl.isgeneric && !ctx)
n->decl.init = unpickle(fd);