Uncomment task lib argument stuff to prepare for implementation

This commit is contained in:
Filip Tibell 2023-01-23 20:59:57 -05:00
parent d71a3a2b10
commit bfe852f034
No known key found for this signature in database
5 changed files with 3 additions and 22 deletions

View file

@ -78,17 +78,17 @@ globals:
task.defer: task.defer:
args: args:
- type: thread | function - type: thread | function
# - type: "..." - type: "..."
task.delay: task.delay:
args: args:
- required: false - required: false
type: number type: number
- type: thread | function - type: thread | function
# - type: "..." - type: "..."
task.spawn: task.spawn:
args: args:
- type: thread | function - type: thread | function
# - type: "..." - type: "..."
task.wait: task.wait:
args: args:
- required: false - required: false

View file

@ -52,15 +52,6 @@ declare process: {
}, },
} }
declare task: {
cancel: (thread: thread) -> (),
defer: (functionOrThread: thread | (...any) -> (...any)) -> thread,
delay: (duration: number?, functionOrThread: thread | (...any) -> (...any)) -> thread,
spawn: (functionOrThread: thread | (...any) -> (...any)) -> thread,
wait: (duration: number?) -> (number),
}
--[[
declare task: { declare task: {
cancel: (thread: thread) -> (), cancel: (thread: thread) -> (),
defer: <T...>(functionOrThread: thread | (T...) -> (...any), T...) -> thread, defer: <T...>(functionOrThread: thread | (T...) -> (...any), T...) -> thread,
@ -68,4 +59,3 @@ declare task: {
spawn: <T...>(functionOrThread: thread | (T...) -> (...any), T...) -> thread, spawn: <T...>(functionOrThread: thread | (T...) -> (...any), T...) -> thread,
wait: (duration: number?) -> (number), wait: (duration: number?) -> (number),
} }
]]

View file

@ -40,8 +40,6 @@ assert(not flag2, "Defer should run after spawned threads")
-- Varargs should get passed correctly -- Varargs should get passed correctly
-- TODO: Uncomment when vararg support is added
--[[
local function f(arg1: string, arg2: number, f2: (...any) -> ...any) local function f(arg1: string, arg2: number, f2: (...any) -> ...any)
assert(type(arg1) == "string", "Invalid arg 1 passed to function") assert(type(arg1) == "string", "Invalid arg 1 passed to function")
assert(type(arg2) == "number", "Invalid arg 2 passed to function") assert(type(arg2) == "number", "Invalid arg 2 passed to function")
@ -51,4 +49,3 @@ end
task.defer(f, "", 1, f) task.defer(f, "", 1, f)
task.defer(f, "inf", math.huge, f) task.defer(f, "inf", math.huge, f)
task.defer(f, "NaN", 0 / 0, f) task.defer(f, "NaN", 0 / 0, f)
]]

View file

@ -28,8 +28,6 @@ assert(not flag2, "Delay should work with yielding (2)")
-- Varargs should get passed correctly -- Varargs should get passed correctly
-- TODO: Uncomment when vararg support is added
--[[
local function f(arg1: string, arg2: number, f2: (...any) -> ...any) local function f(arg1: string, arg2: number, f2: (...any) -> ...any)
assert(type(arg1) == "string", "Invalid arg 1 passed to function") assert(type(arg1) == "string", "Invalid arg 1 passed to function")
assert(type(arg2) == "number", "Invalid arg 2 passed to function") assert(type(arg2) == "number", "Invalid arg 2 passed to function")
@ -39,4 +37,3 @@ end
task.delay(0, f, "", 1, f) task.delay(0, f, "", 1, f)
task.delay(0, f, "inf", math.huge, f) task.delay(0, f, "inf", math.huge, f)
task.delay(0, f, "NaN", 0 / 0, f) task.delay(0, f, "NaN", 0 / 0, f)
]]

View file

@ -33,8 +33,6 @@ assert(flag3, "Spawn should run threads made from coroutine.create")
-- Varargs should get passed correctly -- Varargs should get passed correctly
-- TODO: Uncomment when vararg support is added
--[[
local function f(arg1: string, arg2: number, f2: (...any) -> ...any) local function f(arg1: string, arg2: number, f2: (...any) -> ...any)
assert(type(arg1) == "string", "Invalid arg 1 passed to function") assert(type(arg1) == "string", "Invalid arg 1 passed to function")
assert(type(arg2) == "number", "Invalid arg 2 passed to function") assert(type(arg2) == "number", "Invalid arg 2 passed to function")
@ -44,4 +42,3 @@ end
task.spawn(f, "", 1, f) task.spawn(f, "", 1, f)
task.spawn(f, "inf", math.huge, f) task.spawn(f, "inf", math.huge, f)
task.spawn(f, "NaN", 0 / 0, f) task.spawn(f, "NaN", 0 / 0, f)
]]