From e6ad30365e5c191ad0cb4b98f0d543414b8be7ef Mon Sep 17 00:00:00 2001 From: s-ol Date: Mon, 10 Feb 2020 16:12:53 +0100 Subject: closures --- core/cell.moon | 2 +- core/invoke.moon | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/cell.moon b/core/cell.moon index 1a25c0a..ae6eea4 100644 --- a/core/cell.moon +++ b/core/cell.moon @@ -36,7 +36,7 @@ class Cell @tag = cell.tag -- for writing back to file clone: (prefix) => - tag = Const.sym prefix\getc! .. @tag\getc! + tag = Const.sym prefix\getc! .. '.' .. @tag\getc! children = [child\clone prefix for child in *@children] Cell tag, children, @white diff --git a/core/invoke.moon b/core/invoke.moon index 6458f2b..9955bce 100644 --- a/core/invoke.moon +++ b/core/invoke.moon @@ -45,9 +45,9 @@ class fn_invoke extends Action true - eval: (scope, tail) => + eval: (outer_scope, tail) => assert @head.type == 'fndef', "cant fn-invoke #{@head}" - { :params, :body } = @head\getc! + { :params, :body, :scope } = @head\getc! assert #params == #tail, "argument count mismatch in #{@head}" @@ -56,7 +56,7 @@ class fn_invoke extends Action for i=1,#params name = params[i]\getc! argm = tail[i] - fn_scope\set name, L\push argm\eval, scope, @registry + fn_scope\set name, L\push argm\eval, outer_scope, @registry body = body\clone @tag -- cgit v1.2.3