From 0d00f3574cc178aa2662ea6edc30ea245fe59889 Mon Sep 17 00:00:00 2001 From: Dylan <57853417+4812571@users.noreply.github.com> Date: Sun, 12 May 2024 17:13:56 -0500 Subject: [PATCH 1/3] remove trailing whitespace --- src/Types.luau | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Types.luau b/src/Types.luau index f67f8a783..768e9408a 100644 --- a/src/Types.luau +++ b/src/Types.luau @@ -271,7 +271,6 @@ export type Fusion = { Attribute: (attributeName: string) -> SpecialKey, AttributeChange: (attributeName: string) -> SpecialKey, AttributeOut: (attributeName: string) -> SpecialKey, - } return nil From 7f62425b80ca1c47122b97ef0f5d2587cd97344e Mon Sep 17 00:00:00 2001 From: Dylan <57853417+4812571@users.noreply.github.com> Date: Sun, 12 May 2024 17:16:01 -0500 Subject: [PATCH 2/3] change `doCleanup` to no longer be variadic --- src/Memory/doCleanup.luau | 12 ++---------- src/Types.luau | 2 +- test/Spec/Memory/doCleanup.spec.luau | 14 -------------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/Memory/doCleanup.luau b/src/Memory/doCleanup.luau index fac6c3aea..c43388fc1 100644 --- a/src/Memory/doCleanup.luau +++ b/src/Memory/doCleanup.luau @@ -14,7 +14,7 @@ local task = nil -- Disable usage of Roblox's task scheduler - an array - `cleanup` will be called on each item ]] -local function doCleanupOne( +local function doCleanup( task: unknown ) local taskType = typeof(task) @@ -53,19 +53,11 @@ local function doCleanupOne( -- It is important to iterate backwards through the table, since -- objects are added in order of construction. for index = #task, 1, -1 do - doCleanupOne(task[index]) + doCleanup(task[index]) task[index] = nil end end end end -local function doCleanup( - ...: unknown -) - for index = 1, select("#", ...) do - doCleanupOne(select(index, ...)) - end -end - return doCleanup \ No newline at end of file diff --git a/src/Types.luau b/src/Types.luau index 768e9408a..47dd2dcfd 100644 --- a/src/Types.luau +++ b/src/Types.luau @@ -245,7 +245,7 @@ export type Fusion = { version: Version, Contextual: ContextualConstructor, - doCleanup: (...unknown) -> (), + doCleanup: (unknown) -> (), scoped: ScopedConstructor, deriveScope: <T>(existing: Scope<T>) -> Scope<T>, diff --git a/test/Spec/Memory/doCleanup.spec.luau b/test/Spec/Memory/doCleanup.spec.luau index 76a425dda..0aad19898 100644 --- a/test/Spec/Memory/doCleanup.spec.luau +++ b/test/Spec/Memory/doCleanup.spec.luau @@ -132,18 +132,4 @@ return function() expect(runs[2]).to.equal(2) expect(runs[3]).to.equal(1) end) - - it("should clean up variadic arguments", function() - local expect = getfenv().expect - - local numRuns = 0 - - local function doRun() - numRuns += 1 - end - - doCleanup(doRun, doRun, doRun) - - expect(numRuns).to.equal(3) - end) end \ No newline at end of file From 67c2da19c3cacd68efb566eb11318614bd79d015 Mon Sep 17 00:00:00 2001 From: Dylan <57853417+4812571@users.noreply.github.com> Date: Sun, 12 May 2024 17:21:20 -0500 Subject: [PATCH 3/3] update documentation for ``doCleanup`` --- docs/api-reference/memory/members/docleanup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-reference/memory/members/docleanup.md b/docs/api-reference/memory/members/docleanup.md index 25eb41c40..7304099ed 100644 --- a/docs/api-reference/memory/members/docleanup.md +++ b/docs/api-reference/memory/members/docleanup.md @@ -14,7 +14,7 @@ ```Lua function Fusion.doCleanup( - ...: unknown + task: unknown ): () ``` @@ -30,7 +30,7 @@ Attempts to destroy all arguments based on their runtime type. ## Parameters <h3 markdown> - ... + task <span class="fusiondoc-api-type"> : unknown </span>