@danielx/civet 0.7.34 → 0.7.35
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/CHANGELOG.md +9 -0
- package/dist/browser.js +391 -188
- package/dist/config.js +1 -7182
- package/dist/config.mjs +1 -7205
- package/dist/main.js +391 -188
- package/dist/main.mjs +391 -188
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// node_modules
|
|
33
|
+
// node_modules/@danielx/hera/dist/machine.js
|
|
34
34
|
var require_machine = __commonJS({
|
|
35
|
-
"node_modules
|
|
35
|
+
"node_modules/@danielx/hera/dist/machine.js"(exports2, module2) {
|
|
36
36
|
"use strict";
|
|
37
37
|
var __defProp2 = Object.defineProperty;
|
|
38
38
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -564,11 +564,13 @@ __export(lib_exports, {
|
|
|
564
564
|
processProgramAsync: () => processProgramAsync,
|
|
565
565
|
processTryBlock: () => processTryBlock,
|
|
566
566
|
processUnaryExpression: () => processUnaryExpression,
|
|
567
|
+
processUnaryNestedExpression: () => processUnaryNestedExpression,
|
|
567
568
|
quoteString: () => quoteString,
|
|
568
569
|
reorderBindingRestProperty: () => reorderBindingRestProperty,
|
|
569
570
|
replaceNode: () => replaceNode,
|
|
570
571
|
replaceNodes: () => replaceNodes,
|
|
571
572
|
skipImplicitArguments: () => skipImplicitArguments,
|
|
573
|
+
stripTrailingImplicitComma: () => stripTrailingImplicitComma,
|
|
572
574
|
trimFirstSpace: () => trimFirstSpace,
|
|
573
575
|
typeOfJSX: () => typeOfJSX,
|
|
574
576
|
wrapIIFE: () => wrapIIFE
|
|
@@ -705,6 +707,40 @@ function isWhitespaceOrEmpty(node) {
|
|
|
705
707
|
return node.every(isWhitespaceOrEmpty);
|
|
706
708
|
return false;
|
|
707
709
|
}
|
|
710
|
+
function firstNonSpace(node) {
|
|
711
|
+
if (!(node != null)) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (Array.isArray(node)) {
|
|
715
|
+
for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
|
|
716
|
+
const child = node[i2];
|
|
717
|
+
let ref1;
|
|
718
|
+
if (ref1 = firstNonSpace(child)) {
|
|
719
|
+
const first = ref1;
|
|
720
|
+
return first;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return void 0;
|
|
724
|
+
} else if (isParent(node)) {
|
|
725
|
+
let ref2;
|
|
726
|
+
if (ref2 = firstNonSpace(node.children)) {
|
|
727
|
+
const first = ref2;
|
|
728
|
+
return first;
|
|
729
|
+
} else {
|
|
730
|
+
return node;
|
|
731
|
+
}
|
|
732
|
+
} else if (isToken(node)) {
|
|
733
|
+
let m;
|
|
734
|
+
if (m = node.token, typeof m === "string" && /^[ \t]*$/.test(m)) {
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
} else if (typeof node === "string") {
|
|
738
|
+
if (typeof node === "string" && /^[ \t]*$/.test(node)) {
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return node;
|
|
743
|
+
}
|
|
708
744
|
function isExit(node) {
|
|
709
745
|
if (!(node != null)) {
|
|
710
746
|
return false;
|
|
@@ -742,6 +778,14 @@ function isComma(node) {
|
|
|
742
778
|
;
|
|
743
779
|
return;
|
|
744
780
|
}
|
|
781
|
+
function stripTrailingImplicitComma(children) {
|
|
782
|
+
const last = children[children.length - 1];
|
|
783
|
+
if (isComma(last) && last.implicit) {
|
|
784
|
+
return children.slice(0, -1);
|
|
785
|
+
} else {
|
|
786
|
+
return children;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
745
789
|
function insertTrimmingSpace(target, c) {
|
|
746
790
|
if (!(target != null)) {
|
|
747
791
|
return target;
|
|
@@ -914,8 +958,8 @@ function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
|
|
|
914
958
|
return void 0;
|
|
915
959
|
}
|
|
916
960
|
if (Array.isArray(node)) {
|
|
917
|
-
for (let
|
|
918
|
-
const child = node[
|
|
961
|
+
for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
|
|
962
|
+
const child = node[i3];
|
|
919
963
|
if (skip(child)) {
|
|
920
964
|
continue;
|
|
921
965
|
}
|
|
@@ -1002,6 +1046,9 @@ function makeLeftHandSideExpression(expression) {
|
|
|
1002
1046
|
return expression;
|
|
1003
1047
|
}
|
|
1004
1048
|
}
|
|
1049
|
+
return parenthesizeExpression(expression);
|
|
1050
|
+
}
|
|
1051
|
+
function parenthesizeExpression(expression) {
|
|
1005
1052
|
return makeNode({
|
|
1006
1053
|
type: "ParenthesizedExpression",
|
|
1007
1054
|
children: ["(", expression, ")"],
|
|
@@ -1017,8 +1064,8 @@ function updateParentPointers(node, parent, depth = 1) {
|
|
|
1017
1064
|
return;
|
|
1018
1065
|
}
|
|
1019
1066
|
if (Array.isArray(node)) {
|
|
1020
|
-
for (let
|
|
1021
|
-
const child = node[
|
|
1067
|
+
for (let i4 = 0, len4 = node.length; i4 < len4; i4++) {
|
|
1068
|
+
const child = node[i4];
|
|
1022
1069
|
updateParentPointers(child, parent, depth);
|
|
1023
1070
|
}
|
|
1024
1071
|
return;
|
|
@@ -1028,8 +1075,8 @@ function updateParentPointers(node, parent, depth = 1) {
|
|
|
1028
1075
|
node.parent = parent;
|
|
1029
1076
|
}
|
|
1030
1077
|
if (depth && isParent(node)) {
|
|
1031
|
-
for (let
|
|
1032
|
-
const child =
|
|
1078
|
+
for (let ref3 = node.children, i5 = 0, len5 = ref3.length; i5 < len5; i5++) {
|
|
1079
|
+
const child = ref3[i5];
|
|
1033
1080
|
updateParentPointers(child, node, depth - 1);
|
|
1034
1081
|
}
|
|
1035
1082
|
}
|
|
@@ -1159,8 +1206,8 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1159
1206
|
children.splice(1, 0, ".bind(this)");
|
|
1160
1207
|
}
|
|
1161
1208
|
if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
|
|
1162
|
-
let
|
|
1163
|
-
children[children.length - 1] = (
|
|
1209
|
+
let ref4;
|
|
1210
|
+
children[children.length - 1] = (ref4 = parameters.children)[ref4.length - 1] = "(arguments)";
|
|
1164
1211
|
}
|
|
1165
1212
|
}
|
|
1166
1213
|
const exp = makeNode({
|
|
@@ -1183,9 +1230,9 @@ function wrapWithReturn(expression) {
|
|
|
1183
1230
|
}
|
|
1184
1231
|
function flatJoin(array, separator) {
|
|
1185
1232
|
const result = [];
|
|
1186
|
-
for (let
|
|
1187
|
-
const i =
|
|
1188
|
-
const items = array[
|
|
1233
|
+
for (let i6 = 0, len6 = array.length; i6 < len6; i6++) {
|
|
1234
|
+
const i = i6;
|
|
1235
|
+
const items = array[i6];
|
|
1189
1236
|
if (i) {
|
|
1190
1237
|
result.push(separator);
|
|
1191
1238
|
}
|
|
@@ -1584,12 +1631,6 @@ function isVoidType(t) {
|
|
|
1584
1631
|
function isPromiseVoidType(t) {
|
|
1585
1632
|
return t?.type === "TypeIdentifier" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
|
|
1586
1633
|
}
|
|
1587
|
-
function isGeneratorVoidType(t) {
|
|
1588
|
-
return t?.type === "TypeIdentifier" && (t.raw === "Iterator" || t.raw === "Generator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
|
|
1589
|
-
}
|
|
1590
|
-
function isAsyncGeneratorVoidType(t) {
|
|
1591
|
-
return t?.type === "TypeIdentifier" && (t.raw === "AsyncIterator" || t.raw === "AsyncGenerator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
|
|
1592
|
-
}
|
|
1593
1634
|
function implicitFunctionBlock(f) {
|
|
1594
1635
|
if (f.abstract || f.block || f.signature?.optional)
|
|
1595
1636
|
return;
|
|
@@ -1627,7 +1668,7 @@ function processReturn(f, implicitReturns) {
|
|
|
1627
1668
|
const { async, generator, set } = modifier;
|
|
1628
1669
|
const isMethod = f.type === "MethodDefinition";
|
|
1629
1670
|
const isConstructor = isMethod && name === "constructor";
|
|
1630
|
-
const isVoid =
|
|
1671
|
+
const isVoid = generator || isVoidType(returnType2?.t) || async && isPromiseVoidType(returnType2?.t);
|
|
1631
1672
|
if (block?.type === "BlockStatement") {
|
|
1632
1673
|
if (isVoid || set || isConstructor) {
|
|
1633
1674
|
if (block.bare && block.implicitlyReturned) {
|
|
@@ -1643,10 +1684,7 @@ function processReturn(f, implicitReturns) {
|
|
|
1643
1684
|
}
|
|
1644
1685
|
function processReturnValue(func) {
|
|
1645
1686
|
const { block } = func;
|
|
1646
|
-
const values = gatherRecursiveWithinFunction(
|
|
1647
|
-
block,
|
|
1648
|
-
({ type }) => type === "ReturnValue"
|
|
1649
|
-
);
|
|
1687
|
+
const values = gatherRecursiveWithinFunction(block, ($) => $.type === "ReturnValue");
|
|
1650
1688
|
if (!values.length) {
|
|
1651
1689
|
return false;
|
|
1652
1690
|
}
|
|
@@ -1656,7 +1694,7 @@ function processReturnValue(func) {
|
|
|
1656
1694
|
value.children = [ref];
|
|
1657
1695
|
const { ancestor, child } = findAncestor(
|
|
1658
1696
|
value,
|
|
1659
|
-
(
|
|
1697
|
+
($1) => $1.type === "Declaration",
|
|
1660
1698
|
isFunction
|
|
1661
1699
|
);
|
|
1662
1700
|
if (ancestor) {
|
|
@@ -1676,8 +1714,8 @@ function processReturnValue(func) {
|
|
|
1676
1714
|
}
|
|
1677
1715
|
}
|
|
1678
1716
|
if (declaration) {
|
|
1679
|
-
if (!(declaration.
|
|
1680
|
-
declaration.children[1] = declaration.
|
|
1717
|
+
if (!(declaration.typeSuffix != null)) {
|
|
1718
|
+
declaration.children[1] = declaration.typeSuffix = returnType;
|
|
1681
1719
|
}
|
|
1682
1720
|
} else {
|
|
1683
1721
|
block.expressions.unshift([
|
|
@@ -2017,7 +2055,7 @@ function processBreakContinueWith(statement) {
|
|
|
2017
2055
|
let changed = false;
|
|
2018
2056
|
for (const control of gatherRecursiveWithinFunction(
|
|
2019
2057
|
statement.block,
|
|
2020
|
-
($) =>
|
|
2058
|
+
($2) => $2.type === "BreakStatement" || $2.type === "ContinueStatement"
|
|
2021
2059
|
)) {
|
|
2022
2060
|
let controlName2 = function() {
|
|
2023
2061
|
switch (control.type) {
|
|
@@ -2052,7 +2090,7 @@ function processBreakContinueWith(statement) {
|
|
|
2052
2090
|
)
|
|
2053
2091
|
);
|
|
2054
2092
|
updateParentPointers(control.with, control);
|
|
2055
|
-
const i = control.children.findIndex(($
|
|
2093
|
+
const i = control.children.findIndex(($3) => $3?.type === "Error");
|
|
2056
2094
|
if (i >= 0) {
|
|
2057
2095
|
control.children.splice(i, 1);
|
|
2058
2096
|
}
|
|
@@ -2176,8 +2214,8 @@ function processSignature(f) {
|
|
|
2176
2214
|
}
|
|
2177
2215
|
if (hasYield(block) && !f.generator?.length) {
|
|
2178
2216
|
if (f.type === "ArrowFunction") {
|
|
2179
|
-
gatherRecursiveWithinFunction(block, ($
|
|
2180
|
-
const i = y.children.findIndex(($
|
|
2217
|
+
gatherRecursiveWithinFunction(block, ($4) => $4.type === "YieldExpression").forEach((y) => {
|
|
2218
|
+
const i = y.children.findIndex(($5) => $5.type === "Yield");
|
|
2181
2219
|
return y.children.splice(i + 1, 0, {
|
|
2182
2220
|
type: "Error",
|
|
2183
2221
|
message: "Can't use yield inside of => arrow function"
|
|
@@ -2301,12 +2339,13 @@ function processCoffeeDo(ws, expression) {
|
|
|
2301
2339
|
expression = {
|
|
2302
2340
|
...expression,
|
|
2303
2341
|
parameters: newParameters,
|
|
2304
|
-
children: expression.children.map(($
|
|
2342
|
+
children: expression.children.map(($6) => $6 === parameters ? newParameters : $6)
|
|
2305
2343
|
};
|
|
2306
2344
|
}
|
|
2307
2345
|
return {
|
|
2308
2346
|
type: "CallExpression",
|
|
2309
2347
|
children: [
|
|
2348
|
+
ws,
|
|
2310
2349
|
makeLeftHandSideExpression(expression),
|
|
2311
2350
|
{
|
|
2312
2351
|
type: "Call",
|
|
@@ -2322,7 +2361,7 @@ function makeAmpersandFunction(rhs) {
|
|
|
2322
2361
|
ref = makeRef("$");
|
|
2323
2362
|
inplacePrepend(ref, body);
|
|
2324
2363
|
}
|
|
2325
|
-
if (startsWithPredicate(body, ($
|
|
2364
|
+
if (startsWithPredicate(body, ($7) => $7.type === "ObjectExpression")) {
|
|
2326
2365
|
body = makeLeftHandSideExpression(body);
|
|
2327
2366
|
}
|
|
2328
2367
|
const parameters = makeNode({
|
|
@@ -3512,7 +3551,7 @@ function aliasBinding(p, ref) {
|
|
|
3512
3551
|
function len2(arr, length) {
|
|
3513
3552
|
return arr.length === length;
|
|
3514
3553
|
}
|
|
3515
|
-
function processAssignmentDeclaration(decl, pattern,
|
|
3554
|
+
function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e) {
|
|
3516
3555
|
decl = {
|
|
3517
3556
|
...decl,
|
|
3518
3557
|
$loc: {
|
|
@@ -3524,7 +3563,7 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
|
|
|
3524
3563
|
splices = splices.map((s) => [", ", s]);
|
|
3525
3564
|
const thisAssignments = assignments.map((a) => ["", a, ";"]);
|
|
3526
3565
|
if ("typeSuffix" in pattern) {
|
|
3527
|
-
|
|
3566
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
3528
3567
|
}
|
|
3529
3568
|
const initializer = makeNode({
|
|
3530
3569
|
type: "Initializer",
|
|
@@ -3536,9 +3575,9 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
|
|
|
3536
3575
|
pattern,
|
|
3537
3576
|
initializer,
|
|
3538
3577
|
splices,
|
|
3539
|
-
|
|
3578
|
+
typeSuffix,
|
|
3540
3579
|
thisAssignments,
|
|
3541
|
-
children: [pattern,
|
|
3580
|
+
children: [pattern, typeSuffix, initializer]
|
|
3542
3581
|
});
|
|
3543
3582
|
const children = [decl, binding];
|
|
3544
3583
|
return makeNode({
|
|
@@ -3555,9 +3594,9 @@ function processDeclarations(statements) {
|
|
|
3555
3594
|
gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
|
|
3556
3595
|
const { bindings } = statement;
|
|
3557
3596
|
return bindings?.forEach((binding) => {
|
|
3558
|
-
const
|
|
3559
|
-
if (
|
|
3560
|
-
convertOptionalType(
|
|
3597
|
+
const { typeSuffix } = binding;
|
|
3598
|
+
if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
|
|
3599
|
+
convertOptionalType(typeSuffix);
|
|
3561
3600
|
}
|
|
3562
3601
|
const { initializer } = binding;
|
|
3563
3602
|
if (initializer) {
|
|
@@ -3638,8 +3677,8 @@ function processDeclarationCondition(condition, rootCondition, parent) {
|
|
|
3638
3677
|
}
|
|
3639
3678
|
const { decl, bindings } = condition.declaration;
|
|
3640
3679
|
const binding = bindings[0];
|
|
3641
|
-
let { pattern,
|
|
3642
|
-
const nullCheck =
|
|
3680
|
+
let { pattern, typeSuffix, initializer } = binding;
|
|
3681
|
+
const nullCheck = typeSuffix?.optional && !typeSuffix.t && !typeSuffix.nonnull;
|
|
3643
3682
|
if (!(initializer != null)) {
|
|
3644
3683
|
condition.children = [
|
|
3645
3684
|
{
|
|
@@ -3677,14 +3716,14 @@ function processDeclarationCondition(condition, rootCondition, parent) {
|
|
|
3677
3716
|
if (nullCheck) {
|
|
3678
3717
|
children.unshift("(");
|
|
3679
3718
|
children.push(") != null");
|
|
3680
|
-
|
|
3719
|
+
typeSuffix = void 0;
|
|
3681
3720
|
}
|
|
3682
3721
|
Object.assign(condition, {
|
|
3683
3722
|
type: "AssignmentExpression",
|
|
3684
3723
|
children,
|
|
3685
3724
|
hoistDec: !simple ? {
|
|
3686
3725
|
type: "Declaration",
|
|
3687
|
-
children: ["let ", ref,
|
|
3726
|
+
children: ["let ", ref, typeSuffix],
|
|
3688
3727
|
names: []
|
|
3689
3728
|
} : void 0,
|
|
3690
3729
|
pattern,
|
|
@@ -3692,7 +3731,7 @@ function processDeclarationCondition(condition, rootCondition, parent) {
|
|
|
3692
3731
|
});
|
|
3693
3732
|
}
|
|
3694
3733
|
updateParentPointers(condition, parent);
|
|
3695
|
-
rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl,
|
|
3734
|
+
rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, typeSuffix);
|
|
3696
3735
|
}
|
|
3697
3736
|
function processDeclarationConditions(node) {
|
|
3698
3737
|
gatherRecursiveAll(
|
|
@@ -4070,6 +4109,10 @@ function processUnaryExpression(pre, exp, post) {
|
|
|
4070
4109
|
};
|
|
4071
4110
|
pre = pre.slice(0, -1);
|
|
4072
4111
|
} else {
|
|
4112
|
+
let m;
|
|
4113
|
+
if (m = firstNonSpace(exp), typeof m === "string" && /^[ \t]*\n/.test(m) || typeof m === "object" && m != null && "token" in m && typeof m.token === "string" && /^[ \t]*\n/.test(m.token)) {
|
|
4114
|
+
exp = parenthesizeExpression(exp);
|
|
4115
|
+
}
|
|
4073
4116
|
exp = {
|
|
4074
4117
|
type: "AwaitExpression",
|
|
4075
4118
|
children: [...last.children, exp]
|
|
@@ -4085,6 +4128,77 @@ function processUnaryExpression(pre, exp, post) {
|
|
|
4085
4128
|
children: [...pre, exp, post]
|
|
4086
4129
|
};
|
|
4087
4130
|
}
|
|
4131
|
+
function processUnaryNestedExpression(pre, args, post) {
|
|
4132
|
+
const isArray = args.type === "ArrayExpression";
|
|
4133
|
+
if (!isArray) {
|
|
4134
|
+
args = stripTrailingImplicitComma(args);
|
|
4135
|
+
}
|
|
4136
|
+
if (isArray || args.length > 2) {
|
|
4137
|
+
const last = pre[pre.length - 1];
|
|
4138
|
+
if (!(typeof last === "object" && last != null && "type" in last && last.type === "Await")) {
|
|
4139
|
+
return;
|
|
4140
|
+
}
|
|
4141
|
+
if (last.op) {
|
|
4142
|
+
if (!isArray) {
|
|
4143
|
+
args = {
|
|
4144
|
+
type: "ArrayExpression",
|
|
4145
|
+
children: ["[", args, "]"]
|
|
4146
|
+
};
|
|
4147
|
+
}
|
|
4148
|
+
} else {
|
|
4149
|
+
pre.pop();
|
|
4150
|
+
if (!isArray) {
|
|
4151
|
+
args = args;
|
|
4152
|
+
args = {
|
|
4153
|
+
type: "ArrayExpression",
|
|
4154
|
+
children: [
|
|
4155
|
+
"[",
|
|
4156
|
+
...(() => {
|
|
4157
|
+
const results = [];
|
|
4158
|
+
for (let i = 0, len3 = args.length; i < len3; i++) {
|
|
4159
|
+
const arg = args[i];
|
|
4160
|
+
if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "Argument") {
|
|
4161
|
+
const expression = processUnaryExpression([last], arg.expression);
|
|
4162
|
+
results.push({
|
|
4163
|
+
...arg,
|
|
4164
|
+
expression,
|
|
4165
|
+
children: arg.children.map(($) => $ === arg.expression ? expression : $)
|
|
4166
|
+
});
|
|
4167
|
+
} else {
|
|
4168
|
+
results.push(arg);
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
return results;
|
|
4172
|
+
})(),
|
|
4173
|
+
"]"
|
|
4174
|
+
]
|
|
4175
|
+
};
|
|
4176
|
+
} else {
|
|
4177
|
+
args = trimFirstSpace(args);
|
|
4178
|
+
args = {
|
|
4179
|
+
...args,
|
|
4180
|
+
children: args.children.map(
|
|
4181
|
+
(arg) => {
|
|
4182
|
+
if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "ArrayElement" && "expression" in arg && "children" in arg) {
|
|
4183
|
+
const { type, expression: exp, children } = arg;
|
|
4184
|
+
let expression = processUnaryExpression([last], trimFirstSpace(exp));
|
|
4185
|
+
expression = prepend(getTrimmingSpace(exp), expression);
|
|
4186
|
+
return {
|
|
4187
|
+
...arg,
|
|
4188
|
+
expression,
|
|
4189
|
+
children: children.map(($1) => $1 === exp ? expression : $1)
|
|
4190
|
+
};
|
|
4191
|
+
} else {
|
|
4192
|
+
return arg;
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
)
|
|
4196
|
+
};
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
return processUnaryExpression(pre, args, post);
|
|
4201
|
+
}
|
|
4088
4202
|
|
|
4089
4203
|
// source/parser/pipe.civet
|
|
4090
4204
|
function constructInvocation(fn, arg) {
|
|
@@ -4122,36 +4236,31 @@ function constructInvocation(fn, arg) {
|
|
|
4122
4236
|
};
|
|
4123
4237
|
}
|
|
4124
4238
|
function constructPipeStep(fn, arg, returning) {
|
|
4239
|
+
if (!returning) {
|
|
4240
|
+
returning = null;
|
|
4241
|
+
}
|
|
4125
4242
|
let children = [[fn.leadingComment, fn.expr, fn.trailingComment].map(skipIfOnlyWS), " ", arg];
|
|
4126
4243
|
switch (fn.expr.token) {
|
|
4127
|
-
case "
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
}
|
|
4132
|
-
if (returning) {
|
|
4133
|
-
return [
|
|
4134
|
-
children,
|
|
4135
|
-
returning
|
|
4136
|
-
];
|
|
4137
|
-
}
|
|
4244
|
+
case "await": {
|
|
4245
|
+
children = processUnaryExpression([fn.expr], arg, void 0);
|
|
4246
|
+
}
|
|
4247
|
+
case "yield": {
|
|
4138
4248
|
return [
|
|
4139
4249
|
children,
|
|
4140
|
-
|
|
4250
|
+
returning
|
|
4141
4251
|
];
|
|
4142
|
-
|
|
4252
|
+
}
|
|
4253
|
+
case "return": {
|
|
4143
4254
|
return [{
|
|
4144
4255
|
type: "ReturnStatement",
|
|
4145
4256
|
children
|
|
4146
4257
|
}, null];
|
|
4258
|
+
}
|
|
4147
4259
|
}
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
];
|
|
4153
|
-
}
|
|
4154
|
-
return [constructInvocation(fn, arg), null];
|
|
4260
|
+
return [
|
|
4261
|
+
constructInvocation(fn, arg),
|
|
4262
|
+
returning
|
|
4263
|
+
];
|
|
4155
4264
|
}
|
|
4156
4265
|
function processPipelineExpressions(statements) {
|
|
4157
4266
|
gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
|
|
@@ -4408,7 +4517,29 @@ function processForInOf($0, getRef) {
|
|
|
4408
4517
|
message: "'own' is only meaningful in for..in loops"
|
|
4409
4518
|
};
|
|
4410
4519
|
}
|
|
4411
|
-
|
|
4520
|
+
const { binding } = declaration;
|
|
4521
|
+
let pattern = binding?.pattern;
|
|
4522
|
+
if (binding?.typeSuffix || inOf.token === "in" && declaration2 && pattern.type !== "Identifier") {
|
|
4523
|
+
const itemRef = makeRef(inOf.token === "in" ? "key" : "item");
|
|
4524
|
+
blockPrefix.push(["", {
|
|
4525
|
+
type: "Declaration",
|
|
4526
|
+
children: [declaration, " = ", itemRef],
|
|
4527
|
+
names: declaration.names
|
|
4528
|
+
}, ";"]);
|
|
4529
|
+
pattern = itemRef;
|
|
4530
|
+
declaration = {
|
|
4531
|
+
type: "ForDeclaration",
|
|
4532
|
+
binding: {
|
|
4533
|
+
type: "Binding",
|
|
4534
|
+
pattern,
|
|
4535
|
+
children: [pattern],
|
|
4536
|
+
names: []
|
|
4537
|
+
},
|
|
4538
|
+
children: ["const ", itemRef],
|
|
4539
|
+
names: []
|
|
4540
|
+
};
|
|
4541
|
+
}
|
|
4542
|
+
if (!(declaration2 || own)) {
|
|
4412
4543
|
return {
|
|
4413
4544
|
declaration,
|
|
4414
4545
|
blockPrefix,
|
|
@@ -4447,29 +4578,6 @@ function processForInOf($0, getRef) {
|
|
|
4447
4578
|
children: [" ", expRef2, " =", exp]
|
|
4448
4579
|
};
|
|
4449
4580
|
}
|
|
4450
|
-
const { binding } = declaration;
|
|
4451
|
-
let { pattern } = binding;
|
|
4452
|
-
if (!(pattern.type === "Identifier")) {
|
|
4453
|
-
const keyRef = makeRef("key");
|
|
4454
|
-
blockPrefix.push(["", [
|
|
4455
|
-
declaration,
|
|
4456
|
-
" = ",
|
|
4457
|
-
keyRef
|
|
4458
|
-
], ";"]);
|
|
4459
|
-
pattern = keyRef;
|
|
4460
|
-
declaration = {
|
|
4461
|
-
type: "ForDeclaration",
|
|
4462
|
-
binding: {
|
|
4463
|
-
type: "Binding",
|
|
4464
|
-
pattern,
|
|
4465
|
-
children: [pattern],
|
|
4466
|
-
names: [],
|
|
4467
|
-
suffix: binding.suffix
|
|
4468
|
-
},
|
|
4469
|
-
children: ["const ", keyRef],
|
|
4470
|
-
names: []
|
|
4471
|
-
};
|
|
4472
|
-
}
|
|
4473
4581
|
if (own) {
|
|
4474
4582
|
const hasPropRef = getRef("hasProp");
|
|
4475
4583
|
blockPrefix.push(["", ["if (!", hasPropRef, "(", insertTrimmingSpace(expRef2, ""), ", ", insertTrimmingSpace(pattern, ""), ")) continue"], ";"]);
|
|
@@ -6151,44 +6259,82 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
6151
6259
|
}
|
|
6152
6260
|
function processTypes(node) {
|
|
6153
6261
|
return gatherRecursiveAll(node, (n) => n.type === "TypeUnary").forEach((unary) => {
|
|
6154
|
-
|
|
6155
|
-
let count = 0;
|
|
6156
|
-
let ref10;
|
|
6157
|
-
while (unary.suffix.length && (ref10 = unary.suffix)[ref10.length - 1]?.token === "?") {
|
|
6158
|
-
last = unary.suffix.pop();
|
|
6159
|
-
count++;
|
|
6160
|
-
}
|
|
6161
|
-
if (!count) {
|
|
6262
|
+
if (!unary.suffix.length) {
|
|
6162
6263
|
return;
|
|
6163
6264
|
}
|
|
6164
|
-
let
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
unary.suffix.
|
|
6173
|
-
|
|
6265
|
+
let ref10;
|
|
6266
|
+
let m3;
|
|
6267
|
+
if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
|
|
6268
|
+
const { token } = m3;
|
|
6269
|
+
let last;
|
|
6270
|
+
let count = 0;
|
|
6271
|
+
let ref11;
|
|
6272
|
+
while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
|
|
6273
|
+
last = unary.suffix.pop();
|
|
6274
|
+
count++;
|
|
6174
6275
|
}
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6276
|
+
let ref12;
|
|
6277
|
+
while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
|
|
6278
|
+
unary.suffix.pop();
|
|
6279
|
+
}
|
|
6280
|
+
let ref13;
|
|
6281
|
+
if (unary.suffix.length || unary.prefix.length)
|
|
6282
|
+
ref13 = unary;
|
|
6283
|
+
else
|
|
6284
|
+
ref13 = unary.t;
|
|
6285
|
+
const t = ref13;
|
|
6286
|
+
if (unary.parent?.type === "TypeTuple") {
|
|
6287
|
+
if (count === 1) {
|
|
6288
|
+
unary.suffix.push(last);
|
|
6289
|
+
return;
|
|
6290
|
+
}
|
|
6291
|
+
replaceNode(unary, [
|
|
6187
6292
|
getTrimmingSpace(unary),
|
|
6188
6293
|
"(",
|
|
6189
6294
|
parenthesizeType(trimFirstSpace(t)),
|
|
6190
|
-
|
|
6191
|
-
|
|
6295
|
+
" | null)",
|
|
6296
|
+
last
|
|
6297
|
+
]);
|
|
6298
|
+
} else {
|
|
6299
|
+
replaceNode(unary, {
|
|
6300
|
+
type: "TypeParenthesized",
|
|
6301
|
+
ts: true,
|
|
6302
|
+
children: [
|
|
6303
|
+
getTrimmingSpace(unary),
|
|
6304
|
+
"(",
|
|
6305
|
+
parenthesizeType(trimFirstSpace(t)),
|
|
6306
|
+
count === 1 ? " | undefined" : " | undefined | null",
|
|
6307
|
+
")"
|
|
6308
|
+
]
|
|
6309
|
+
});
|
|
6310
|
+
}
|
|
6311
|
+
} else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
|
|
6312
|
+
const { type } = m3;
|
|
6313
|
+
let ref14;
|
|
6314
|
+
while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
|
|
6315
|
+
unary.suffix.pop();
|
|
6316
|
+
}
|
|
6317
|
+
let ref15;
|
|
6318
|
+
while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
|
|
6319
|
+
unary.suffix.pop();
|
|
6320
|
+
}
|
|
6321
|
+
const t = trimFirstSpace(
|
|
6322
|
+
unary.suffix.length || unary.prefix.length ? unary : unary.t
|
|
6323
|
+
);
|
|
6324
|
+
const args = {
|
|
6325
|
+
type: "TypeArguments",
|
|
6326
|
+
ts: true,
|
|
6327
|
+
types: [t],
|
|
6328
|
+
children: ["<", t, ">"]
|
|
6329
|
+
};
|
|
6330
|
+
replaceNode(unary, {
|
|
6331
|
+
type: "TypeIdentifier",
|
|
6332
|
+
raw: "NonNullable",
|
|
6333
|
+
args,
|
|
6334
|
+
children: [
|
|
6335
|
+
getTrimmingSpace(unary),
|
|
6336
|
+
"NonNullable",
|
|
6337
|
+
args
|
|
6192
6338
|
]
|
|
6193
6339
|
});
|
|
6194
6340
|
}
|
|
@@ -6198,11 +6344,11 @@ function processStatementExpressions(statements) {
|
|
|
6198
6344
|
gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
|
|
6199
6345
|
const exp = _exp;
|
|
6200
6346
|
const { statement } = exp;
|
|
6201
|
-
let
|
|
6347
|
+
let ref16;
|
|
6202
6348
|
switch (statement.type) {
|
|
6203
6349
|
case "IfStatement": {
|
|
6204
|
-
if (
|
|
6205
|
-
const expression =
|
|
6350
|
+
if (ref16 = expressionizeIfStatement(statement)) {
|
|
6351
|
+
const expression = ref16;
|
|
6206
6352
|
return replaceNode(statement, expression, exp);
|
|
6207
6353
|
} else {
|
|
6208
6354
|
return replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -6348,10 +6494,10 @@ function processPlaceholders(statements) {
|
|
|
6348
6494
|
if (type === "IfStatement") {
|
|
6349
6495
|
liftedIfs.add(ancestor2);
|
|
6350
6496
|
}
|
|
6351
|
-
let m3;
|
|
6352
6497
|
let m4;
|
|
6498
|
+
let m5;
|
|
6353
6499
|
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
6354
|
-
type === "BlockStatement" && !((
|
|
6500
|
+
type === "BlockStatement" && !((m4 = ancestor2.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m5 = ancestor2.parent, typeof m5 === "object" && m5 != null && "type" in m5 && m5.type === "ElseClause" && "parent" in m5 && typeof m5.parent === "object" && m5.parent != null && "type" in m5.parent && m5.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
|
|
6355
6501
|
type === "Initializer" || // Right-hand side of assignment
|
|
6356
6502
|
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
6357
6503
|
}));
|
|
@@ -6430,8 +6576,8 @@ function processPlaceholders(statements) {
|
|
|
6430
6576
|
for (let i4 = 0, len3 = placeholders.length; i4 < len3; i4++) {
|
|
6431
6577
|
const placeholder = placeholders[i4];
|
|
6432
6578
|
typeSuffix ??= placeholder.typeSuffix;
|
|
6433
|
-
let
|
|
6434
|
-
replaceNode((
|
|
6579
|
+
let ref17;
|
|
6580
|
+
replaceNode((ref17 = placeholder.children)[ref17.length - 1], ref);
|
|
6435
6581
|
}
|
|
6436
6582
|
const { parent } = ancestor;
|
|
6437
6583
|
const body = maybeUnwrap(ancestor);
|
|
@@ -6448,16 +6594,16 @@ function processPlaceholders(statements) {
|
|
|
6448
6594
|
}
|
|
6449
6595
|
case "PipelineExpression": {
|
|
6450
6596
|
const i = findChildIndex(parent, ancestor);
|
|
6451
|
-
let
|
|
6597
|
+
let ref18;
|
|
6452
6598
|
if (i === 1) {
|
|
6453
|
-
|
|
6599
|
+
ref18 = ancestor === parent.children[i];
|
|
6454
6600
|
} else if (i === 2) {
|
|
6455
|
-
|
|
6601
|
+
ref18 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
6456
6602
|
} else {
|
|
6457
|
-
|
|
6603
|
+
ref18 = void 0;
|
|
6458
6604
|
}
|
|
6459
6605
|
;
|
|
6460
|
-
outer =
|
|
6606
|
+
outer = ref18;
|
|
6461
6607
|
break;
|
|
6462
6608
|
}
|
|
6463
6609
|
case "AssignmentExpression":
|
|
@@ -6472,9 +6618,9 @@ function processPlaceholders(statements) {
|
|
|
6472
6618
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
6473
6619
|
}
|
|
6474
6620
|
replaceNode(ancestor, fnExp, parent);
|
|
6475
|
-
let
|
|
6476
|
-
if (
|
|
6477
|
-
const ws =
|
|
6621
|
+
let ref19;
|
|
6622
|
+
if (ref19 = getTrimmingSpace(body)) {
|
|
6623
|
+
const ws = ref19;
|
|
6478
6624
|
inplaceInsertTrimmingSpace(body, "");
|
|
6479
6625
|
inplacePrepend(ws, fnExp);
|
|
6480
6626
|
}
|
|
@@ -6519,8 +6665,8 @@ function reorderBindingRestProperty(props) {
|
|
|
6519
6665
|
}
|
|
6520
6666
|
];
|
|
6521
6667
|
}
|
|
6522
|
-
let
|
|
6523
|
-
if (Array.isArray(rest.delim) && (
|
|
6668
|
+
let ref20;
|
|
6669
|
+
if (Array.isArray(rest.delim) && (ref20 = rest.delim)[ref20.length - 1]?.token === ",") {
|
|
6524
6670
|
rest.delim = rest.delim.slice(0, -1);
|
|
6525
6671
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
6526
6672
|
}
|
|
@@ -6685,6 +6831,7 @@ var grammar = {
|
|
|
6685
6831
|
NestedArgumentList,
|
|
6686
6832
|
NestedArgument,
|
|
6687
6833
|
SingleLineArgumentExpressions,
|
|
6834
|
+
WArgumentPart,
|
|
6688
6835
|
ArgumentPart,
|
|
6689
6836
|
NonPipelineArgumentPart,
|
|
6690
6837
|
BinaryOpExpression,
|
|
@@ -6696,6 +6843,8 @@ var grammar = {
|
|
|
6696
6843
|
UnaryExpression,
|
|
6697
6844
|
UnaryWithoutParenthesizedAssignment,
|
|
6698
6845
|
UnaryBody,
|
|
6846
|
+
MaybeNestedCoffeeDoBody,
|
|
6847
|
+
CoffeeDoBody,
|
|
6699
6848
|
UnaryWithoutParenthesizedAssignmentBody,
|
|
6700
6849
|
ParenthesizedAssignment,
|
|
6701
6850
|
UnaryPostfix,
|
|
@@ -7028,6 +7177,7 @@ var grammar = {
|
|
|
7028
7177
|
MaybeNestedNonPipelineExtendedExpression,
|
|
7029
7178
|
MaybeNestedPostfixedExpression,
|
|
7030
7179
|
MaybeNestedExtendedExpression,
|
|
7180
|
+
NestedExtendedExpression,
|
|
7031
7181
|
MaybeParenNestedExtendedExpression,
|
|
7032
7182
|
ImportDeclaration,
|
|
7033
7183
|
ImpliedImport,
|
|
@@ -7969,9 +8119,7 @@ var ImplicitArguments$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ApplicationSt
|
|
|
7969
8119
|
var close = $5;
|
|
7970
8120
|
if (skipImplicitArguments(args))
|
|
7971
8121
|
return $skip;
|
|
7972
|
-
|
|
7973
|
-
if (last?.token === "," && last.implicit)
|
|
7974
|
-
args = args.slice(0, -1);
|
|
8122
|
+
args = stripTrailingImplicitComma(args);
|
|
7975
8123
|
return {
|
|
7976
8124
|
type: "Call",
|
|
7977
8125
|
args,
|
|
@@ -8149,24 +8297,43 @@ var NestedArgument$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, SingleLi
|
|
|
8149
8297
|
var args = $2;
|
|
8150
8298
|
var comma = $3;
|
|
8151
8299
|
let [arg0, ...rest] = args;
|
|
8152
|
-
arg0 =
|
|
8300
|
+
arg0 = prepend(indent, arg0);
|
|
8153
8301
|
return [arg0, ...rest, comma];
|
|
8154
8302
|
});
|
|
8155
8303
|
function NestedArgument(ctx, state2) {
|
|
8156
8304
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedArgument", NestedArgument$0);
|
|
8157
8305
|
}
|
|
8158
|
-
var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(
|
|
8306
|
+
var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(WArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), Comma), WArgumentPart))), function($skip, $loc, $0, $1, $2) {
|
|
8159
8307
|
return [$1, ...$2.flat()];
|
|
8160
8308
|
});
|
|
8161
8309
|
function SingleLineArgumentExpressions(ctx, state2) {
|
|
8162
8310
|
return (0, import_lib3.$EVENT)(ctx, state2, "SingleLineArgumentExpressions", SingleLineArgumentExpressions$0);
|
|
8163
8311
|
}
|
|
8164
|
-
var
|
|
8312
|
+
var WArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), function($skip, $loc, $0, $1, $2) {
|
|
8313
|
+
return prepend($1, $2);
|
|
8314
|
+
});
|
|
8315
|
+
function WArgumentPart(ctx, state2) {
|
|
8316
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
|
|
8317
|
+
}
|
|
8318
|
+
var ArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
|
|
8319
|
+
var spread = $1;
|
|
8320
|
+
var expression = $2;
|
|
8321
|
+
return {
|
|
8322
|
+
type: "Argument",
|
|
8323
|
+
children: $0,
|
|
8324
|
+
expression,
|
|
8325
|
+
spread
|
|
8326
|
+
};
|
|
8327
|
+
});
|
|
8165
8328
|
var ArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(ExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8329
|
+
var expression = $1;
|
|
8330
|
+
var spread = $2;
|
|
8331
|
+
return {
|
|
8332
|
+
type: "Argument",
|
|
8333
|
+
children: spread ? [spread, expression] : [expression],
|
|
8334
|
+
expression,
|
|
8335
|
+
spread
|
|
8336
|
+
};
|
|
8170
8337
|
});
|
|
8171
8338
|
var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
|
|
8172
8339
|
function ArgumentPart(ctx, state2) {
|
|
@@ -8254,17 +8421,18 @@ var RHS$$ = [RHS$0, RHS$1];
|
|
|
8254
8421
|
function RHS(ctx, state2) {
|
|
8255
8422
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "RHS", RHS$$);
|
|
8256
8423
|
}
|
|
8257
|
-
var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
|
|
8424
|
+
var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$P)(UnaryOp), (0, import_lib3.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8425
|
+
var pre = $2;
|
|
8426
|
+
var args = $3;
|
|
8427
|
+
var post = $4;
|
|
8428
|
+
return processUnaryNestedExpression(pre, args, post) ?? $skip;
|
|
8429
|
+
});
|
|
8430
|
+
var UnaryExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(UnaryOp), UnaryBody, (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8258
8431
|
var pre = $1;
|
|
8259
8432
|
var exp = $2;
|
|
8260
8433
|
var post = $3;
|
|
8261
8434
|
return processUnaryExpression(pre, exp, post);
|
|
8262
8435
|
});
|
|
8263
|
-
var UnaryExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, __, (0, import_lib3.$C)(ArrowFunction, (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol))), ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8264
|
-
var ws = $3;
|
|
8265
|
-
var exp = $4;
|
|
8266
|
-
return processCoffeeDo(ws, exp);
|
|
8267
|
-
});
|
|
8268
8436
|
var UnaryExpression$$ = [UnaryExpression$0, UnaryExpression$1];
|
|
8269
8437
|
function UnaryExpression(ctx, state2) {
|
|
8270
8438
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryExpression", UnaryExpression$$);
|
|
@@ -8278,14 +8446,35 @@ var UnaryWithoutParenthesizedAssignment$0 = (0, import_lib3.$TS)((0, import_lib3
|
|
|
8278
8446
|
function UnaryWithoutParenthesizedAssignment(ctx, state2) {
|
|
8279
8447
|
return (0, import_lib3.$EVENT)(ctx, state2, "UnaryWithoutParenthesizedAssignment", UnaryWithoutParenthesizedAssignment$0);
|
|
8280
8448
|
}
|
|
8281
|
-
var UnaryBody$0 =
|
|
8282
|
-
var
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
var UnaryBody
|
|
8449
|
+
var UnaryBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, MaybeNestedCoffeeDoBody), function($skip, $loc, $0, $1, $2, $3) {
|
|
8450
|
+
var body = $3;
|
|
8451
|
+
return processCoffeeDo(...body);
|
|
8452
|
+
});
|
|
8453
|
+
var UnaryBody$1 = ParenthesizedAssignment;
|
|
8454
|
+
var UnaryBody$2 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
8455
|
+
var UnaryBody$3 = UpdateExpression;
|
|
8456
|
+
var UnaryBody$4 = NestedNonAssignmentExtendedExpression;
|
|
8457
|
+
var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3, UnaryBody$4];
|
|
8286
8458
|
function UnaryBody(ctx, state2) {
|
|
8287
8459
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
|
|
8288
8460
|
}
|
|
8461
|
+
var MaybeNestedCoffeeDoBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, CoffeeDoBody)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
8462
|
+
if (!$2)
|
|
8463
|
+
return $skip;
|
|
8464
|
+
return $2;
|
|
8465
|
+
});
|
|
8466
|
+
var MaybeNestedCoffeeDoBody$1 = (0, import_lib3.$S)((0, import_lib3.$E)(_), CoffeeDoBody);
|
|
8467
|
+
var MaybeNestedCoffeeDoBody$$ = [MaybeNestedCoffeeDoBody$0, MaybeNestedCoffeeDoBody$1];
|
|
8468
|
+
function MaybeNestedCoffeeDoBody(ctx, state2) {
|
|
8469
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedCoffeeDoBody", MaybeNestedCoffeeDoBody$$);
|
|
8470
|
+
}
|
|
8471
|
+
var CoffeeDoBody$0 = ArrowFunction;
|
|
8472
|
+
var CoffeeDoBody$1 = (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol)));
|
|
8473
|
+
var CoffeeDoBody$2 = ExtendedExpression;
|
|
8474
|
+
var CoffeeDoBody$$ = [CoffeeDoBody$0, CoffeeDoBody$1, CoffeeDoBody$2];
|
|
8475
|
+
function CoffeeDoBody(ctx, state2) {
|
|
8476
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeDoBody", CoffeeDoBody$$);
|
|
8477
|
+
}
|
|
8289
8478
|
var UnaryWithoutParenthesizedAssignmentBody$0 = UpdateExpression;
|
|
8290
8479
|
var UnaryWithoutParenthesizedAssignmentBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
8291
8480
|
var UnaryWithoutParenthesizedAssignmentBody$2 = NestedNonAssignmentExtendedExpression;
|
|
@@ -8484,7 +8673,7 @@ var ArrowFunction$0 = ThinArrowFunction;
|
|
|
8484
8673
|
var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Async, _)), ArrowParameters, (0, import_lib3.$E)(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8485
8674
|
var async = $1;
|
|
8486
8675
|
var parameters = $2;
|
|
8487
|
-
var
|
|
8676
|
+
var returnType = $3;
|
|
8488
8677
|
var arrow = $4;
|
|
8489
8678
|
var expOrBlock = $5;
|
|
8490
8679
|
if (!async)
|
|
@@ -8495,13 +8684,13 @@ var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
|
|
|
8495
8684
|
modifier: {
|
|
8496
8685
|
async: !!async.length
|
|
8497
8686
|
},
|
|
8498
|
-
returnType
|
|
8687
|
+
returnType
|
|
8499
8688
|
},
|
|
8500
8689
|
parameters,
|
|
8501
|
-
returnType
|
|
8690
|
+
returnType,
|
|
8502
8691
|
async,
|
|
8503
8692
|
block: expOrBlock,
|
|
8504
|
-
children: [async, parameters,
|
|
8693
|
+
children: [async, parameters, returnType, arrow, expOrBlock]
|
|
8505
8694
|
};
|
|
8506
8695
|
});
|
|
8507
8696
|
var ArrowFunction$$ = [ArrowFunction$0, ArrowFunction$1];
|
|
@@ -10233,7 +10422,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10233
10422
|
var wid = $4;
|
|
10234
10423
|
var w = $5;
|
|
10235
10424
|
var parameters = $6;
|
|
10236
|
-
var
|
|
10425
|
+
var returnType = $7;
|
|
10237
10426
|
if (!async)
|
|
10238
10427
|
async = [];
|
|
10239
10428
|
if (!generator)
|
|
@@ -10244,7 +10433,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10244
10433
|
id,
|
|
10245
10434
|
name: id?.name,
|
|
10246
10435
|
parameters,
|
|
10247
|
-
returnType
|
|
10436
|
+
returnType,
|
|
10248
10437
|
async,
|
|
10249
10438
|
generator,
|
|
10250
10439
|
modifier: {
|
|
@@ -10252,7 +10441,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10252
10441
|
generator: !!generator.length
|
|
10253
10442
|
},
|
|
10254
10443
|
block: null,
|
|
10255
|
-
children: !parameters.implicit ? [async, func, generator, wid, w, parameters,
|
|
10444
|
+
children: !parameters.implicit ? [async, func, generator, wid, w, parameters, returnType] : [async, func, generator, wid, parameters, w, returnType]
|
|
10256
10445
|
// move whitespace w to after implicit () in parameters
|
|
10257
10446
|
};
|
|
10258
10447
|
});
|
|
@@ -10451,7 +10640,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10451
10640
|
var behavior = $7;
|
|
10452
10641
|
var w2 = $8;
|
|
10453
10642
|
var parameters = $9;
|
|
10454
|
-
var
|
|
10643
|
+
var returnType = $10;
|
|
10455
10644
|
if (!async)
|
|
10456
10645
|
async = [];
|
|
10457
10646
|
if (!generator)
|
|
@@ -10466,7 +10655,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10466
10655
|
id,
|
|
10467
10656
|
name: id.name,
|
|
10468
10657
|
parameters,
|
|
10469
|
-
returnType
|
|
10658
|
+
returnType,
|
|
10470
10659
|
async,
|
|
10471
10660
|
generator,
|
|
10472
10661
|
modifier: {
|
|
@@ -10474,7 +10663,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10474
10663
|
generator: !!generator.length
|
|
10475
10664
|
},
|
|
10476
10665
|
block: null,
|
|
10477
|
-
children: [async, func, generator, w1, id, w2, parameters,
|
|
10666
|
+
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
10478
10667
|
behavior
|
|
10479
10668
|
};
|
|
10480
10669
|
});
|
|
@@ -10521,7 +10710,7 @@ function OperatorAssociativity(ctx, state2) {
|
|
|
10521
10710
|
var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Async, _)), ArrowParameters, (0, import_lib3.$E)(ReturnTypeSuffix), (0, import_lib3.$E)(_), Arrow, NoCommaBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
10522
10711
|
var async = $1;
|
|
10523
10712
|
var parameters = $2;
|
|
10524
|
-
var
|
|
10713
|
+
var returnType = $3;
|
|
10525
10714
|
var arrow = $5;
|
|
10526
10715
|
var block = $6;
|
|
10527
10716
|
if (!async)
|
|
@@ -10531,7 +10720,7 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10531
10720
|
type: "FunctionExpression",
|
|
10532
10721
|
id: void 0,
|
|
10533
10722
|
parameters,
|
|
10534
|
-
returnType
|
|
10723
|
+
returnType,
|
|
10535
10724
|
async,
|
|
10536
10725
|
generator,
|
|
10537
10726
|
block,
|
|
@@ -10543,14 +10732,14 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10543
10732
|
async: !!async.length,
|
|
10544
10733
|
generator: !!generator.length
|
|
10545
10734
|
},
|
|
10546
|
-
returnType
|
|
10735
|
+
returnType
|
|
10547
10736
|
},
|
|
10548
10737
|
children: [
|
|
10549
10738
|
async,
|
|
10550
10739
|
{ $loc: arrow.$loc, token: "function" },
|
|
10551
10740
|
generator,
|
|
10552
10741
|
parameters,
|
|
10553
|
-
|
|
10742
|
+
returnType,
|
|
10554
10743
|
block
|
|
10555
10744
|
]
|
|
10556
10745
|
};
|
|
@@ -11247,6 +11436,7 @@ var ArrayElementExpression$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Extended
|
|
|
11247
11436
|
return {
|
|
11248
11437
|
type: "SpreadElement",
|
|
11249
11438
|
children: [ws, dots, exp],
|
|
11439
|
+
expression: exp,
|
|
11250
11440
|
names: exp.names
|
|
11251
11441
|
};
|
|
11252
11442
|
});
|
|
@@ -11258,12 +11448,14 @@ var ArrayElementExpression$3 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, impo
|
|
|
11258
11448
|
return {
|
|
11259
11449
|
type: "ArrayElement",
|
|
11260
11450
|
children: [exp],
|
|
11451
|
+
expression: exp,
|
|
11261
11452
|
names: exp.names
|
|
11262
11453
|
};
|
|
11263
11454
|
} else {
|
|
11264
11455
|
return {
|
|
11265
11456
|
type: "SpreadElement",
|
|
11266
11457
|
children: [...spread, exp],
|
|
11458
|
+
expression: exp,
|
|
11267
11459
|
names: exp.names
|
|
11268
11460
|
};
|
|
11269
11461
|
}
|
|
@@ -11307,9 +11499,9 @@ var BulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBracket
|
|
|
11307
11499
|
// replace first space with bracket
|
|
11308
11500
|
...content[1].flat()
|
|
11309
11501
|
];
|
|
11310
|
-
|
|
11502
|
+
let last = content[content.length - 1];
|
|
11311
11503
|
if (last.children?.at(-1)?.implicit) {
|
|
11312
|
-
|
|
11504
|
+
content[content.length - 1] = last = { ...last, children: last.children.slice(0, -1) };
|
|
11313
11505
|
}
|
|
11314
11506
|
return {
|
|
11315
11507
|
type: "ArrayExpression",
|
|
@@ -13199,14 +13391,14 @@ function ForDeclaration(ctx, state2) {
|
|
|
13199
13391
|
}
|
|
13200
13392
|
var ForBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(BindingPattern, BindingIdentifier), (0, import_lib3.$E)(TypeSuffix)), function($skip, $loc, $0, $1, $2) {
|
|
13201
13393
|
var pattern = $1;
|
|
13202
|
-
var
|
|
13203
|
-
|
|
13394
|
+
var typeSuffix = $2;
|
|
13395
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
13204
13396
|
return {
|
|
13205
13397
|
type: "Binding",
|
|
13206
|
-
children: [pattern,
|
|
13398
|
+
children: [pattern, typeSuffix],
|
|
13207
13399
|
names: pattern.names,
|
|
13208
13400
|
pattern,
|
|
13209
|
-
|
|
13401
|
+
typeSuffix,
|
|
13210
13402
|
splices: [],
|
|
13211
13403
|
thisAssignments: []
|
|
13212
13404
|
};
|
|
@@ -13843,6 +14035,16 @@ var MaybeNestedExtendedExpression$$ = [MaybeNestedExtendedExpression$0, MaybeNes
|
|
|
13843
14035
|
function MaybeNestedExtendedExpression(ctx, state2) {
|
|
13844
14036
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedExtendedExpression", MaybeNestedExtendedExpression$$);
|
|
13845
14037
|
}
|
|
14038
|
+
var NestedExtendedExpression$0 = NestedBulletedArray;
|
|
14039
|
+
var NestedExtendedExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, ExtendedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
14040
|
+
if ($3)
|
|
14041
|
+
return $3;
|
|
14042
|
+
return $skip;
|
|
14043
|
+
});
|
|
14044
|
+
var NestedExtendedExpression$$ = [NestedExtendedExpression$0, NestedExtendedExpression$1];
|
|
14045
|
+
function NestedExtendedExpression(ctx, state2) {
|
|
14046
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedExtendedExpression", NestedExtendedExpression$$);
|
|
14047
|
+
}
|
|
13846
14048
|
var MaybeParenNestedExtendedExpression$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ExtendedExpression), function(value) {
|
|
13847
14049
|
return value[1];
|
|
13848
14050
|
});
|
|
@@ -14337,16 +14539,16 @@ function TypeAssignment(ctx, state2) {
|
|
|
14337
14539
|
}
|
|
14338
14540
|
var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern, (0, import_lib3.$E)(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
|
|
14339
14541
|
var pattern = $1;
|
|
14340
|
-
var
|
|
14542
|
+
var typeSuffix = $2;
|
|
14341
14543
|
var initializer = $3;
|
|
14342
14544
|
const [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
14343
|
-
|
|
14545
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
14344
14546
|
return {
|
|
14345
14547
|
type: "Binding",
|
|
14346
|
-
children: [pattern,
|
|
14548
|
+
children: [pattern, typeSuffix, initializer],
|
|
14347
14549
|
names: pattern.names,
|
|
14348
14550
|
pattern,
|
|
14349
|
-
|
|
14551
|
+
typeSuffix,
|
|
14350
14552
|
initializer,
|
|
14351
14553
|
splices: splices.map((s) => [",", s]),
|
|
14352
14554
|
thisAssignments: thisAssignments.map((s) => ["", s, ";"])
|
|
@@ -14354,14 +14556,14 @@ var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern,
|
|
|
14354
14556
|
});
|
|
14355
14557
|
var LexicalBinding$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingIdentifier, (0, import_lib3.$E)(TypeSuffix), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
|
|
14356
14558
|
var pattern = $1;
|
|
14357
|
-
var
|
|
14559
|
+
var typeSuffix = $2;
|
|
14358
14560
|
var initializer = $3;
|
|
14359
14561
|
return {
|
|
14360
14562
|
type: "Binding",
|
|
14361
14563
|
children: $0,
|
|
14362
14564
|
names: pattern.names,
|
|
14363
14565
|
pattern,
|
|
14364
|
-
|
|
14566
|
+
typeSuffix,
|
|
14365
14567
|
initializer,
|
|
14366
14568
|
splices: [],
|
|
14367
14569
|
thisAssignments: []
|
|
@@ -16306,14 +16508,14 @@ function UsingDeclaration(ctx, state2) {
|
|
|
16306
16508
|
}
|
|
16307
16509
|
var UsingBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingIdentifier, (0, import_lib3.$E)(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
|
|
16308
16510
|
var pattern = $1;
|
|
16309
|
-
var
|
|
16511
|
+
var typeSuffix = $2;
|
|
16310
16512
|
var initializer = $3;
|
|
16311
16513
|
return {
|
|
16312
16514
|
type: "Binding",
|
|
16313
16515
|
children: $0,
|
|
16314
16516
|
names: pattern.names,
|
|
16315
16517
|
pattern,
|
|
16316
|
-
|
|
16518
|
+
typeSuffix,
|
|
16317
16519
|
initializer,
|
|
16318
16520
|
splices: [],
|
|
16319
16521
|
thisAssignments: []
|
|
@@ -16875,7 +17077,8 @@ function TypeUnary(ctx, state2) {
|
|
|
16875
17077
|
}
|
|
16876
17078
|
var TypeUnarySuffix$0 = TypeIndexedAccess;
|
|
16877
17079
|
var TypeUnarySuffix$1 = QuestionMark;
|
|
16878
|
-
var TypeUnarySuffix
|
|
17080
|
+
var TypeUnarySuffix$2 = NonNullAssertion;
|
|
17081
|
+
var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1, TypeUnarySuffix$2];
|
|
16879
17082
|
function TypeUnarySuffix(ctx, state2) {
|
|
16880
17083
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeUnarySuffix", TypeUnarySuffix$$);
|
|
16881
17084
|
}
|