aboutsummaryrefslogtreecommitdiff
path: root/syntax_tree.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-08-30 14:06:41 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-08-30 14:07:40 -0700
commitab38fd19fa6e30b4a0629b3445812cb6bf025a25 (patch)
treeea2a2c71535d1a9c58ca947671ca039441a728cc /syntax_tree.moon
parent77ebe2fb2a7f6508437f1560af031eb8abd4672b (diff)
Fixed obnoxious bug where List was getting used instead of a Dict,
causing havoc when .first and .pop were being accessed.
Diffstat (limited to 'syntax_tree.moon')
-rw-r--r--syntax_tree.moon4
1 files changed, 3 insertions, 1 deletions
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 = =>