-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast-interface.lua
More file actions
35 lines (33 loc) · 801 Bytes
/
Copy pathast-interface.lua
File metadata and controls
35 lines (33 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Interface = Class("Interface", {
repr = function(self, indent)
return "<iface>"
end,
dereference = function(self)
return self
end,
get_field = function(self, fid)
local e = self.scope[fid]
if e then return
e.field
end
end,
set_struct = function(self, env, struct, tree)
struct.id = tassert(nil, self.id, "AST/Interface no envelope for interface struct")
struct.cid = tassert(nil, self.cid, "AST/Function no c id")
struct.anon = nil
self.struct = struct
self.scope = struct.scope
end,
set_defs = function(self, env, tree)
local m = {}
self.methods = m
for k, v in ipairs(tree) do
m[#m+1] = v
end
end,
},
function(I, env, tree, id)
--dump(tree)
local self = mktab(env, tree, {id = id}, I)
return self
end)