From 3ed3aa338296f82046de2061e717b49328c8b057 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sun, 31 Oct 2021 11:15:16 +0100 Subject: Ensure lambdas wrap their env tables --- src/parser.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/parser.h') diff --git a/src/parser.h b/src/parser.h index 01f53b0..fa8858e 100755 --- a/src/parser.h +++ b/src/parser.h @@ -4,6 +4,11 @@ #include "lexer.h" #include "hashtable.h" +typedef struct Environment { + HashTable *table; + struct Environment *parent; +} Environment; + typedef enum ObjectType { OBJ_TYPE_NIL, OBJ_TYPE_TRUE, @@ -38,6 +43,7 @@ typedef struct Object { struct { struct Object **params; struct Object **body; + Environment *env; }; // OBJ_TYPE_IF @@ -59,11 +65,6 @@ typedef struct Object { size_t col; } Object; -typedef struct Environment { - HashTable *table; - struct Environment *parent; -} Environment; - typedef struct Parser { Token *tokens; size_t current; -- cgit v1.2.1