summaryrefslogtreecommitdiff
path: root/decls_cgen.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-01-29 11:27:37 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-01-29 11:27:37 -0500
commitd79ac12de0ceb4ff82f486c26608b754b145f0fc (patch)
treec20bb457b7ad2a9ac9e99483d58cdcb58351e6b8 /decls_cgen.c
parentc4c91e3444c4a530761f900d4f7268801e5cc55d (diff)
got rid of packages.
Diffstat (limited to 'decls_cgen.c')
-rw-r--r--decls_cgen.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/decls_cgen.c b/decls_cgen.c
index b0382b5..c62b02f 100644
--- a/decls_cgen.c
+++ b/decls_cgen.c
@@ -113,59 +113,6 @@ static bool cgen_decls_expr(CGenerator *g, Expression *e) {
Type *lhs_type = &e->binary.lhs->type;
if (lhs_type->kind == TYPE_PTR)
lhs_type = lhs_type->ptr;
- if (e->binary.op == BINARY_DOT && type_is_builtin(lhs_type, BUILTIN_PKG)) {
- Identifier ident = e->binary.dot.pkg_ident;
- IdentDecl *idecl = ident_decl(ident);
- assert(idecl);
- assert(idecl->kind == IDECL_DECL);
- Declaration *d = idecl->decl;
- if (e->type.kind == TYPE_FN) {
- FnExpr *f = NULL;
- if (d->flags & DECL_FOUND_VAL)
- f = d->val.fn;
- else if (d->expr.kind == EXPR_FN)
- f = d->expr.fn;
- if (f) {
- if (fn_has_any_const_params(f)) {
- /* declare the instances */
- f->c.name = ident;
- if (!cgen_fn_decl(g, f, &e->type))
- return false;
- } else {
- bool out_param = cgen_uses_ptr(&f->ret_type);
- /* extern function declaration */
- cgen_write(g, "extern ");
- if (out_param) {
- cgen_write(g, "void");
- } else {
- if (!cgen_type_pre(g, &f->ret_type, e->where))
- return false;
- }
- cgen_write(g, " ");
- cgen_ident(g, ident);
- if (!cgen_fn_args(g, f, 0, 0))
- return false;
- if (!out_param) {
- if (!cgen_type_post(g, &f->ret_type, e->where))
- return false;
- }
- cgen_write(g, ";");
- cgen_nl(g);
- }
- break;
- }
- }
- /* extern variable declaration */
- cgen_write(g, "extern ");
- if (!cgen_type_pre(g, &e->type, e->where))
- return false;
- cgen_write(g, " ");
- cgen_ident(g, ident);
- if (!cgen_type_post(g, &e->type, e->where))
- return false;
- cgen_write(g, ";");
- cgen_nl(g);
- }
} break;
default:
break;