aboutsummaryrefslogtreecommitdiff
path: root/syntax_tree.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-09-14 19:17:09 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-09-14 19:17:16 -0700
commite22c35681f90740b4f5006c30b3f154ebd1f8ea2 (patch)
treec7f04d968bade120ebf75cfa0b9f073602917122 /syntax_tree.moon
parent7112af7cb6ee52f4ef9664db9c03db52d8c73ac9 (diff)
Auto-upgraded everything.
Diffstat (limited to 'syntax_tree.moon')
-rw-r--r--syntax_tree.moon11
1 files changed, 8 insertions, 3 deletions
diff --git a/syntax_tree.moon b/syntax_tree.moon
index cd9bccc..633b5ca 100644
--- a/syntax_tree.moon
+++ b/syntax_tree.moon
@@ -19,9 +19,14 @@ for name in *types
.__name = name
.type = name
.is_instance = (x)=> getmetatable(x) == @
- .__tostring = => "#{@type}#{repr @, ((x)-> Source\is_instance(x) and repr(tostring(x)) or nil)}"
- .__repr = => "#{@type}#{repr @, ((x)-> Source\is_instance(x) and repr(tostring(x)) or nil)}"
- .source_code_for_tree = {}
+ .__tostring = => "#{@type}#{repr @}"
+ .__repr = => "#{@type}#{repr @}"
+ .source_code_for_tree = setmetatable({}, {__index:(t)=>
+ s = t.source
+ Files = require 'files'
+ f = Files.read(s.filename)
+ return f
+ })
.get_source_code = => @source_code_for_tree[@]
.map = (fn)=>
replacement = fn(@)