aboutsummaryrefslogtreecommitdiff
path: root/syntax_tree.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-09-28 22:15:06 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-09-28 22:15:19 -0700
commit63d8b1cd3f34b15bf86210b99209e8b57e7019bb (patch)
treecdaa28cbbe3e1fad493780a2f55a3f4f6075c1ea /syntax_tree.moon
parent678344182b1f04e35063d7185ac1d74317b011ea (diff)
Fully working, I think? (with a lot of shims)
Diffstat (limited to 'syntax_tree.moon')
-rw-r--r--syntax_tree.moon3
1 files changed, 2 insertions, 1 deletions
diff --git a/syntax_tree.moon b/syntax_tree.moon
index d2f5d37..926ea09 100644
--- a/syntax_tree.moon
+++ b/syntax_tree.moon
@@ -6,7 +6,7 @@ unpack or= table.unpack
AST = {}
AST.is_syntax_tree = (n, t=nil)->
- type(n) == 'table' and getmetatable(n) and AST[n.type] == getmetatable(n) and (t == nil or n.type == t)
+ type(n) == 'table' and getmetatable(n) and getmetatable(n).__type == "Syntax Tree" and (t == nil or n.type == t)
as_lua = =>
if type(@) == 'number'
@@ -25,6 +25,7 @@ for name in *types
.__index = cls
.__name = name
.type = name
+ .__type = "Syntax Tree"
.is_instance = (x)=> getmetatable(x) == @
.__tostring = =>
bits = [tostring(b) for b in *@]