~technomancy/antifennel

1957ac95f826d484c261e5266f415d8617563008 — Phil Hagelberg 5 months ago c99902b
Support function definitions that set earlier bindings.
1 files changed, 6 insertions(+), 2 deletions(-)

M anticompiler.fnl
M anticompiler.fnl => anticompiler.fnl +6 -2
@@ 20,8 20,12 @@
        (unpack (map body compile))))

(fn declare-function [compile ast]
  (doto (function compile ast)
    (table.insert 2 (compile ast.id))))
  (if (or ast.locald (= :MemberExpression ast.id.kind))
      (doto (function compile ast)
        (table.insert 2 (compile ast.id)))
      (list (sym :set-forcibly!)
            (compile ast.id)
            (function compile ast))))

(fn local-declaration [compile {: names : expressions}]
  (list (sym :var)