add sproto double type (#1221)

Co-authored-by: zixun <lvzxiun@gmail.com>
This commit is contained in:
子熏
2020-07-27 17:57:55 +08:00
committed by GitHub
parent f2b1bd7319
commit bfc19ee7b9
4 changed files with 29 additions and 2 deletions

View File

@@ -97,7 +97,10 @@ local convert = {}
function convert.protocol(all, obj)
local result = { tag = obj[2] }
for _, p in ipairs(obj[3]) do
assert(result[p[1]] == nil)
local pt = p[1]
if result[pt] ~= nil then
error(string.format("redefine %s in protocol %s", pt, obj[1]))
end
local typename = p[2]
if type(typename) == "table" then
local struct = typename
@@ -179,6 +182,7 @@ local buildin_types = {
boolean = 1,
string = 2,
binary = 2, -- binary is a sub type of string
double = 3,
}
local function checktype(types, ptype, t)