diff options
| author | 2022-08-18 09:47:54 +0200 | |
|---|---|---|
| committer | 2022-08-18 09:47:54 +0200 | |
| commit | f0214ff61b5a94b9629db6f43d7a5b010bd4ffbc (patch) | |
| tree | c8517b4950bc3937e82ff49c757fb24a7364e3b0 /src/env.cff | |
| parent | 8c81c70b904a41b8a0d44dc418b7c39bf325c2a2 (diff) | |
fix bodyarg
Diffstat (limited to 'src/env.cff')
| -rw-r--r-- | src/env.cff | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/env.cff b/src/env.cff index f18fe49..aa5c6d4 100644 --- a/src/env.cff +++ b/src/env.cff @@ -28,11 +28,19 @@ extern fn envput(env *Env, decl Decl, old **const Decl) *Decl { let l **DeclList = env.decls->get_slot(decl.name); let n *DeclList = anew(env.alloc, DeclList); if *l { // decl with this name exists - *old = &(*l).decl; - return #null; + let old = (*old = &(*l).decl); + switch { + case old.u.#tag == :Fn and decl.u.#tag == :Fn and decl.u.Fn.ty == old.u.Fn.ty and old.u.Fn.body->empty(); + case decl.u.#tag == :Let; + case env != old.myenv; + + case else; + return #null; + } } n.link = *l; n.decl = decl; + n.decl.myenv = env; *l = n; return &n.decl; } |