osury 0.27.0 → 0.28.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/package.json +1 -1
- package/src/CodegenTransforms.res.mjs +33 -1
- package/src/IRGen.res.mjs +30 -27
package/package.json
CHANGED
|
@@ -348,7 +348,39 @@ function topologicalSort(schemas) {
|
|
|
348
348
|
function buildSkipSchemaSet(schemas) {
|
|
349
349
|
let skipSet = {};
|
|
350
350
|
schemas.forEach(s => {
|
|
351
|
-
|
|
351
|
+
let types = s.schema;
|
|
352
|
+
let hasInlineProblem;
|
|
353
|
+
let exit = 0;
|
|
354
|
+
if (typeof types !== "object") {
|
|
355
|
+
exit = 1;
|
|
356
|
+
} else {
|
|
357
|
+
switch (types._tag) {
|
|
358
|
+
case "PolyVariant" :
|
|
359
|
+
hasInlineProblem = types._0.some(c => {
|
|
360
|
+
if (CodegenHelpers.hasUnion(c.payload)) {
|
|
361
|
+
return true;
|
|
362
|
+
} else {
|
|
363
|
+
return CodegenHelpers.hasUnknown(c.payload);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
break;
|
|
367
|
+
case "Union" :
|
|
368
|
+
hasInlineProblem = types._0.some(t => {
|
|
369
|
+
if (CodegenHelpers.hasUnion(t)) {
|
|
370
|
+
return true;
|
|
371
|
+
} else {
|
|
372
|
+
return CodegenHelpers.hasUnknown(t);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
break;
|
|
376
|
+
default:
|
|
377
|
+
exit = 1;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (exit === 1) {
|
|
381
|
+
hasInlineProblem = CodegenHelpers.hasUnion(s.schema) || CodegenHelpers.hasUnknown(s.schema);
|
|
382
|
+
}
|
|
383
|
+
if (hasInlineProblem) {
|
|
352
384
|
skipSet[s.name] = true;
|
|
353
385
|
return;
|
|
354
386
|
}
|
package/src/IRGen.res.mjs
CHANGED
|
@@ -166,16 +166,17 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
|
|
|
166
166
|
payload: payload
|
|
167
167
|
};
|
|
168
168
|
});
|
|
169
|
+
let baseAnnotations = [
|
|
170
|
+
"GenType",
|
|
171
|
+
{
|
|
172
|
+
TAG: "Tag",
|
|
173
|
+
_0: tagName
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
let annotations = shouldSkipSchema ? baseAnnotations : baseAnnotations.concat(["Schema"]);
|
|
169
177
|
return {
|
|
170
178
|
name: typeName,
|
|
171
|
-
annotations:
|
|
172
|
-
"GenType",
|
|
173
|
-
{
|
|
174
|
-
TAG: "Tag",
|
|
175
|
-
_0: tagName
|
|
176
|
-
},
|
|
177
|
-
"Schema"
|
|
178
|
-
],
|
|
179
|
+
annotations: annotations,
|
|
179
180
|
kind: {
|
|
180
181
|
TAG: "VariantDef",
|
|
181
182
|
_0: irCases
|
|
@@ -192,17 +193,18 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
|
|
|
192
193
|
payload: payload
|
|
193
194
|
};
|
|
194
195
|
});
|
|
196
|
+
let baseAnnotations$1 = [
|
|
197
|
+
"GenType",
|
|
198
|
+
{
|
|
199
|
+
TAG: "Tag",
|
|
200
|
+
_0: tagName
|
|
201
|
+
},
|
|
202
|
+
"Unboxed"
|
|
203
|
+
];
|
|
204
|
+
let annotations$1 = shouldSkipSchema ? baseAnnotations$1 : baseAnnotations$1.concat(["Schema"]);
|
|
195
205
|
return {
|
|
196
206
|
name: typeName,
|
|
197
|
-
annotations:
|
|
198
|
-
"GenType",
|
|
199
|
-
{
|
|
200
|
-
TAG: "Tag",
|
|
201
|
-
_0: tagName
|
|
202
|
-
},
|
|
203
|
-
"Unboxed",
|
|
204
|
-
"Schema"
|
|
205
|
-
],
|
|
207
|
+
annotations: annotations$1,
|
|
206
208
|
kind: {
|
|
207
209
|
TAG: "VariantDef",
|
|
208
210
|
_0: irCases$1
|
|
@@ -244,16 +246,17 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
|
|
|
244
246
|
payload: payload$1
|
|
245
247
|
};
|
|
246
248
|
});
|
|
249
|
+
let baseAnnotations$2 = [
|
|
250
|
+
"GenType",
|
|
251
|
+
{
|
|
252
|
+
TAG: "Tag",
|
|
253
|
+
_0: tagName
|
|
254
|
+
}
|
|
255
|
+
];
|
|
256
|
+
let annotations$2 = shouldSkipSchema ? baseAnnotations$2 : baseAnnotations$2.concat(["Schema"]);
|
|
247
257
|
return {
|
|
248
258
|
name: typeName,
|
|
249
|
-
annotations:
|
|
250
|
-
"GenType",
|
|
251
|
-
{
|
|
252
|
-
TAG: "Tag",
|
|
253
|
-
_0: tagName
|
|
254
|
-
},
|
|
255
|
-
"Schema"
|
|
256
|
-
],
|
|
259
|
+
annotations: annotations$2,
|
|
257
260
|
kind: {
|
|
258
261
|
TAG: "VariantDef",
|
|
259
262
|
_0: irCases$2
|
|
@@ -278,13 +281,13 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
|
|
|
278
281
|
_0: convertType(namedSchema.schema)
|
|
279
282
|
});
|
|
280
283
|
}
|
|
281
|
-
let annotations = shouldSkipSchema ? ["GenType"] : [
|
|
284
|
+
let annotations$3 = shouldSkipSchema ? ["GenType"] : [
|
|
282
285
|
"GenType",
|
|
283
286
|
"Schema"
|
|
284
287
|
];
|
|
285
288
|
return {
|
|
286
289
|
name: typeName,
|
|
287
|
-
annotations: annotations,
|
|
290
|
+
annotations: annotations$3,
|
|
288
291
|
kind: kind
|
|
289
292
|
};
|
|
290
293
|
}
|