aboutsummaryrefslogtreecommitdiff
path: root/environment.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-09 16:03:38 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-09 16:03:38 -0500
commitb04a1b30903636bf97a8e04efe88e8a177855bcb (patch)
treed85a765c07c3cc686485d30ef7a4216f4d830cad /environment.h
parent42da91936e50ab652d140677689b519fe9deb3fe (diff)
Implement lambdas and closures
Diffstat (limited to 'environment.h')
-rw-r--r--environment.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/environment.h b/environment.h
index 8660fe68..2ab7a9d2 100644
--- a/environment.h
+++ b/environment.h
@@ -17,9 +17,16 @@ typedef struct {
} compilation_unit_t;
typedef struct {
+ type_t *return_type;
+ table_t *closure_scope;
+ table_t *closed_vars;
+} fn_context_t;
+
+typedef struct {
table_t *types, *globals, *locals;
table_t *type_namespaces; // Map of type name -> namespace table
compilation_unit_t *code;
+ fn_context_t *fn_ctx;
CORD scope_prefix;
} env_t;
@@ -29,6 +36,7 @@ typedef struct {
} binding_t;
env_t *new_compilation_unit(void);
+env_t *global_scope(env_t *env);
env_t *fresh_scope(env_t *env);
env_t *namespace_env(env_t *env, const char *namespace_name);
__attribute__((noreturn))