@trioforge/crucible 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/maths/spline/package.json +4 -0
- package/out/client/index.d.ts +7 -0
- package/out/client/init.luau +36 -1
- package/out/configs.d.ts +37 -0
- package/out/configs.luau +46 -0
- package/out/data.d.ts +224 -0
- package/out/data.luau +97 -0
- package/out/emit/configs.d.ts +4 -0
- package/out/emit/configs.luau +22 -0
- package/out/emit/data.d.ts +6 -0
- package/out/emit/data.luau +19 -0
- package/out/emit/index.d.ts +5 -1
- package/out/emit/init.luau +23 -7
- package/out/emit/network.d.ts +6 -0
- package/out/emit/network.luau +36 -0
- package/out/emit/replicated.d.ts +4 -0
- package/out/emit/replicated.luau +13 -0
- package/out/index.d.ts +8 -0
- package/out/init.luau +23 -0
- package/out/internal/binding.luau +5 -0
- package/out/internal/boot.luau +112 -8
- package/out/internal/configs/limits.d.ts +10 -0
- package/out/internal/configs/limits.luau +25 -0
- package/out/internal/configs/port.d.ts +29 -0
- package/out/internal/configs/port.luau +99 -0
- package/out/internal/configs/runtime.d.ts +21 -0
- package/out/internal/configs/runtime.luau +981 -0
- package/out/internal/data/admission.d.ts +1 -0
- package/out/internal/data/admission.luau +673 -0
- package/out/internal/data/declarations.d.ts +1 -0
- package/out/internal/data/declarations.luau +384 -0
- package/out/internal/data/envelope.d.ts +1 -0
- package/out/internal/data/envelope.luau +318 -0
- package/out/internal/data/handles.d.ts +1 -0
- package/out/internal/data/handles.luau +255 -0
- package/out/internal/data/inbox-transforms.d.ts +1 -0
- package/out/internal/data/inbox-transforms.luau +458 -0
- package/out/internal/data/inbox.d.ts +1 -0
- package/out/internal/data/inbox.luau +437 -0
- package/out/internal/data/lease.d.ts +1 -0
- package/out/internal/data/lease.luau +304 -0
- package/out/internal/data/limits.d.ts +1 -0
- package/out/internal/data/limits.luau +234 -0
- package/out/internal/data/messages.d.ts +1 -0
- package/out/internal/data/messages.luau +69 -0
- package/out/internal/data/operation-id.d.ts +1 -0
- package/out/internal/data/operation-id.luau +61 -0
- package/out/internal/data/paths.d.ts +2 -0
- package/out/internal/data/paths.luau +323 -0
- package/out/internal/data/port.d.ts +1 -0
- package/out/internal/data/port.luau +290 -0
- package/out/internal/data/profiles.d.ts +1 -0
- package/out/internal/data/profiles.luau +862 -0
- package/out/internal/data/receipts.d.ts +1 -0
- package/out/internal/data/receipts.luau +190 -0
- package/out/internal/data/record-bindings.d.ts +1 -0
- package/out/internal/data/record-bindings.luau +92 -0
- package/out/internal/data/record-declarations.d.ts +1 -0
- package/out/internal/data/record-declarations.luau +140 -0
- package/out/internal/data/records.d.ts +1 -0
- package/out/internal/data/records.luau +400 -0
- package/out/internal/data/runtime.d.ts +1 -0
- package/out/internal/data/runtime.luau +918 -0
- package/out/internal/data/scheduler.d.ts +1 -0
- package/out/internal/data/scheduler.luau +507 -0
- package/out/internal/data/session.d.ts +1 -0
- package/out/internal/data/session.luau +234 -0
- package/out/internal/data/shutdown.d.ts +1 -0
- package/out/internal/data/shutdown.luau +91 -0
- package/out/internal/data/waiters.d.ts +1 -0
- package/out/internal/data/waiters.luau +65 -0
- package/out/internal/lifecycle.luau +45 -0
- package/out/internal/network/catalog.d.ts +26 -0
- package/out/internal/network/catalog.luau +182 -0
- package/out/internal/network/claims.d.ts +1 -0
- package/out/internal/network/claims.luau +146 -0
- package/out/internal/network/client-session.d.ts +1 -0
- package/out/internal/network/client-session.luau +405 -0
- package/out/internal/network/codec.d.ts +63 -0
- package/out/internal/network/codec.luau +1183 -0
- package/out/internal/network/envelope.d.ts +1 -0
- package/out/internal/network/envelope.luau +247 -0
- package/out/internal/network/limits.d.ts +26 -0
- package/out/internal/network/limits.luau +55 -0
- package/out/internal/network/port.d.ts +1 -0
- package/out/internal/network/port.luau +19 -0
- package/out/internal/network/roblox-network-port.d.ts +1 -0
- package/out/internal/network/roblox-network-port.luau +105 -0
- package/out/internal/network/schema.d.ts +72 -0
- package/out/internal/network/schema.luau +386 -0
- package/out/internal/network/server-session.d.ts +1 -0
- package/out/internal/network/server-session.luau +395 -0
- package/out/internal/network/session.d.ts +1 -0
- package/out/internal/network/session.luau +266 -0
- package/out/internal/reactive/context.d.ts +1 -0
- package/out/internal/reactive/context.luau +149 -0
- package/out/internal/reactive/flush.d.ts +1 -0
- package/out/internal/reactive/flush.luau +355 -0
- package/out/internal/reactive/graph.d.ts +1 -0
- package/out/internal/reactive/graph.luau +626 -0
- package/out/internal/reactive/limits.d.ts +1 -0
- package/out/internal/reactive/limits.luau +54 -0
- package/out/internal/reactive/ownership.d.ts +1 -0
- package/out/internal/reactive/ownership.luau +626 -0
- package/out/internal/registry.luau +10 -1
- package/out/internal/sync/client-sync.d.ts +1 -0
- package/out/internal/sync/client-sync.luau +157 -0
- package/out/internal/sync/declarations.d.ts +1 -0
- package/out/internal/sync/declarations.luau +276 -0
- package/out/internal/sync/frame.d.ts +1 -0
- package/out/internal/sync/frame.luau +91 -0
- package/out/internal/sync/server-sync.d.ts +1 -0
- package/out/internal/sync/server-sync.luau +502 -0
- package/out/internal/sync/values.d.ts +1 -0
- package/out/internal/sync/values.luau +930 -0
- package/out/maths/spline/curve.d.ts +35 -0
- package/out/maths/spline/curve.luau +1122 -0
- package/out/maths/spline/index.d.ts +2 -0
- package/out/maths/spline/init.luau +8 -0
- package/out/network.d.ts +66 -0
- package/out/network.luau +24 -0
- package/out/reactive.d.ts +76 -0
- package/out/reactive.luau +136 -0
- package/out/replicated.d.ts +38 -0
- package/out/replicated.luau +45 -0
- package/out/server/data.d.ts +54 -0
- package/out/server/data.luau +44 -0
- package/out/server/index.d.ts +17 -0
- package/out/server/init.luau +58 -4
- package/out/server/publish.d.ts +20 -0
- package/out/server/publish.luau +24 -0
- package/out/testing/index.d.ts +38 -0
- package/out/testing/init.luau +189 -0
- package/out/util/random/index.d.ts +24 -0
- package/out/util/random/init.luau +301 -0
- package/out/vide/index.d.ts +7 -0
- package/out/vide/init.luau +50 -0
- package/package.json +28 -2
- package/testing/package.json +4 -0
- package/transformer/data.cjs +72 -0
- package/transformer/declarations.cjs +153 -0
- package/transformer/index.js +87 -23
- package/transformer/network.cjs +961 -0
- package/util/random/package.json +4 -0
- package/vide/package.json +4 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local MAX_UNION_BRANCHES = TS.import(script, script.Parent, "limits").MAX_UNION_BRANCHES
|
|
4
|
+
-- Descriptors arrive from Luau, where the types above do not hold, so provenance is checked at runtime.
|
|
5
|
+
local descriptors = {}
|
|
6
|
+
local function descriptor(node)
|
|
7
|
+
local _node = node
|
|
8
|
+
descriptors[_node] = true
|
|
9
|
+
return table.freeze(node)
|
|
10
|
+
end
|
|
11
|
+
local function assertDescriptor(node)
|
|
12
|
+
local _node = node
|
|
13
|
+
local _condition = type(_node) == "table"
|
|
14
|
+
if _condition then
|
|
15
|
+
local _node_1 = node
|
|
16
|
+
_condition = descriptors[_node_1] ~= nil
|
|
17
|
+
end
|
|
18
|
+
assert(_condition, "expected a descriptor constructor result")
|
|
19
|
+
end
|
|
20
|
+
local function numericName(name)
|
|
21
|
+
return tostring(tonumber(name)) == name
|
|
22
|
+
end
|
|
23
|
+
local function literal(value)
|
|
24
|
+
local _value = value
|
|
25
|
+
local _condition = type(_value) == "string"
|
|
26
|
+
if not _condition then
|
|
27
|
+
local _value_1 = value
|
|
28
|
+
_condition = type(_value_1) == "boolean"
|
|
29
|
+
if not _condition then
|
|
30
|
+
local _value_2 = value
|
|
31
|
+
local _condition_1 = type(_value_2) == "number"
|
|
32
|
+
if _condition_1 then
|
|
33
|
+
_condition_1 = value == value and math.abs(value) < math.huge
|
|
34
|
+
end
|
|
35
|
+
_condition = _condition_1
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
assert(_condition, "invalid literal")
|
|
39
|
+
return descriptor({
|
|
40
|
+
kind = "literal",
|
|
41
|
+
value = value,
|
|
42
|
+
})
|
|
43
|
+
end
|
|
44
|
+
local function admitsNil(node)
|
|
45
|
+
local _condition = node.kind == "nil" or node.kind == "dynamic"
|
|
46
|
+
if not _condition then
|
|
47
|
+
local _condition_1 = node.kind == "union"
|
|
48
|
+
if _condition_1 then
|
|
49
|
+
local _exp = node.branches
|
|
50
|
+
-- ▼ ReadonlyArray.some ▼
|
|
51
|
+
local _result = false
|
|
52
|
+
for _k, _v in _exp do
|
|
53
|
+
if admitsNil(_v, _k - 1, _exp) then
|
|
54
|
+
_result = true
|
|
55
|
+
break
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
-- ▲ ReadonlyArray.some ▲
|
|
59
|
+
_condition_1 = _result
|
|
60
|
+
end
|
|
61
|
+
_condition = _condition_1
|
|
62
|
+
end
|
|
63
|
+
return _condition
|
|
64
|
+
end
|
|
65
|
+
local function runtimeKind(node)
|
|
66
|
+
local _exp = node.kind
|
|
67
|
+
repeat
|
|
68
|
+
local _fallthrough = false
|
|
69
|
+
if _exp == "bool" then
|
|
70
|
+
return "boolean"
|
|
71
|
+
end
|
|
72
|
+
if _exp == "f64" then
|
|
73
|
+
_fallthrough = true
|
|
74
|
+
end
|
|
75
|
+
if _fallthrough or _exp == "f32" then
|
|
76
|
+
_fallthrough = true
|
|
77
|
+
end
|
|
78
|
+
if _fallthrough or _exp == "u8" then
|
|
79
|
+
_fallthrough = true
|
|
80
|
+
end
|
|
81
|
+
if _fallthrough or _exp == "u16" then
|
|
82
|
+
_fallthrough = true
|
|
83
|
+
end
|
|
84
|
+
if _fallthrough or _exp == "u32" then
|
|
85
|
+
return "number"
|
|
86
|
+
end
|
|
87
|
+
if _exp == "string" then
|
|
88
|
+
return "string"
|
|
89
|
+
end
|
|
90
|
+
if _exp == "vector3" then
|
|
91
|
+
return "Vector3"
|
|
92
|
+
end
|
|
93
|
+
if _exp == "color3" then
|
|
94
|
+
return "Color3"
|
|
95
|
+
end
|
|
96
|
+
if _exp == "cframe" then
|
|
97
|
+
return "CFrame"
|
|
98
|
+
end
|
|
99
|
+
if _exp == "instance" then
|
|
100
|
+
return "Instance"
|
|
101
|
+
end
|
|
102
|
+
return "table"
|
|
103
|
+
until true
|
|
104
|
+
end
|
|
105
|
+
local function literalLess(a, b)
|
|
106
|
+
local ranks = {
|
|
107
|
+
boolean = 0,
|
|
108
|
+
number = 1,
|
|
109
|
+
string = 2,
|
|
110
|
+
}
|
|
111
|
+
local _a = a
|
|
112
|
+
local ak = typeof(_a)
|
|
113
|
+
local _b = b
|
|
114
|
+
local bk = typeof(_b)
|
|
115
|
+
if ak ~= bk then
|
|
116
|
+
return ranks[ak] < ranks[bk]
|
|
117
|
+
end
|
|
118
|
+
local _a_1 = a
|
|
119
|
+
local _condition = type(_a_1) == "boolean"
|
|
120
|
+
if _condition then
|
|
121
|
+
local _b_1 = b
|
|
122
|
+
_condition = type(_b_1) == "boolean"
|
|
123
|
+
end
|
|
124
|
+
if _condition then
|
|
125
|
+
return not a and b
|
|
126
|
+
end
|
|
127
|
+
local _a_2 = a
|
|
128
|
+
local _condition_1 = type(_a_2) == "number"
|
|
129
|
+
if _condition_1 then
|
|
130
|
+
local _b_1 = b
|
|
131
|
+
_condition_1 = type(_b_1) == "number"
|
|
132
|
+
end
|
|
133
|
+
if _condition_1 then
|
|
134
|
+
return a < b
|
|
135
|
+
end
|
|
136
|
+
return a < b
|
|
137
|
+
end
|
|
138
|
+
--* Rule 63 order and rule 65 ambiguity, asserted by the builder and again by `compile`.
|
|
139
|
+
local function checkUnion(branches)
|
|
140
|
+
local _arg0 = #branches > 0 and #branches <= MAX_UNION_BRANCHES
|
|
141
|
+
assert(_arg0, "invalid union size")
|
|
142
|
+
local kinds = {}
|
|
143
|
+
local phase = 0
|
|
144
|
+
local previousLiteral
|
|
145
|
+
local previousKind
|
|
146
|
+
local discriminant
|
|
147
|
+
for i = 0, #branches - 1 do
|
|
148
|
+
local branch = branches[i + 1]
|
|
149
|
+
assertDescriptor(branch)
|
|
150
|
+
if branch.kind == "nil" then
|
|
151
|
+
local _arg0_1 = i == 0
|
|
152
|
+
assert(_arg0_1, "absent must be first")
|
|
153
|
+
elseif branch.kind == "literal" then
|
|
154
|
+
local _arg0_1 = phase <= 1 and (previousLiteral == nil or literalLess(previousLiteral, branch.value))
|
|
155
|
+
assert(_arg0_1, "literal order")
|
|
156
|
+
phase = 1
|
|
157
|
+
previousLiteral = branch.value
|
|
158
|
+
elseif branch.kind == "variant" then
|
|
159
|
+
local _arg0_1 = not (kinds.table ~= nil) and (discriminant == nil or discriminant == branch.key)
|
|
160
|
+
assert(_arg0_1, "ambiguous variants")
|
|
161
|
+
if phase < 3 then
|
|
162
|
+
previousLiteral = nil
|
|
163
|
+
end
|
|
164
|
+
local _arg0_2 = previousLiteral == nil or literalLess(previousLiteral, branch.value)
|
|
165
|
+
assert(_arg0_2, "variant order")
|
|
166
|
+
phase = 3
|
|
167
|
+
previousLiteral = branch.value
|
|
168
|
+
discriminant = branch.key
|
|
169
|
+
else
|
|
170
|
+
local kind = runtimeKind(branch)
|
|
171
|
+
local _arg0_1 = branch.kind ~= "union" and branch.kind ~= "dynamic" and phase <= 2 and not (kinds[kind] ~= nil) and (previousKind == nil or previousKind < kind)
|
|
172
|
+
assert(_arg0_1, "ambiguous union")
|
|
173
|
+
phase = 2
|
|
174
|
+
kinds[kind] = true
|
|
175
|
+
previousKind = kind
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
local function node(child)
|
|
180
|
+
assertDescriptor(child)
|
|
181
|
+
local _arg0 = child.kind ~= "variant"
|
|
182
|
+
assert(_arg0, "variant outside union")
|
|
183
|
+
return child
|
|
184
|
+
end
|
|
185
|
+
local n = table.freeze({
|
|
186
|
+
["nil"] = descriptor({
|
|
187
|
+
kind = "nil",
|
|
188
|
+
}),
|
|
189
|
+
bool = descriptor({
|
|
190
|
+
kind = "bool",
|
|
191
|
+
}),
|
|
192
|
+
f64 = descriptor({
|
|
193
|
+
kind = "f64",
|
|
194
|
+
}),
|
|
195
|
+
f32 = descriptor({
|
|
196
|
+
kind = "f32",
|
|
197
|
+
}),
|
|
198
|
+
u8 = descriptor({
|
|
199
|
+
kind = "u8",
|
|
200
|
+
}),
|
|
201
|
+
u16 = descriptor({
|
|
202
|
+
kind = "u16",
|
|
203
|
+
}),
|
|
204
|
+
u32 = descriptor({
|
|
205
|
+
kind = "u32",
|
|
206
|
+
}),
|
|
207
|
+
string = descriptor({
|
|
208
|
+
kind = "string",
|
|
209
|
+
}),
|
|
210
|
+
vector3 = descriptor({
|
|
211
|
+
kind = "vector3",
|
|
212
|
+
}),
|
|
213
|
+
color3 = descriptor({
|
|
214
|
+
kind = "color3",
|
|
215
|
+
}),
|
|
216
|
+
cframe = descriptor({
|
|
217
|
+
kind = "cframe",
|
|
218
|
+
}),
|
|
219
|
+
dynamic = descriptor({
|
|
220
|
+
kind = "dynamic",
|
|
221
|
+
}),
|
|
222
|
+
literal = literal,
|
|
223
|
+
instance = function(classes)
|
|
224
|
+
local _classes = classes
|
|
225
|
+
local _condition = type(_classes) == "table"
|
|
226
|
+
if _condition then
|
|
227
|
+
_condition = #classes > 0
|
|
228
|
+
end
|
|
229
|
+
assert(_condition, "empty Instance classes")
|
|
230
|
+
local _array = {}
|
|
231
|
+
local _length = #_array
|
|
232
|
+
table.move(classes, 1, #classes, _length + 1, _array)
|
|
233
|
+
local copy = _array
|
|
234
|
+
for i = 0, #copy - 1 do
|
|
235
|
+
local _arg0 = copy[i + 1]
|
|
236
|
+
local _condition_1 = type(_arg0) == "string"
|
|
237
|
+
if _condition_1 then
|
|
238
|
+
_condition_1 = (i == 0 or copy[i] < copy[i + 1])
|
|
239
|
+
end
|
|
240
|
+
assert(_condition_1, "Instance classes must be sorted and unique")
|
|
241
|
+
end
|
|
242
|
+
return descriptor({
|
|
243
|
+
kind = "instance",
|
|
244
|
+
classes = table.freeze(copy),
|
|
245
|
+
})
|
|
246
|
+
end,
|
|
247
|
+
object = function(fields)
|
|
248
|
+
-- ▼ ReadonlyArray.map ▼
|
|
249
|
+
local _newValue = table.create(#fields)
|
|
250
|
+
local _callback = function(_param)
|
|
251
|
+
local name = _param[1]
|
|
252
|
+
local child = _param[2]
|
|
253
|
+
local _arg0 = type(name) == "string" and not numericName(name)
|
|
254
|
+
assert(_arg0, "numeric property name")
|
|
255
|
+
return table.freeze({ name, node(child) })
|
|
256
|
+
end
|
|
257
|
+
for _k, _v in fields do
|
|
258
|
+
_newValue[_k] = _callback(_v, _k - 1, fields)
|
|
259
|
+
end
|
|
260
|
+
-- ▲ ReadonlyArray.map ▲
|
|
261
|
+
local copy = _newValue
|
|
262
|
+
for i = 1, #copy - 1 do
|
|
263
|
+
local _arg0 = copy[i][1] < copy[i + 1][1]
|
|
264
|
+
assert(_arg0, "fields must be sorted and unique")
|
|
265
|
+
end
|
|
266
|
+
return descriptor({
|
|
267
|
+
kind = "object",
|
|
268
|
+
fields = table.freeze(copy),
|
|
269
|
+
})
|
|
270
|
+
end,
|
|
271
|
+
array = function(element)
|
|
272
|
+
local _arg0 = not admitsNil(node(element))
|
|
273
|
+
assert(_arg0, "nil array element")
|
|
274
|
+
return descriptor({
|
|
275
|
+
kind = "array",
|
|
276
|
+
element = element,
|
|
277
|
+
})
|
|
278
|
+
end,
|
|
279
|
+
tuple = function(elements)
|
|
280
|
+
-- ▼ ReadonlyArray.map ▼
|
|
281
|
+
local _newValue = table.create(#elements)
|
|
282
|
+
local _callback = function(element)
|
|
283
|
+
local _arg0 = not admitsNil(node(element))
|
|
284
|
+
assert(_arg0, "nil tuple element")
|
|
285
|
+
return element
|
|
286
|
+
end
|
|
287
|
+
for _k, _v in elements do
|
|
288
|
+
_newValue[_k] = _callback(_v, _k - 1, elements)
|
|
289
|
+
end
|
|
290
|
+
-- ▲ ReadonlyArray.map ▲
|
|
291
|
+
local copy = _newValue
|
|
292
|
+
return descriptor({
|
|
293
|
+
kind = "tuple",
|
|
294
|
+
elements = table.freeze(copy),
|
|
295
|
+
})
|
|
296
|
+
end,
|
|
297
|
+
map = function(key, value)
|
|
298
|
+
node(key)
|
|
299
|
+
local _condition = key.kind == "string" or key.kind == "u8" or key.kind == "u16" or key.kind == "u32"
|
|
300
|
+
if not _condition then
|
|
301
|
+
local _condition_1 = key.kind == "union"
|
|
302
|
+
if _condition_1 then
|
|
303
|
+
local _exp = key.branches
|
|
304
|
+
-- ▼ ReadonlyArray.every ▼
|
|
305
|
+
local _result = true
|
|
306
|
+
local _callback = function(b)
|
|
307
|
+
local _condition_2 = b.kind == "literal"
|
|
308
|
+
if _condition_2 then
|
|
309
|
+
local _value = b.value
|
|
310
|
+
_condition_2 = not (type(_value) == "boolean")
|
|
311
|
+
end
|
|
312
|
+
return _condition_2
|
|
313
|
+
end
|
|
314
|
+
for _k, _v in _exp do
|
|
315
|
+
if not _callback(_v, _k - 1, _exp) then
|
|
316
|
+
_result = false
|
|
317
|
+
break
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
-- ▲ ReadonlyArray.every ▲
|
|
321
|
+
_condition_1 = _result
|
|
322
|
+
end
|
|
323
|
+
_condition = _condition_1
|
|
324
|
+
end
|
|
325
|
+
assert(_condition, "invalid map key")
|
|
326
|
+
local _arg0 = not admitsNil(node(value))
|
|
327
|
+
assert(_arg0, "nil map value")
|
|
328
|
+
return descriptor({
|
|
329
|
+
kind = "map",
|
|
330
|
+
key = key,
|
|
331
|
+
value = value,
|
|
332
|
+
})
|
|
333
|
+
end,
|
|
334
|
+
union = function(branches)
|
|
335
|
+
checkUnion(branches)
|
|
336
|
+
local _object = {
|
|
337
|
+
kind = "union",
|
|
338
|
+
}
|
|
339
|
+
local _left = "branches"
|
|
340
|
+
local _array = {}
|
|
341
|
+
local _length = #_array
|
|
342
|
+
table.move(branches, 1, #branches, _length + 1, _array)
|
|
343
|
+
_object[_left] = table.freeze(_array)
|
|
344
|
+
return descriptor(_object)
|
|
345
|
+
end,
|
|
346
|
+
variant = function(key, value, body)
|
|
347
|
+
literal(value)
|
|
348
|
+
local _key = key
|
|
349
|
+
local _condition = type(_key) == "string"
|
|
350
|
+
if _condition then
|
|
351
|
+
_condition = not numericName(key) and node(body).kind == "object"
|
|
352
|
+
if _condition then
|
|
353
|
+
local _exp = body.fields
|
|
354
|
+
-- ▼ ReadonlyArray.every ▼
|
|
355
|
+
local _result = true
|
|
356
|
+
local _callback = function(_param)
|
|
357
|
+
local name = _param[1]
|
|
358
|
+
return name ~= key
|
|
359
|
+
end
|
|
360
|
+
for _k, _v in _exp do
|
|
361
|
+
if not _callback(_v, _k - 1, _exp) then
|
|
362
|
+
_result = false
|
|
363
|
+
break
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
-- ▲ ReadonlyArray.every ▲
|
|
367
|
+
_condition = _result
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
assert(_condition, "invalid variant")
|
|
371
|
+
return descriptor({
|
|
372
|
+
kind = "variant",
|
|
373
|
+
key = key,
|
|
374
|
+
value = value,
|
|
375
|
+
body = body,
|
|
376
|
+
})
|
|
377
|
+
end,
|
|
378
|
+
})
|
|
379
|
+
return {
|
|
380
|
+
assertDescriptor = assertDescriptor,
|
|
381
|
+
admitsNil = admitsNil,
|
|
382
|
+
runtimeKind = runtimeKind,
|
|
383
|
+
literalLess = literalLess,
|
|
384
|
+
checkUnion = checkUnion,
|
|
385
|
+
n = n,
|
|
386
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|