From ab38fd19fa6e30b4a0629b3445812cb6bf025a25 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 30 Aug 2018 14:06:41 -0700 Subject: Fixed obnoxious bug where List was getting used instead of a Dict, causing havoc when .first and .pop were being accessed. --- syntax_tree.moon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'syntax_tree.moon') diff --git a/syntax_tree.moon b/syntax_tree.moon index bbb7c78..d0c65cc 100644 --- a/syntax_tree.moon +++ b/syntax_tree.moon @@ -30,6 +30,7 @@ for name in *types replacement = setmetatable {k,v for k,v in pairs replacement}, getmetatable(replacement) replacement.source = @source replacement.comments = {unpack(@comments)} if @comments + if init = replacement.__init then init(replacement) else replacement = {source:@source, comments:@comments and {unpack(@comments)}} changes = false @@ -42,6 +43,7 @@ for name in *types replacement[k] = r return @ unless changes replacement = setmetatable replacement, getmetatable(@) + if init = replacement.__init then init(replacement) return replacement .__eq = (other)=> return false if type(@) != type(other) or #@ != #other or getmetatable(@) != getmetatable(other) @@ -58,7 +60,7 @@ for name in *types else assert(Source\is_instance(t.source)) setmetatable(t, @) - if t.__init then t\__init! + if init = t.__init then init(t) return t AST.Action.__init = => -- cgit v1.2.3