From e22c35681f90740b4f5006c30b3f154ebd1f8ea2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 14 Sep 2018 19:17:09 -0700 Subject: Auto-upgraded everything. --- syntax_tree.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'syntax_tree.lua') 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 -- cgit v1.2.3