fix some type shenanigans
This commit is contained in:
parent
738bbdafb9
commit
89cbcd85a4
6
index.js
6
index.js
|
@ -28,6 +28,10 @@ function transpileType(type) {
|
|||
return transpileType(type.slice(0, -2)) + '[]';
|
||||
}
|
||||
|
||||
if (type.startsWith('LuaMultiReturn<[') && type.endsWith(']>')) {
|
||||
return type.replace('LuaMultiReturn<[','').replace(']>','').split(',').map(t => transpileType(t.split(':')[1])).join(', ');
|
||||
}
|
||||
|
||||
if (type.includes('|')) {
|
||||
return type.split('|').map(t => transpileType(t)).join(' | ');
|
||||
}
|
||||
|
@ -139,7 +143,7 @@ function parse(code) {
|
|||
|
||||
// look for functions
|
||||
let functionFreeCode = code;
|
||||
const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]\s|<>,]+))?/g; // wow this sucks
|
||||
const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]\s|<>,:]+))?/g; // wow this sucks
|
||||
while ((match = functions.exec(code)) !== null) {
|
||||
parsedElements++;
|
||||
functionFreeCode = functionFreeCode.replace(match[0], '');
|
||||
|
|
Loading…
Reference in New Issue