aboutsummaryrefslogtreecommitdiff
path: root/syntax_tree.lua
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.lua
parent7112af7cb6ee52f4ef9664db9c03db52d8c73ac9 (diff)
Auto-upgraded everything.
Diffstat (limited to 'syntax_tree.lua')
-rw-r--r--syntax_tree.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/syntax_tree.lua b/syntax_tree.lua
index 230a915..38e71ef 100644
--- a/syntax_tree.lua
+++ b/syntax_tree.lua
@@ -42,16 +42,19 @@ for _index_0 = 1, #types do
return getmetatable(x) == self
end
cls.__tostring = function(self)
- return tostring(self.type) .. tostring(repr(self, (function(x)
- return Source:is_instance(x) and repr(tostring(x)) or nil
- end)))
+ return tostring(self.type) .. tostring(repr(self))
end
cls.__repr = function(self)
- return tostring(self.type) .. tostring(repr(self, (function(x)
- return Source:is_instance(x) and repr(tostring(x)) or nil
- end)))
+ return tostring(self.type) .. tostring(repr(self))
end
- cls.source_code_for_tree = { }
+ cls.source_code_for_tree = setmetatable({ }, {
+ __index = function(self, t)
+ local s = t.source
+ local Files = require('files')
+ local f = Files.read(s.filename)
+ return f
+ end
+ })
cls.get_source_code = function(self)
return self.source_code_for_tree[self]
end