Skip to content

Commit

Permalink
STP bug report
Browse files Browse the repository at this point in the history
  • Loading branch information
raingloom committed Nov 13, 2017
1 parent 66b14d4 commit 647bef0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 33 deletions.
69 changes: 39 additions & 30 deletions src/classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Shared = Module
Token = Class{},
}


Server = Module{}
do
local _ENV = Server
Expand Down Expand Up @@ -42,20 +41,11 @@ end

Clients = Module{}
do

local function spechelper(m,Views)
for _,cls in pairs(m) do
if cls~=View then
cls.Methods = combine(View.Methods, cls.Methods)
cls.Fields = combine(View.Fields, cls.Fields)
cls:specializes(View)
end
end
end

local _ENV = Clients

Shared = Module {

Shared = Module {}
do
local _ENV = Shared
Session = Abstract
{
Fields = {
Expand All @@ -66,9 +56,9 @@ do
register = Server.User.Methods.User,
login = '(email:Email,password:Password)',
},
},
}

Product = Class{},
Product = Class{}

Cart = Class
{
Expand All @@ -79,10 +69,26 @@ do
clear = '()',
price = '():Money',
}
},
}

View = Abstract{},
}
View = Abstract
{
Methods = {
render = '()',
},
}
end

local function spechelper(m)
local View = Shared.View
for _,cls in pairs(m) do
if cls~=View then
cls.Methods = combine(View.Methods, cls.Methods)
cls.Fields = combine(View.Fields, cls.Fields)
cls:specializes(View)
end
end
end

Customer = Module{}
do
Expand Down Expand Up @@ -133,19 +139,22 @@ do
Vendor = Module{}
do
local _ENV = Vendor

IncomingOrders = Class
{
local Views = Module {}
do
local _ENV = Views

}
IncomingOrders = Class
{

}

AddProduct = Class
{
Methods = {
add = '',
AddProduct = Class
{
Methods = {
}
}
}

spechelper(_ENV,Shared.View)
spechelper(_ENV)
end
end
end
6 changes: 3 additions & 3 deletions src/umler.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if false and not package.loaded.StackTracePlus then
if not package.loaded.StackTracePlus then
local STP = require 'StackTracePlus'
return assert(
xpcall(
Expand Down Expand Up @@ -149,10 +149,10 @@ do

function envmt:__index(k)
if k == 'Module' then
return function()
return function(t)
local r = setmetatable({},modulemt)
envs[r] = self
vals[r] = {}
vals[r] = t
return r
end
elseif vals[self][k]~=nil then
Expand Down

0 comments on commit 647bef0

Please sign in to comment.