summaryrefslogtreecommitdiff
path: root/proc.h
diff options
context:
space:
mode:
authorWormHeamer2025-09-02 01:10:48 -0400
committerWormHeamer2025-09-02 01:10:48 -0400
commitac15eb8b0ca41d502d8a26c360ff65f2b4a18d88 (patch)
tree3fe43d5b6c106525329772a097e9db399dc8d767 /proc.h
parent36c9dd221a25dc741e6f5844ff7cdc87f6f6c946 (diff)
begin work on tracking scope changes instead of merging
Diffstat (limited to 'proc.h')
-rw-r--r--proc.h39
1 files changed, 25 insertions, 14 deletions
diff --git a/proc.h b/proc.h
index ec3687f..0aaa5dc 100644
--- a/proc.h
+++ b/proc.h
@@ -2,6 +2,7 @@
#define PROC_H
#include "ir.h"
+#include "xar.h"
typedef struct NameBinding {
struct NameBinding *prev;
@@ -16,17 +17,35 @@ typedef struct ScopeFrame {
} ScopeFrame;
typedef struct {
+ Str name;
+ Value *from, *to;
+ LexSpan from_pos, to_pos;
+} ScopeChange;
+
+typedef XAR(ScopeChange) ScopeChangeList;
+
+typedef struct {
+ Str name;
+ Value *from, *to;
+ LexSpan from_pos, to_pos;
+} ScopeChange;
+
+typedef struct {
+ Arena *arena;
+ XAR(ScopeChange);
+} ScopeChangeList;
+
+typedef struct {
Arena *arena;
ScopeFrame *tail, *free_scope;
NameBinding *free_bind;
} Scope;
-typedef struct {
- Str name;
- Node *node;
-} ScopeName;
-
-typedef DYNARR(ScopeName) ScopeNameList;
+ScopeFrame *scope_push(Scope *scope);
+ScopeFrame *scope_pop(Scope *scope, Graph *g);
+NameBinding *scope_find(Scope *scope, Str name);
+NameBinding *scope_bind(Scope *scope, Str name, Node *value, LexSpan pos, Graph *g);
+NameBinding *scope_update(NameBinding *b, Node *to, Graph *g);
typedef struct {
Str name;
@@ -40,12 +59,4 @@ typedef struct {
void proc_init(Proc *proc, Str name);
void proc_free(Proc *proc);
-ScopeFrame *scope_push(Scope *scope);
-ScopeFrame *scope_pop(Scope *scope, Graph *g);
-NameBinding *scope_find(Scope *scope, Str name);
-NameBinding *scope_bind(Scope *scope, Str name, Node *value, LexSpan pos, Graph *g);
-NameBinding *scope_update(NameBinding *b, Node *to, Graph *g);
-void scope_collect(Scope *scope, Graph *g, ScopeNameList *nl, Arena *arena);
-void scope_uncollect(Scope *scope, Graph *g, ScopeNameList *nl);
-
#endif