aboutsummaryrefslogtreecommitdiff
path: root/syntax_tree.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-08-27 13:38:58 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-08-27 13:39:22 -0700
commit930d522fbc3ab57faa926ed85f0d35d661722402 (patch)
tree8c91c71728b43b4e1817ed182c39bf991cb4b2a9 /syntax_tree.moon
parentc6a7b0be9ebdddb58a03749705987cb3058060d3 (diff)
Bunch of miscellaneous changes. Paved the way a little bit for having
different compiler domains.
Diffstat (limited to 'syntax_tree.moon')
-rw-r--r--syntax_tree.moon6
1 files changed, 4 insertions, 2 deletions
diff --git a/syntax_tree.moon b/syntax_tree.moon
index 885892f..7132c64 100644
--- a/syntax_tree.moon
+++ b/syntax_tree.moon
@@ -19,7 +19,9 @@ for name in *types
.__name = name
.type = name
.is_instance = (x)=> getmetatable(x) == @
- .__tostring = => "#{@type}(#{repr tostring(@source)}, #{concat([repr(v) for v in *@], ', ')})"
+ .__tostring = =>
+ args = {tostring(@source), unpack(@)}
+ "#{@type}(#{concat([repr(v) for v in *args], ', ')})"
.map = (fn)=>
replacement = fn(@)
if replacement == false then return nil
@@ -47,7 +49,7 @@ for name in *types
return true
AST[name] = setmetatable cls,
- __tostring: => @name
+ __tostring: => @__name
__call: (source, ...)=>
if type(source) == 'string'
source = Source\from_string(source)