-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
--!strict | ||
--!nolint LocalShadow | ||
|
||
--[[ | ||
Creates cleanup tables with access to constructors as methods. | ||
]] | ||
|
||
local Package = script.Parent.Parent | ||
local Types = require(Package.Types) | ||
local logError = require(Package.Logging.logError) | ||
local scopePool = require(Package.Memory.scopePool) | ||
|
||
local function merge( | ||
into: {[unknown]: unknown}, | ||
from: {[unknown]: unknown}?, | ||
...: {[unknown]: unknown} | ||
): {[unknown]: unknown} | ||
if from == nil then | ||
return into | ||
else | ||
for key, value in from do | ||
if into[key] == nil then | ||
into[key] = value | ||
else | ||
logError("mergeConflict", nil, tostring(key)) | ||
end | ||
end | ||
return merge(into, ...) | ||
end | ||
end | ||
|
||
local function scoped( | ||
...: {[unknown]: unknown} | ||
): {[unknown]: unknown} | ||
return setmetatable( | ||
scopePool.reuseAny() or {}, | ||
{__index = merge({}, ...)} | ||
) :: any | ||
end | ||
|
||
--!strict | ||
--!nolint LocalShadow | ||
|
||
--[[ | ||
Creates cleanup tables with access to constructors as methods. | ||
]] | ||
|
||
local Package = script.Parent.Parent | ||
local Types = require(Package.Types) | ||
local logError = require(Package.Logging.logError) | ||
local scopePool = require(Package.Memory.scopePool) | ||
|
||
local function merge( | ||
into: {[unknown]: unknown}, | ||
from: {[unknown]: unknown}?, | ||
...: {[unknown]: unknown} | ||
): {[unknown]: unknown} | ||
if from == nil then | ||
return into | ||
else | ||
for key, value in from do | ||
if into[key] == nil then | ||
into[key] = value | ||
else | ||
logError("mergeConflict", nil, tostring(key)) | ||
end | ||
end | ||
return merge(into, ...) | ||
end | ||
end | ||
|
||
local function scoped( | ||
...: {[unknown]: unknown} | ||
): {[unknown]: unknown} | ||
return setmetatable( | ||
scopePool.reuseAny() or {}, | ||
{__index = merge({}, ...)} | ||
) :: any | ||
end | ||
|
||
return (scoped :: any) :: Types.ScopedConstructor |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.