@danielx/civet 0.7.33 → 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 +17 -0
- package/dist/browser.js +467 -227
- package/dist/main.js +467 -227
- package/dist/main.mjs +467 -227
- package/dist/types.d.ts +1 -0
- package/dist/unplugin/unplugin.js +17 -4
- package/dist/unplugin/unplugin.mjs +17 -4
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -573,11 +573,13 @@ ${body}`;
|
|
|
573
573
|
processProgramAsync: () => processProgramAsync,
|
|
574
574
|
processTryBlock: () => processTryBlock,
|
|
575
575
|
processUnaryExpression: () => processUnaryExpression,
|
|
576
|
+
processUnaryNestedExpression: () => processUnaryNestedExpression,
|
|
576
577
|
quoteString: () => quoteString,
|
|
577
578
|
reorderBindingRestProperty: () => reorderBindingRestProperty,
|
|
578
579
|
replaceNode: () => replaceNode,
|
|
579
580
|
replaceNodes: () => replaceNodes,
|
|
580
581
|
skipImplicitArguments: () => skipImplicitArguments,
|
|
582
|
+
stripTrailingImplicitComma: () => stripTrailingImplicitComma,
|
|
581
583
|
trimFirstSpace: () => trimFirstSpace,
|
|
582
584
|
typeOfJSX: () => typeOfJSX,
|
|
583
585
|
wrapIIFE: () => wrapIIFE
|
|
@@ -714,6 +716,40 @@ ${body}`;
|
|
|
714
716
|
return node.every(isWhitespaceOrEmpty);
|
|
715
717
|
return false;
|
|
716
718
|
}
|
|
719
|
+
function firstNonSpace(node) {
|
|
720
|
+
if (!(node != null)) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (Array.isArray(node)) {
|
|
724
|
+
for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
|
|
725
|
+
const child = node[i2];
|
|
726
|
+
let ref1;
|
|
727
|
+
if (ref1 = firstNonSpace(child)) {
|
|
728
|
+
const first = ref1;
|
|
729
|
+
return first;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return void 0;
|
|
733
|
+
} else if (isParent(node)) {
|
|
734
|
+
let ref2;
|
|
735
|
+
if (ref2 = firstNonSpace(node.children)) {
|
|
736
|
+
const first = ref2;
|
|
737
|
+
return first;
|
|
738
|
+
} else {
|
|
739
|
+
return node;
|
|
740
|
+
}
|
|
741
|
+
} else if (isToken(node)) {
|
|
742
|
+
let m;
|
|
743
|
+
if (m = node.token, typeof m === "string" && /^[ \t]*$/.test(m)) {
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
} else if (typeof node === "string") {
|
|
747
|
+
if (typeof node === "string" && /^[ \t]*$/.test(node)) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return node;
|
|
752
|
+
}
|
|
717
753
|
function isExit(node) {
|
|
718
754
|
if (!(node != null)) {
|
|
719
755
|
return false;
|
|
@@ -751,6 +787,14 @@ ${body}`;
|
|
|
751
787
|
;
|
|
752
788
|
return;
|
|
753
789
|
}
|
|
790
|
+
function stripTrailingImplicitComma(children) {
|
|
791
|
+
const last = children[children.length - 1];
|
|
792
|
+
if (isComma(last) && last.implicit) {
|
|
793
|
+
return children.slice(0, -1);
|
|
794
|
+
} else {
|
|
795
|
+
return children;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
754
798
|
function insertTrimmingSpace(target, c) {
|
|
755
799
|
if (!(target != null)) {
|
|
756
800
|
return target;
|
|
@@ -923,8 +967,8 @@ ${body}`;
|
|
|
923
967
|
return void 0;
|
|
924
968
|
}
|
|
925
969
|
if (Array.isArray(node)) {
|
|
926
|
-
for (let
|
|
927
|
-
const child = node[
|
|
970
|
+
for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
|
|
971
|
+
const child = node[i3];
|
|
928
972
|
if (skip(child)) {
|
|
929
973
|
continue;
|
|
930
974
|
}
|
|
@@ -1011,6 +1055,9 @@ ${body}`;
|
|
|
1011
1055
|
return expression;
|
|
1012
1056
|
}
|
|
1013
1057
|
}
|
|
1058
|
+
return parenthesizeExpression(expression);
|
|
1059
|
+
}
|
|
1060
|
+
function parenthesizeExpression(expression) {
|
|
1014
1061
|
return makeNode({
|
|
1015
1062
|
type: "ParenthesizedExpression",
|
|
1016
1063
|
children: ["(", expression, ")"],
|
|
@@ -1026,8 +1073,8 @@ ${body}`;
|
|
|
1026
1073
|
return;
|
|
1027
1074
|
}
|
|
1028
1075
|
if (Array.isArray(node)) {
|
|
1029
|
-
for (let
|
|
1030
|
-
const child = node[
|
|
1076
|
+
for (let i4 = 0, len4 = node.length; i4 < len4; i4++) {
|
|
1077
|
+
const child = node[i4];
|
|
1031
1078
|
updateParentPointers(child, parent, depth);
|
|
1032
1079
|
}
|
|
1033
1080
|
return;
|
|
@@ -1037,8 +1084,8 @@ ${body}`;
|
|
|
1037
1084
|
node.parent = parent;
|
|
1038
1085
|
}
|
|
1039
1086
|
if (depth && isParent(node)) {
|
|
1040
|
-
for (let
|
|
1041
|
-
const child =
|
|
1087
|
+
for (let ref3 = node.children, i5 = 0, len5 = ref3.length; i5 < len5; i5++) {
|
|
1088
|
+
const child = ref3[i5];
|
|
1042
1089
|
updateParentPointers(child, node, depth - 1);
|
|
1043
1090
|
}
|
|
1044
1091
|
}
|
|
@@ -1094,12 +1141,11 @@ ${body}`;
|
|
|
1094
1141
|
]);
|
|
1095
1142
|
}
|
|
1096
1143
|
var typeNeedsNoParens = /* @__PURE__ */ new Set([
|
|
1097
|
-
"
|
|
1144
|
+
"TypeIdentifier",
|
|
1098
1145
|
"ImportType",
|
|
1099
|
-
"
|
|
1146
|
+
"TypeLiteral",
|
|
1100
1147
|
"TupleType",
|
|
1101
|
-
"
|
|
1102
|
-
"UnaryType"
|
|
1148
|
+
"TypeParenthesized"
|
|
1103
1149
|
]);
|
|
1104
1150
|
function parenthesizeType(type) {
|
|
1105
1151
|
if (typeNeedsNoParens.has(type.type)) {
|
|
@@ -1169,8 +1215,8 @@ ${body}`;
|
|
|
1169
1215
|
children.splice(1, 0, ".bind(this)");
|
|
1170
1216
|
}
|
|
1171
1217
|
if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
|
|
1172
|
-
let
|
|
1173
|
-
children[children.length - 1] = (
|
|
1218
|
+
let ref4;
|
|
1219
|
+
children[children.length - 1] = (ref4 = parameters.children)[ref4.length - 1] = "(arguments)";
|
|
1174
1220
|
}
|
|
1175
1221
|
}
|
|
1176
1222
|
const exp = makeNode({
|
|
@@ -1193,9 +1239,9 @@ ${body}`;
|
|
|
1193
1239
|
}
|
|
1194
1240
|
function flatJoin(array, separator) {
|
|
1195
1241
|
const result = [];
|
|
1196
|
-
for (let
|
|
1197
|
-
const i =
|
|
1198
|
-
const items = array[
|
|
1242
|
+
for (let i6 = 0, len6 = array.length; i6 < len6; i6++) {
|
|
1243
|
+
const i = i6;
|
|
1244
|
+
const items = array[i6];
|
|
1199
1245
|
if (i) {
|
|
1200
1246
|
result.push(separator);
|
|
1201
1247
|
}
|
|
@@ -1589,16 +1635,10 @@ ${body}`;
|
|
|
1589
1635
|
|
|
1590
1636
|
// source/parser/function.civet
|
|
1591
1637
|
function isVoidType(t) {
|
|
1592
|
-
return t?.type === "
|
|
1638
|
+
return t?.type === "TypeLiteral" && t.t.type === "VoidType";
|
|
1593
1639
|
}
|
|
1594
1640
|
function isPromiseVoidType(t) {
|
|
1595
|
-
return t?.type === "
|
|
1596
|
-
}
|
|
1597
|
-
function isGeneratorVoidType(t) {
|
|
1598
|
-
return t?.type === "IdentifierType" && (t.raw === "Iterator" || t.raw === "Generator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
|
|
1599
|
-
}
|
|
1600
|
-
function isAsyncGeneratorVoidType(t) {
|
|
1601
|
-
return t?.type === "IdentifierType" && (t.raw === "AsyncIterator" || t.raw === "AsyncGenerator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
|
|
1641
|
+
return t?.type === "TypeIdentifier" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
|
|
1602
1642
|
}
|
|
1603
1643
|
function implicitFunctionBlock(f) {
|
|
1604
1644
|
if (f.abstract || f.block || f.signature?.optional)
|
|
@@ -1637,7 +1677,7 @@ ${body}`;
|
|
|
1637
1677
|
const { async, generator, set } = modifier;
|
|
1638
1678
|
const isMethod = f.type === "MethodDefinition";
|
|
1639
1679
|
const isConstructor = isMethod && name === "constructor";
|
|
1640
|
-
const isVoid =
|
|
1680
|
+
const isVoid = generator || isVoidType(returnType2?.t) || async && isPromiseVoidType(returnType2?.t);
|
|
1641
1681
|
if (block?.type === "BlockStatement") {
|
|
1642
1682
|
if (isVoid || set || isConstructor) {
|
|
1643
1683
|
if (block.bare && block.implicitlyReturned) {
|
|
@@ -1653,10 +1693,7 @@ ${body}`;
|
|
|
1653
1693
|
}
|
|
1654
1694
|
function processReturnValue(func) {
|
|
1655
1695
|
const { block } = func;
|
|
1656
|
-
const values = gatherRecursiveWithinFunction(
|
|
1657
|
-
block,
|
|
1658
|
-
({ type }) => type === "ReturnValue"
|
|
1659
|
-
);
|
|
1696
|
+
const values = gatherRecursiveWithinFunction(block, ($) => $.type === "ReturnValue");
|
|
1660
1697
|
if (!values.length) {
|
|
1661
1698
|
return false;
|
|
1662
1699
|
}
|
|
@@ -1666,7 +1703,7 @@ ${body}`;
|
|
|
1666
1703
|
value.children = [ref];
|
|
1667
1704
|
const { ancestor, child } = findAncestor(
|
|
1668
1705
|
value,
|
|
1669
|
-
(
|
|
1706
|
+
($1) => $1.type === "Declaration",
|
|
1670
1707
|
isFunction
|
|
1671
1708
|
);
|
|
1672
1709
|
if (ancestor) {
|
|
@@ -1686,8 +1723,8 @@ ${body}`;
|
|
|
1686
1723
|
}
|
|
1687
1724
|
}
|
|
1688
1725
|
if (declaration) {
|
|
1689
|
-
if (!(declaration.
|
|
1690
|
-
declaration.children[1] = declaration.
|
|
1726
|
+
if (!(declaration.typeSuffix != null)) {
|
|
1727
|
+
declaration.children[1] = declaration.typeSuffix = returnType;
|
|
1691
1728
|
}
|
|
1692
1729
|
} else {
|
|
1693
1730
|
block.expressions.unshift([
|
|
@@ -1796,14 +1833,13 @@ ${body}`;
|
|
|
1796
1833
|
if (isExit(exp)) {
|
|
1797
1834
|
return;
|
|
1798
1835
|
}
|
|
1836
|
+
exp = exp;
|
|
1799
1837
|
const outer = exp;
|
|
1800
|
-
|
|
1801
|
-
if (type === "LabelledStatement") {
|
|
1838
|
+
if (exp.type === "LabelledStatement") {
|
|
1802
1839
|
exp = exp.statement;
|
|
1803
|
-
({ type } = exp);
|
|
1804
1840
|
}
|
|
1805
1841
|
let ref4;
|
|
1806
|
-
switch (type) {
|
|
1842
|
+
switch (exp.type) {
|
|
1807
1843
|
case "BreakStatement":
|
|
1808
1844
|
case "ContinueStatement":
|
|
1809
1845
|
case "DebuggerStatement":
|
|
@@ -2028,7 +2064,7 @@ ${body}`;
|
|
|
2028
2064
|
let changed = false;
|
|
2029
2065
|
for (const control of gatherRecursiveWithinFunction(
|
|
2030
2066
|
statement.block,
|
|
2031
|
-
($) =>
|
|
2067
|
+
($2) => $2.type === "BreakStatement" || $2.type === "ContinueStatement"
|
|
2032
2068
|
)) {
|
|
2033
2069
|
let controlName2 = function() {
|
|
2034
2070
|
switch (control.type) {
|
|
@@ -2063,7 +2099,7 @@ ${body}`;
|
|
|
2063
2099
|
)
|
|
2064
2100
|
);
|
|
2065
2101
|
updateParentPointers(control.with, control);
|
|
2066
|
-
const i = control.children.findIndex(($
|
|
2102
|
+
const i = control.children.findIndex(($3) => $3?.type === "Error");
|
|
2067
2103
|
if (i >= 0) {
|
|
2068
2104
|
control.children.splice(i, 1);
|
|
2069
2105
|
}
|
|
@@ -2187,8 +2223,8 @@ ${body}`;
|
|
|
2187
2223
|
}
|
|
2188
2224
|
if (hasYield(block) && !f.generator?.length) {
|
|
2189
2225
|
if (f.type === "ArrowFunction") {
|
|
2190
|
-
gatherRecursiveWithinFunction(block, ($
|
|
2191
|
-
const i = y.children.findIndex(($
|
|
2226
|
+
gatherRecursiveWithinFunction(block, ($4) => $4.type === "YieldExpression").forEach((y) => {
|
|
2227
|
+
const i = y.children.findIndex(($5) => $5.type === "Yield");
|
|
2192
2228
|
return y.children.splice(i + 1, 0, {
|
|
2193
2229
|
type: "Error",
|
|
2194
2230
|
message: "Can't use yield inside of => arrow function"
|
|
@@ -2312,12 +2348,13 @@ ${body}`;
|
|
|
2312
2348
|
expression = {
|
|
2313
2349
|
...expression,
|
|
2314
2350
|
parameters: newParameters,
|
|
2315
|
-
children: expression.children.map(($
|
|
2351
|
+
children: expression.children.map(($6) => $6 === parameters ? newParameters : $6)
|
|
2316
2352
|
};
|
|
2317
2353
|
}
|
|
2318
2354
|
return {
|
|
2319
2355
|
type: "CallExpression",
|
|
2320
2356
|
children: [
|
|
2357
|
+
ws,
|
|
2321
2358
|
makeLeftHandSideExpression(expression),
|
|
2322
2359
|
{
|
|
2323
2360
|
type: "Call",
|
|
@@ -2333,7 +2370,7 @@ ${body}`;
|
|
|
2333
2370
|
ref = makeRef("$");
|
|
2334
2371
|
inplacePrepend(ref, body);
|
|
2335
2372
|
}
|
|
2336
|
-
if (startsWithPredicate(body, ($
|
|
2373
|
+
if (startsWithPredicate(body, ($7) => $7.type === "ObjectExpression")) {
|
|
2337
2374
|
body = makeLeftHandSideExpression(body);
|
|
2338
2375
|
}
|
|
2339
2376
|
const parameters = makeNode({
|
|
@@ -3523,7 +3560,7 @@ ${body}`;
|
|
|
3523
3560
|
function len2(arr, length) {
|
|
3524
3561
|
return arr.length === length;
|
|
3525
3562
|
}
|
|
3526
|
-
function processAssignmentDeclaration(decl, pattern,
|
|
3563
|
+
function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e) {
|
|
3527
3564
|
decl = {
|
|
3528
3565
|
...decl,
|
|
3529
3566
|
$loc: {
|
|
@@ -3535,7 +3572,7 @@ ${body}`;
|
|
|
3535
3572
|
splices = splices.map((s) => [", ", s]);
|
|
3536
3573
|
const thisAssignments = assignments.map((a) => ["", a, ";"]);
|
|
3537
3574
|
if ("typeSuffix" in pattern) {
|
|
3538
|
-
|
|
3575
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
3539
3576
|
}
|
|
3540
3577
|
const initializer = makeNode({
|
|
3541
3578
|
type: "Initializer",
|
|
@@ -3547,9 +3584,9 @@ ${body}`;
|
|
|
3547
3584
|
pattern,
|
|
3548
3585
|
initializer,
|
|
3549
3586
|
splices,
|
|
3550
|
-
|
|
3587
|
+
typeSuffix,
|
|
3551
3588
|
thisAssignments,
|
|
3552
|
-
children: [pattern,
|
|
3589
|
+
children: [pattern, typeSuffix, initializer]
|
|
3553
3590
|
});
|
|
3554
3591
|
const children = [decl, binding];
|
|
3555
3592
|
return makeNode({
|
|
@@ -3566,9 +3603,9 @@ ${body}`;
|
|
|
3566
3603
|
gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
|
|
3567
3604
|
const { bindings } = statement;
|
|
3568
3605
|
return bindings?.forEach((binding) => {
|
|
3569
|
-
const
|
|
3570
|
-
if (
|
|
3571
|
-
convertOptionalType(
|
|
3606
|
+
const { typeSuffix } = binding;
|
|
3607
|
+
if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
|
|
3608
|
+
convertOptionalType(typeSuffix);
|
|
3572
3609
|
}
|
|
3573
3610
|
const { initializer } = binding;
|
|
3574
3611
|
if (initializer) {
|
|
@@ -3649,8 +3686,8 @@ ${body}`;
|
|
|
3649
3686
|
}
|
|
3650
3687
|
const { decl, bindings } = condition.declaration;
|
|
3651
3688
|
const binding = bindings[0];
|
|
3652
|
-
let { pattern,
|
|
3653
|
-
const nullCheck =
|
|
3689
|
+
let { pattern, typeSuffix, initializer } = binding;
|
|
3690
|
+
const nullCheck = typeSuffix?.optional && !typeSuffix.t && !typeSuffix.nonnull;
|
|
3654
3691
|
if (!(initializer != null)) {
|
|
3655
3692
|
condition.children = [
|
|
3656
3693
|
{
|
|
@@ -3688,14 +3725,14 @@ ${body}`;
|
|
|
3688
3725
|
if (nullCheck) {
|
|
3689
3726
|
children.unshift("(");
|
|
3690
3727
|
children.push(") != null");
|
|
3691
|
-
|
|
3728
|
+
typeSuffix = void 0;
|
|
3692
3729
|
}
|
|
3693
3730
|
Object.assign(condition, {
|
|
3694
3731
|
type: "AssignmentExpression",
|
|
3695
3732
|
children,
|
|
3696
3733
|
hoistDec: !simple ? {
|
|
3697
3734
|
type: "Declaration",
|
|
3698
|
-
children: ["let ", ref,
|
|
3735
|
+
children: ["let ", ref, typeSuffix],
|
|
3699
3736
|
names: []
|
|
3700
3737
|
} : void 0,
|
|
3701
3738
|
pattern,
|
|
@@ -3703,7 +3740,7 @@ ${body}`;
|
|
|
3703
3740
|
});
|
|
3704
3741
|
}
|
|
3705
3742
|
updateParentPointers(condition, parent);
|
|
3706
|
-
rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl,
|
|
3743
|
+
rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, typeSuffix);
|
|
3707
3744
|
}
|
|
3708
3745
|
function processDeclarationConditions(node) {
|
|
3709
3746
|
gatherRecursiveAll(
|
|
@@ -3805,9 +3842,6 @@ ${body}`;
|
|
|
3805
3842
|
}
|
|
3806
3843
|
} else {
|
|
3807
3844
|
const block = blockWithPrefix(blockPrefix, s.then);
|
|
3808
|
-
if (block.bare && e && !block.semicolon) {
|
|
3809
|
-
block.children.push(block.semicolon = ";");
|
|
3810
|
-
}
|
|
3811
3845
|
s.children = s.children.map(($2) => $2 === s.then ? block : $2);
|
|
3812
3846
|
s.then = block;
|
|
3813
3847
|
updateParentPointers(s);
|
|
@@ -4084,6 +4118,10 @@ ${body}`;
|
|
|
4084
4118
|
};
|
|
4085
4119
|
pre = pre.slice(0, -1);
|
|
4086
4120
|
} else {
|
|
4121
|
+
let m;
|
|
4122
|
+
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)) {
|
|
4123
|
+
exp = parenthesizeExpression(exp);
|
|
4124
|
+
}
|
|
4087
4125
|
exp = {
|
|
4088
4126
|
type: "AwaitExpression",
|
|
4089
4127
|
children: [...last.children, exp]
|
|
@@ -4099,6 +4137,77 @@ ${body}`;
|
|
|
4099
4137
|
children: [...pre, exp, post]
|
|
4100
4138
|
};
|
|
4101
4139
|
}
|
|
4140
|
+
function processUnaryNestedExpression(pre, args, post) {
|
|
4141
|
+
const isArray = args.type === "ArrayExpression";
|
|
4142
|
+
if (!isArray) {
|
|
4143
|
+
args = stripTrailingImplicitComma(args);
|
|
4144
|
+
}
|
|
4145
|
+
if (isArray || args.length > 2) {
|
|
4146
|
+
const last = pre[pre.length - 1];
|
|
4147
|
+
if (!(typeof last === "object" && last != null && "type" in last && last.type === "Await")) {
|
|
4148
|
+
return;
|
|
4149
|
+
}
|
|
4150
|
+
if (last.op) {
|
|
4151
|
+
if (!isArray) {
|
|
4152
|
+
args = {
|
|
4153
|
+
type: "ArrayExpression",
|
|
4154
|
+
children: ["[", args, "]"]
|
|
4155
|
+
};
|
|
4156
|
+
}
|
|
4157
|
+
} else {
|
|
4158
|
+
pre.pop();
|
|
4159
|
+
if (!isArray) {
|
|
4160
|
+
args = args;
|
|
4161
|
+
args = {
|
|
4162
|
+
type: "ArrayExpression",
|
|
4163
|
+
children: [
|
|
4164
|
+
"[",
|
|
4165
|
+
...(() => {
|
|
4166
|
+
const results = [];
|
|
4167
|
+
for (let i = 0, len3 = args.length; i < len3; i++) {
|
|
4168
|
+
const arg = args[i];
|
|
4169
|
+
if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "Argument") {
|
|
4170
|
+
const expression = processUnaryExpression([last], arg.expression);
|
|
4171
|
+
results.push({
|
|
4172
|
+
...arg,
|
|
4173
|
+
expression,
|
|
4174
|
+
children: arg.children.map(($) => $ === arg.expression ? expression : $)
|
|
4175
|
+
});
|
|
4176
|
+
} else {
|
|
4177
|
+
results.push(arg);
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
return results;
|
|
4181
|
+
})(),
|
|
4182
|
+
"]"
|
|
4183
|
+
]
|
|
4184
|
+
};
|
|
4185
|
+
} else {
|
|
4186
|
+
args = trimFirstSpace(args);
|
|
4187
|
+
args = {
|
|
4188
|
+
...args,
|
|
4189
|
+
children: args.children.map(
|
|
4190
|
+
(arg) => {
|
|
4191
|
+
if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "ArrayElement" && "expression" in arg && "children" in arg) {
|
|
4192
|
+
const { type, expression: exp, children } = arg;
|
|
4193
|
+
let expression = processUnaryExpression([last], trimFirstSpace(exp));
|
|
4194
|
+
expression = prepend(getTrimmingSpace(exp), expression);
|
|
4195
|
+
return {
|
|
4196
|
+
...arg,
|
|
4197
|
+
expression,
|
|
4198
|
+
children: children.map(($1) => $1 === exp ? expression : $1)
|
|
4199
|
+
};
|
|
4200
|
+
} else {
|
|
4201
|
+
return arg;
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
)
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
return processUnaryExpression(pre, args, post);
|
|
4210
|
+
}
|
|
4102
4211
|
|
|
4103
4212
|
// source/parser/pipe.civet
|
|
4104
4213
|
function constructInvocation(fn, arg) {
|
|
@@ -4136,36 +4245,31 @@ ${body}`;
|
|
|
4136
4245
|
};
|
|
4137
4246
|
}
|
|
4138
4247
|
function constructPipeStep(fn, arg, returning) {
|
|
4248
|
+
if (!returning) {
|
|
4249
|
+
returning = null;
|
|
4250
|
+
}
|
|
4139
4251
|
let children = [[fn.leadingComment, fn.expr, fn.trailingComment].map(skipIfOnlyWS), " ", arg];
|
|
4140
4252
|
switch (fn.expr.token) {
|
|
4141
|
-
case "
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
}
|
|
4146
|
-
if (returning) {
|
|
4147
|
-
return [
|
|
4148
|
-
children,
|
|
4149
|
-
returning
|
|
4150
|
-
];
|
|
4151
|
-
}
|
|
4253
|
+
case "await": {
|
|
4254
|
+
children = processUnaryExpression([fn.expr], arg, void 0);
|
|
4255
|
+
}
|
|
4256
|
+
case "yield": {
|
|
4152
4257
|
return [
|
|
4153
4258
|
children,
|
|
4154
|
-
|
|
4259
|
+
returning
|
|
4155
4260
|
];
|
|
4156
|
-
|
|
4261
|
+
}
|
|
4262
|
+
case "return": {
|
|
4157
4263
|
return [{
|
|
4158
4264
|
type: "ReturnStatement",
|
|
4159
4265
|
children
|
|
4160
4266
|
}, null];
|
|
4267
|
+
}
|
|
4161
4268
|
}
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
];
|
|
4167
|
-
}
|
|
4168
|
-
return [constructInvocation(fn, arg), null];
|
|
4269
|
+
return [
|
|
4270
|
+
constructInvocation(fn, arg),
|
|
4271
|
+
returning
|
|
4272
|
+
];
|
|
4169
4273
|
}
|
|
4170
4274
|
function processPipelineExpressions(statements) {
|
|
4171
4275
|
gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
|
|
@@ -4422,7 +4526,29 @@ ${body}`;
|
|
|
4422
4526
|
message: "'own' is only meaningful in for..in loops"
|
|
4423
4527
|
};
|
|
4424
4528
|
}
|
|
4425
|
-
|
|
4529
|
+
const { binding } = declaration;
|
|
4530
|
+
let pattern = binding?.pattern;
|
|
4531
|
+
if (binding?.typeSuffix || inOf.token === "in" && declaration2 && pattern.type !== "Identifier") {
|
|
4532
|
+
const itemRef = makeRef(inOf.token === "in" ? "key" : "item");
|
|
4533
|
+
blockPrefix.push(["", {
|
|
4534
|
+
type: "Declaration",
|
|
4535
|
+
children: [declaration, " = ", itemRef],
|
|
4536
|
+
names: declaration.names
|
|
4537
|
+
}, ";"]);
|
|
4538
|
+
pattern = itemRef;
|
|
4539
|
+
declaration = {
|
|
4540
|
+
type: "ForDeclaration",
|
|
4541
|
+
binding: {
|
|
4542
|
+
type: "Binding",
|
|
4543
|
+
pattern,
|
|
4544
|
+
children: [pattern],
|
|
4545
|
+
names: []
|
|
4546
|
+
},
|
|
4547
|
+
children: ["const ", itemRef],
|
|
4548
|
+
names: []
|
|
4549
|
+
};
|
|
4550
|
+
}
|
|
4551
|
+
if (!(declaration2 || own)) {
|
|
4426
4552
|
return {
|
|
4427
4553
|
declaration,
|
|
4428
4554
|
blockPrefix,
|
|
@@ -4461,29 +4587,6 @@ ${body}`;
|
|
|
4461
4587
|
children: [" ", expRef2, " =", exp]
|
|
4462
4588
|
};
|
|
4463
4589
|
}
|
|
4464
|
-
const { binding } = declaration;
|
|
4465
|
-
let { pattern } = binding;
|
|
4466
|
-
if (!(pattern.type === "Identifier")) {
|
|
4467
|
-
const keyRef = makeRef("key");
|
|
4468
|
-
blockPrefix.push(["", [
|
|
4469
|
-
declaration,
|
|
4470
|
-
" = ",
|
|
4471
|
-
keyRef
|
|
4472
|
-
], ";"]);
|
|
4473
|
-
pattern = keyRef;
|
|
4474
|
-
declaration = {
|
|
4475
|
-
type: "ForDeclaration",
|
|
4476
|
-
binding: {
|
|
4477
|
-
type: "Binding",
|
|
4478
|
-
pattern,
|
|
4479
|
-
children: [pattern],
|
|
4480
|
-
names: [],
|
|
4481
|
-
suffix: binding.suffix
|
|
4482
|
-
},
|
|
4483
|
-
children: ["const ", keyRef],
|
|
4484
|
-
names: []
|
|
4485
|
-
};
|
|
4486
|
-
}
|
|
4487
4590
|
if (own) {
|
|
4488
4591
|
const hasPropRef = getRef("hasProp");
|
|
4489
4592
|
blockPrefix.push(["", ["if (!", hasPropRef, "(", insertTrimmingSpace(expRef2, ""), ", ", insertTrimmingSpace(pattern, ""), ")) continue"], ";"]);
|
|
@@ -4516,7 +4619,8 @@ ${body}`;
|
|
|
4516
4619
|
function findDecs(statements) {
|
|
4517
4620
|
const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
|
|
4518
4621
|
const declarationNames = declarations.flatMap((d) => d.names);
|
|
4519
|
-
|
|
4622
|
+
const globals = getConfig().globals || [];
|
|
4623
|
+
return new Set(globals.concat(declarationNames));
|
|
4520
4624
|
}
|
|
4521
4625
|
function createConstLetDecs(statements, scopes, letOrConst) {
|
|
4522
4626
|
function findVarDecs(statements2, decs) {
|
|
@@ -5383,7 +5487,7 @@ ${js}`
|
|
|
5383
5487
|
function expressionizeTypeIf([ifOp, condition, t, e]) {
|
|
5384
5488
|
const children = [
|
|
5385
5489
|
"(",
|
|
5386
|
-
|
|
5490
|
+
trimFirstSpace(condition),
|
|
5387
5491
|
"?"
|
|
5388
5492
|
];
|
|
5389
5493
|
if (!xor(ifOp.negated, condition.negated)) {
|
|
@@ -5566,7 +5670,7 @@ ${js}`
|
|
|
5566
5670
|
[name, value] = [value, name];
|
|
5567
5671
|
}
|
|
5568
5672
|
if (!suppressPrefix) {
|
|
5569
|
-
value = prefix.concat(
|
|
5673
|
+
value = prefix.concat(trimFirstSpace(value));
|
|
5570
5674
|
}
|
|
5571
5675
|
if (wValue)
|
|
5572
5676
|
value.unshift(wValue);
|
|
@@ -5792,7 +5896,7 @@ ${js}`
|
|
|
5792
5896
|
if (part.name.type === "ComputedPropertyName") {
|
|
5793
5897
|
rest.push(part);
|
|
5794
5898
|
} else {
|
|
5795
|
-
parts.push([part.name, "={",
|
|
5899
|
+
parts.push([part.name, "={", trimFirstSpace(part.value), "}"]);
|
|
5796
5900
|
}
|
|
5797
5901
|
break;
|
|
5798
5902
|
case "SpreadProperty":
|
|
@@ -5817,7 +5921,7 @@ ${js}`
|
|
|
5817
5921
|
}
|
|
5818
5922
|
function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "get" }, autoReturn = true) {
|
|
5819
5923
|
const { token } = kind;
|
|
5820
|
-
ws =
|
|
5924
|
+
ws = trimFirstSpace(ws);
|
|
5821
5925
|
let setVal;
|
|
5822
5926
|
const parameters = token === "get" ? {
|
|
5823
5927
|
type: "Parameters",
|
|
@@ -6178,37 +6282,85 @@ ${js}`
|
|
|
6178
6282
|
}
|
|
6179
6283
|
}
|
|
6180
6284
|
function processTypes(node) {
|
|
6181
|
-
return gatherRecursiveAll(node, (n) => n.type === "
|
|
6182
|
-
|
|
6183
|
-
let count = 0;
|
|
6184
|
-
let ref10;
|
|
6185
|
-
while (unary.suffix.length && (ref10 = unary.suffix)[ref10.length - 1]?.token === "?") {
|
|
6186
|
-
last = unary.suffix.pop();
|
|
6187
|
-
count++;
|
|
6188
|
-
}
|
|
6189
|
-
if (!count) {
|
|
6285
|
+
return gatherRecursiveAll(node, (n) => n.type === "TypeUnary").forEach((unary) => {
|
|
6286
|
+
if (!unary.suffix.length) {
|
|
6190
6287
|
return;
|
|
6191
6288
|
}
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6289
|
+
let ref10;
|
|
6290
|
+
let m3;
|
|
6291
|
+
if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
|
|
6292
|
+
const { token } = m3;
|
|
6293
|
+
let last;
|
|
6294
|
+
let count = 0;
|
|
6295
|
+
let ref11;
|
|
6296
|
+
while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
|
|
6297
|
+
last = unary.suffix.pop();
|
|
6298
|
+
count++;
|
|
6196
6299
|
}
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6300
|
+
let ref12;
|
|
6301
|
+
while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
|
|
6302
|
+
unary.suffix.pop();
|
|
6303
|
+
}
|
|
6304
|
+
let ref13;
|
|
6305
|
+
if (unary.suffix.length || unary.prefix.length)
|
|
6306
|
+
ref13 = unary;
|
|
6307
|
+
else
|
|
6308
|
+
ref13 = unary.t;
|
|
6309
|
+
const t = ref13;
|
|
6310
|
+
if (unary.parent?.type === "TypeTuple") {
|
|
6311
|
+
if (count === 1) {
|
|
6312
|
+
unary.suffix.push(last);
|
|
6313
|
+
return;
|
|
6314
|
+
}
|
|
6315
|
+
replaceNode(unary, [
|
|
6316
|
+
getTrimmingSpace(unary),
|
|
6317
|
+
"(",
|
|
6318
|
+
parenthesizeType(trimFirstSpace(t)),
|
|
6319
|
+
" | null)",
|
|
6320
|
+
last
|
|
6321
|
+
]);
|
|
6322
|
+
} else {
|
|
6323
|
+
replaceNode(unary, {
|
|
6324
|
+
type: "TypeParenthesized",
|
|
6325
|
+
ts: true,
|
|
6326
|
+
children: [
|
|
6327
|
+
getTrimmingSpace(unary),
|
|
6328
|
+
"(",
|
|
6329
|
+
parenthesizeType(trimFirstSpace(t)),
|
|
6330
|
+
count === 1 ? " | undefined" : " | undefined | null",
|
|
6331
|
+
")"
|
|
6332
|
+
]
|
|
6333
|
+
});
|
|
6334
|
+
}
|
|
6335
|
+
} else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
|
|
6336
|
+
const { type } = m3;
|
|
6337
|
+
let ref14;
|
|
6338
|
+
while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
|
|
6339
|
+
unary.suffix.pop();
|
|
6340
|
+
}
|
|
6341
|
+
let ref15;
|
|
6342
|
+
while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
|
|
6343
|
+
unary.suffix.pop();
|
|
6344
|
+
}
|
|
6345
|
+
const t = trimFirstSpace(
|
|
6346
|
+
unary.suffix.length || unary.prefix.length ? unary : unary.t
|
|
6347
|
+
);
|
|
6348
|
+
const args = {
|
|
6349
|
+
type: "TypeArguments",
|
|
6350
|
+
ts: true,
|
|
6351
|
+
types: [t],
|
|
6352
|
+
children: ["<", t, ">"]
|
|
6353
|
+
};
|
|
6354
|
+
replaceNode(unary, {
|
|
6355
|
+
type: "TypeIdentifier",
|
|
6356
|
+
raw: "NonNullable",
|
|
6357
|
+
args,
|
|
6358
|
+
children: [
|
|
6359
|
+
getTrimmingSpace(unary),
|
|
6360
|
+
"NonNullable",
|
|
6361
|
+
args
|
|
6362
|
+
]
|
|
6363
|
+
});
|
|
6212
6364
|
}
|
|
6213
6365
|
});
|
|
6214
6366
|
}
|
|
@@ -6216,11 +6368,11 @@ ${js}`
|
|
|
6216
6368
|
gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
|
|
6217
6369
|
const exp = _exp;
|
|
6218
6370
|
const { statement } = exp;
|
|
6219
|
-
let
|
|
6371
|
+
let ref16;
|
|
6220
6372
|
switch (statement.type) {
|
|
6221
6373
|
case "IfStatement": {
|
|
6222
|
-
if (
|
|
6223
|
-
const expression =
|
|
6374
|
+
if (ref16 = expressionizeIfStatement(statement)) {
|
|
6375
|
+
const expression = ref16;
|
|
6224
6376
|
return replaceNode(statement, expression, exp);
|
|
6225
6377
|
} else {
|
|
6226
6378
|
return replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -6366,10 +6518,10 @@ ${js}`
|
|
|
6366
6518
|
if (type === "IfStatement") {
|
|
6367
6519
|
liftedIfs.add(ancestor2);
|
|
6368
6520
|
}
|
|
6369
|
-
let m3;
|
|
6370
6521
|
let m4;
|
|
6522
|
+
let m5;
|
|
6371
6523
|
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
6372
|
-
type === "BlockStatement" && !((
|
|
6524
|
+
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
|
|
6373
6525
|
type === "Initializer" || // Right-hand side of assignment
|
|
6374
6526
|
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
6375
6527
|
}));
|
|
@@ -6448,8 +6600,8 @@ ${js}`
|
|
|
6448
6600
|
for (let i4 = 0, len3 = placeholders.length; i4 < len3; i4++) {
|
|
6449
6601
|
const placeholder = placeholders[i4];
|
|
6450
6602
|
typeSuffix ??= placeholder.typeSuffix;
|
|
6451
|
-
let
|
|
6452
|
-
replaceNode((
|
|
6603
|
+
let ref17;
|
|
6604
|
+
replaceNode((ref17 = placeholder.children)[ref17.length - 1], ref);
|
|
6453
6605
|
}
|
|
6454
6606
|
const { parent } = ancestor;
|
|
6455
6607
|
const body = maybeUnwrap(ancestor);
|
|
@@ -6466,16 +6618,16 @@ ${js}`
|
|
|
6466
6618
|
}
|
|
6467
6619
|
case "PipelineExpression": {
|
|
6468
6620
|
const i = findChildIndex(parent, ancestor);
|
|
6469
|
-
let
|
|
6621
|
+
let ref18;
|
|
6470
6622
|
if (i === 1) {
|
|
6471
|
-
|
|
6623
|
+
ref18 = ancestor === parent.children[i];
|
|
6472
6624
|
} else if (i === 2) {
|
|
6473
|
-
|
|
6625
|
+
ref18 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
6474
6626
|
} else {
|
|
6475
|
-
|
|
6627
|
+
ref18 = void 0;
|
|
6476
6628
|
}
|
|
6477
6629
|
;
|
|
6478
|
-
outer =
|
|
6630
|
+
outer = ref18;
|
|
6479
6631
|
break;
|
|
6480
6632
|
}
|
|
6481
6633
|
case "AssignmentExpression":
|
|
@@ -6490,9 +6642,9 @@ ${js}`
|
|
|
6490
6642
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
6491
6643
|
}
|
|
6492
6644
|
replaceNode(ancestor, fnExp, parent);
|
|
6493
|
-
let
|
|
6494
|
-
if (
|
|
6495
|
-
const ws =
|
|
6645
|
+
let ref19;
|
|
6646
|
+
if (ref19 = getTrimmingSpace(body)) {
|
|
6647
|
+
const ws = ref19;
|
|
6496
6648
|
inplaceInsertTrimmingSpace(body, "");
|
|
6497
6649
|
inplacePrepend(ws, fnExp);
|
|
6498
6650
|
}
|
|
@@ -6537,8 +6689,8 @@ ${js}`
|
|
|
6537
6689
|
}
|
|
6538
6690
|
];
|
|
6539
6691
|
}
|
|
6540
|
-
let
|
|
6541
|
-
if (Array.isArray(rest.delim) && (
|
|
6692
|
+
let ref20;
|
|
6693
|
+
if (Array.isArray(rest.delim) && (ref20 = rest.delim)[ref20.length - 1]?.token === ",") {
|
|
6542
6694
|
rest.delim = rest.delim.slice(0, -1);
|
|
6543
6695
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
6544
6696
|
}
|
|
@@ -6703,6 +6855,7 @@ ${js}`
|
|
|
6703
6855
|
NestedArgumentList,
|
|
6704
6856
|
NestedArgument,
|
|
6705
6857
|
SingleLineArgumentExpressions,
|
|
6858
|
+
WArgumentPart,
|
|
6706
6859
|
ArgumentPart,
|
|
6707
6860
|
NonPipelineArgumentPart,
|
|
6708
6861
|
BinaryOpExpression,
|
|
@@ -6714,6 +6867,8 @@ ${js}`
|
|
|
6714
6867
|
UnaryExpression,
|
|
6715
6868
|
UnaryWithoutParenthesizedAssignment,
|
|
6716
6869
|
UnaryBody,
|
|
6870
|
+
MaybeNestedCoffeeDoBody,
|
|
6871
|
+
CoffeeDoBody,
|
|
6717
6872
|
UnaryWithoutParenthesizedAssignmentBody,
|
|
6718
6873
|
ParenthesizedAssignment,
|
|
6719
6874
|
UnaryPostfix,
|
|
@@ -7046,6 +7201,7 @@ ${js}`
|
|
|
7046
7201
|
MaybeNestedNonPipelineExtendedExpression,
|
|
7047
7202
|
MaybeNestedPostfixedExpression,
|
|
7048
7203
|
MaybeNestedExtendedExpression,
|
|
7204
|
+
NestedExtendedExpression,
|
|
7049
7205
|
MaybeParenNestedExtendedExpression,
|
|
7050
7206
|
ImportDeclaration,
|
|
7051
7207
|
ImpliedImport,
|
|
@@ -7302,6 +7458,7 @@ ${js}`
|
|
|
7302
7458
|
NamespaceDeclaration,
|
|
7303
7459
|
OptionalEquals,
|
|
7304
7460
|
TypeLexicalDeclaration,
|
|
7461
|
+
TypeLetOrConstDeclaration,
|
|
7305
7462
|
TypeDeclarationBinding,
|
|
7306
7463
|
InterfaceExtendsClause,
|
|
7307
7464
|
InterfaceExtendsTarget,
|
|
@@ -7795,7 +7952,7 @@ ${js}`
|
|
|
7795
7952
|
var $R91 = (0, import_lib3.$R)(new RegExp("#![^\\r\\n]*", "suy"));
|
|
7796
7953
|
var $R92 = (0, import_lib3.$R)(new RegExp("[\\t ]*", "suy"));
|
|
7797
7954
|
var $R93 = (0, import_lib3.$R)(new RegExp("[\\s]*", "suy"));
|
|
7798
|
-
var $R94 = (0, import_lib3.$R)(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([
|
|
7955
|
+
var $R94 = (0, import_lib3.$R)(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?", "suy"));
|
|
7799
7956
|
var $R95 = (0, import_lib3.$R)(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy"));
|
|
7800
7957
|
var $R96 = (0, import_lib3.$R)(new RegExp("(?=[ \\t\\r\\n\\/#]|$)", "suy"));
|
|
7801
7958
|
var $R97 = (0, import_lib3.$R)(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
@@ -7986,9 +8143,7 @@ ${js}`
|
|
|
7986
8143
|
var close = $5;
|
|
7987
8144
|
if (skipImplicitArguments(args))
|
|
7988
8145
|
return $skip;
|
|
7989
|
-
|
|
7990
|
-
if (last?.token === "," && last.implicit)
|
|
7991
|
-
args = args.slice(0, -1);
|
|
8146
|
+
args = stripTrailingImplicitComma(args);
|
|
7992
8147
|
return {
|
|
7993
8148
|
type: "Call",
|
|
7994
8149
|
args,
|
|
@@ -8166,24 +8321,43 @@ ${js}`
|
|
|
8166
8321
|
var args = $2;
|
|
8167
8322
|
var comma = $3;
|
|
8168
8323
|
let [arg0, ...rest] = args;
|
|
8169
|
-
arg0 =
|
|
8324
|
+
arg0 = prepend(indent, arg0);
|
|
8170
8325
|
return [arg0, ...rest, comma];
|
|
8171
8326
|
});
|
|
8172
8327
|
function NestedArgument(ctx, state2) {
|
|
8173
8328
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedArgument", NestedArgument$0);
|
|
8174
8329
|
}
|
|
8175
|
-
var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(
|
|
8330
|
+
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) {
|
|
8176
8331
|
return [$1, ...$2.flat()];
|
|
8177
8332
|
});
|
|
8178
8333
|
function SingleLineArgumentExpressions(ctx, state2) {
|
|
8179
8334
|
return (0, import_lib3.$EVENT)(ctx, state2, "SingleLineArgumentExpressions", SingleLineArgumentExpressions$0);
|
|
8180
8335
|
}
|
|
8181
|
-
var
|
|
8336
|
+
var WArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), function($skip, $loc, $0, $1, $2) {
|
|
8337
|
+
return prepend($1, $2);
|
|
8338
|
+
});
|
|
8339
|
+
function WArgumentPart(ctx, state2) {
|
|
8340
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
|
|
8341
|
+
}
|
|
8342
|
+
var ArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
|
|
8343
|
+
var spread = $1;
|
|
8344
|
+
var expression = $2;
|
|
8345
|
+
return {
|
|
8346
|
+
type: "Argument",
|
|
8347
|
+
children: $0,
|
|
8348
|
+
expression,
|
|
8349
|
+
spread
|
|
8350
|
+
};
|
|
8351
|
+
});
|
|
8182
8352
|
var ArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(ExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8353
|
+
var expression = $1;
|
|
8354
|
+
var spread = $2;
|
|
8355
|
+
return {
|
|
8356
|
+
type: "Argument",
|
|
8357
|
+
children: spread ? [spread, expression] : [expression],
|
|
8358
|
+
expression,
|
|
8359
|
+
spread
|
|
8360
|
+
};
|
|
8187
8361
|
});
|
|
8188
8362
|
var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
|
|
8189
8363
|
function ArgumentPart(ctx, state2) {
|
|
@@ -8271,17 +8445,18 @@ ${js}`
|
|
|
8271
8445
|
function RHS(ctx, state2) {
|
|
8272
8446
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "RHS", RHS$$);
|
|
8273
8447
|
}
|
|
8274
|
-
var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
|
|
8448
|
+
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) {
|
|
8449
|
+
var pre = $2;
|
|
8450
|
+
var args = $3;
|
|
8451
|
+
var post = $4;
|
|
8452
|
+
return processUnaryNestedExpression(pre, args, post) ?? $skip;
|
|
8453
|
+
});
|
|
8454
|
+
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) {
|
|
8275
8455
|
var pre = $1;
|
|
8276
8456
|
var exp = $2;
|
|
8277
8457
|
var post = $3;
|
|
8278
8458
|
return processUnaryExpression(pre, exp, post);
|
|
8279
8459
|
});
|
|
8280
|
-
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) {
|
|
8281
|
-
var ws = $3;
|
|
8282
|
-
var exp = $4;
|
|
8283
|
-
return processCoffeeDo(ws, exp);
|
|
8284
|
-
});
|
|
8285
8460
|
var UnaryExpression$$ = [UnaryExpression$0, UnaryExpression$1];
|
|
8286
8461
|
function UnaryExpression(ctx, state2) {
|
|
8287
8462
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryExpression", UnaryExpression$$);
|
|
@@ -8295,14 +8470,35 @@ ${js}`
|
|
|
8295
8470
|
function UnaryWithoutParenthesizedAssignment(ctx, state2) {
|
|
8296
8471
|
return (0, import_lib3.$EVENT)(ctx, state2, "UnaryWithoutParenthesizedAssignment", UnaryWithoutParenthesizedAssignment$0);
|
|
8297
8472
|
}
|
|
8298
|
-
var UnaryBody$0 =
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
var UnaryBody
|
|
8473
|
+
var UnaryBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, MaybeNestedCoffeeDoBody), function($skip, $loc, $0, $1, $2, $3) {
|
|
8474
|
+
var body = $3;
|
|
8475
|
+
return processCoffeeDo(...body);
|
|
8476
|
+
});
|
|
8477
|
+
var UnaryBody$1 = ParenthesizedAssignment;
|
|
8478
|
+
var UnaryBody$2 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
8479
|
+
var UnaryBody$3 = UpdateExpression;
|
|
8480
|
+
var UnaryBody$4 = NestedNonAssignmentExtendedExpression;
|
|
8481
|
+
var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3, UnaryBody$4];
|
|
8303
8482
|
function UnaryBody(ctx, state2) {
|
|
8304
8483
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
|
|
8305
8484
|
}
|
|
8485
|
+
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) {
|
|
8486
|
+
if (!$2)
|
|
8487
|
+
return $skip;
|
|
8488
|
+
return $2;
|
|
8489
|
+
});
|
|
8490
|
+
var MaybeNestedCoffeeDoBody$1 = (0, import_lib3.$S)((0, import_lib3.$E)(_), CoffeeDoBody);
|
|
8491
|
+
var MaybeNestedCoffeeDoBody$$ = [MaybeNestedCoffeeDoBody$0, MaybeNestedCoffeeDoBody$1];
|
|
8492
|
+
function MaybeNestedCoffeeDoBody(ctx, state2) {
|
|
8493
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedCoffeeDoBody", MaybeNestedCoffeeDoBody$$);
|
|
8494
|
+
}
|
|
8495
|
+
var CoffeeDoBody$0 = ArrowFunction;
|
|
8496
|
+
var CoffeeDoBody$1 = (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol)));
|
|
8497
|
+
var CoffeeDoBody$2 = ExtendedExpression;
|
|
8498
|
+
var CoffeeDoBody$$ = [CoffeeDoBody$0, CoffeeDoBody$1, CoffeeDoBody$2];
|
|
8499
|
+
function CoffeeDoBody(ctx, state2) {
|
|
8500
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeDoBody", CoffeeDoBody$$);
|
|
8501
|
+
}
|
|
8306
8502
|
var UnaryWithoutParenthesizedAssignmentBody$0 = UpdateExpression;
|
|
8307
8503
|
var UnaryWithoutParenthesizedAssignmentBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
8308
8504
|
var UnaryWithoutParenthesizedAssignmentBody$2 = NestedNonAssignmentExtendedExpression;
|
|
@@ -8501,7 +8697,7 @@ ${js}`
|
|
|
8501
8697
|
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) {
|
|
8502
8698
|
var async = $1;
|
|
8503
8699
|
var parameters = $2;
|
|
8504
|
-
var
|
|
8700
|
+
var returnType = $3;
|
|
8505
8701
|
var arrow = $4;
|
|
8506
8702
|
var expOrBlock = $5;
|
|
8507
8703
|
if (!async)
|
|
@@ -8512,13 +8708,13 @@ ${js}`
|
|
|
8512
8708
|
modifier: {
|
|
8513
8709
|
async: !!async.length
|
|
8514
8710
|
},
|
|
8515
|
-
returnType
|
|
8711
|
+
returnType
|
|
8516
8712
|
},
|
|
8517
8713
|
parameters,
|
|
8518
|
-
returnType
|
|
8714
|
+
returnType,
|
|
8519
8715
|
async,
|
|
8520
8716
|
block: expOrBlock,
|
|
8521
|
-
children: [async, parameters,
|
|
8717
|
+
children: [async, parameters, returnType, arrow, expOrBlock]
|
|
8522
8718
|
};
|
|
8523
8719
|
});
|
|
8524
8720
|
var ArrowFunction$$ = [ArrowFunction$0, ArrowFunction$1];
|
|
@@ -10250,7 +10446,7 @@ ${js}`
|
|
|
10250
10446
|
var wid = $4;
|
|
10251
10447
|
var w = $5;
|
|
10252
10448
|
var parameters = $6;
|
|
10253
|
-
var
|
|
10449
|
+
var returnType = $7;
|
|
10254
10450
|
if (!async)
|
|
10255
10451
|
async = [];
|
|
10256
10452
|
if (!generator)
|
|
@@ -10261,7 +10457,7 @@ ${js}`
|
|
|
10261
10457
|
id,
|
|
10262
10458
|
name: id?.name,
|
|
10263
10459
|
parameters,
|
|
10264
|
-
returnType
|
|
10460
|
+
returnType,
|
|
10265
10461
|
async,
|
|
10266
10462
|
generator,
|
|
10267
10463
|
modifier: {
|
|
@@ -10269,7 +10465,7 @@ ${js}`
|
|
|
10269
10465
|
generator: !!generator.length
|
|
10270
10466
|
},
|
|
10271
10467
|
block: null,
|
|
10272
|
-
children: !parameters.implicit ? [async, func, generator, wid, w, parameters,
|
|
10468
|
+
children: !parameters.implicit ? [async, func, generator, wid, w, parameters, returnType] : [async, func, generator, wid, parameters, w, returnType]
|
|
10273
10469
|
// move whitespace w to after implicit () in parameters
|
|
10274
10470
|
};
|
|
10275
10471
|
});
|
|
@@ -10468,7 +10664,7 @@ ${js}`
|
|
|
10468
10664
|
var behavior = $7;
|
|
10469
10665
|
var w2 = $8;
|
|
10470
10666
|
var parameters = $9;
|
|
10471
|
-
var
|
|
10667
|
+
var returnType = $10;
|
|
10472
10668
|
if (!async)
|
|
10473
10669
|
async = [];
|
|
10474
10670
|
if (!generator)
|
|
@@ -10483,7 +10679,7 @@ ${js}`
|
|
|
10483
10679
|
id,
|
|
10484
10680
|
name: id.name,
|
|
10485
10681
|
parameters,
|
|
10486
|
-
returnType
|
|
10682
|
+
returnType,
|
|
10487
10683
|
async,
|
|
10488
10684
|
generator,
|
|
10489
10685
|
modifier: {
|
|
@@ -10491,7 +10687,7 @@ ${js}`
|
|
|
10491
10687
|
generator: !!generator.length
|
|
10492
10688
|
},
|
|
10493
10689
|
block: null,
|
|
10494
|
-
children: [async, func, generator, w1, id, w2, parameters,
|
|
10690
|
+
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
10495
10691
|
behavior
|
|
10496
10692
|
};
|
|
10497
10693
|
});
|
|
@@ -10538,7 +10734,7 @@ ${js}`
|
|
|
10538
10734
|
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) {
|
|
10539
10735
|
var async = $1;
|
|
10540
10736
|
var parameters = $2;
|
|
10541
|
-
var
|
|
10737
|
+
var returnType = $3;
|
|
10542
10738
|
var arrow = $5;
|
|
10543
10739
|
var block = $6;
|
|
10544
10740
|
if (!async)
|
|
@@ -10548,7 +10744,7 @@ ${js}`
|
|
|
10548
10744
|
type: "FunctionExpression",
|
|
10549
10745
|
id: void 0,
|
|
10550
10746
|
parameters,
|
|
10551
|
-
returnType
|
|
10747
|
+
returnType,
|
|
10552
10748
|
async,
|
|
10553
10749
|
generator,
|
|
10554
10750
|
block,
|
|
@@ -10560,14 +10756,14 @@ ${js}`
|
|
|
10560
10756
|
async: !!async.length,
|
|
10561
10757
|
generator: !!generator.length
|
|
10562
10758
|
},
|
|
10563
|
-
returnType
|
|
10759
|
+
returnType
|
|
10564
10760
|
},
|
|
10565
10761
|
children: [
|
|
10566
10762
|
async,
|
|
10567
10763
|
{ $loc: arrow.$loc, token: "function" },
|
|
10568
10764
|
generator,
|
|
10569
10765
|
parameters,
|
|
10570
|
-
|
|
10766
|
+
returnType,
|
|
10571
10767
|
block
|
|
10572
10768
|
]
|
|
10573
10769
|
};
|
|
@@ -11264,6 +11460,7 @@ ${js}`
|
|
|
11264
11460
|
return {
|
|
11265
11461
|
type: "SpreadElement",
|
|
11266
11462
|
children: [ws, dots, exp],
|
|
11463
|
+
expression: exp,
|
|
11267
11464
|
names: exp.names
|
|
11268
11465
|
};
|
|
11269
11466
|
});
|
|
@@ -11275,12 +11472,14 @@ ${js}`
|
|
|
11275
11472
|
return {
|
|
11276
11473
|
type: "ArrayElement",
|
|
11277
11474
|
children: [exp],
|
|
11475
|
+
expression: exp,
|
|
11278
11476
|
names: exp.names
|
|
11279
11477
|
};
|
|
11280
11478
|
} else {
|
|
11281
11479
|
return {
|
|
11282
11480
|
type: "SpreadElement",
|
|
11283
11481
|
children: [...spread, exp],
|
|
11482
|
+
expression: exp,
|
|
11284
11483
|
names: exp.names
|
|
11285
11484
|
};
|
|
11286
11485
|
}
|
|
@@ -11324,9 +11523,9 @@ ${js}`
|
|
|
11324
11523
|
// replace first space with bracket
|
|
11325
11524
|
...content[1].flat()
|
|
11326
11525
|
];
|
|
11327
|
-
|
|
11526
|
+
let last = content[content.length - 1];
|
|
11328
11527
|
if (last.children?.at(-1)?.implicit) {
|
|
11329
|
-
|
|
11528
|
+
content[content.length - 1] = last = { ...last, children: last.children.slice(0, -1) };
|
|
11330
11529
|
}
|
|
11331
11530
|
return {
|
|
11332
11531
|
type: "ArrayExpression",
|
|
@@ -12732,6 +12931,14 @@ ${js}`
|
|
|
12732
12931
|
kind = { ...kind, token: "if" };
|
|
12733
12932
|
condition = negateCondition(condition);
|
|
12734
12933
|
}
|
|
12934
|
+
if (block.bare && e) {
|
|
12935
|
+
const semicolon = ";";
|
|
12936
|
+
block = {
|
|
12937
|
+
...block,
|
|
12938
|
+
semicolon,
|
|
12939
|
+
children: [...block.children, semicolon]
|
|
12940
|
+
};
|
|
12941
|
+
}
|
|
12735
12942
|
return {
|
|
12736
12943
|
type: "IfStatement",
|
|
12737
12944
|
children: [kind, ws, condition, block, e],
|
|
@@ -12745,6 +12952,13 @@ ${js}`
|
|
|
12745
12952
|
var clause = $1;
|
|
12746
12953
|
var block = $2;
|
|
12747
12954
|
var e = $3;
|
|
12955
|
+
if (block.bare && e) {
|
|
12956
|
+
block = {
|
|
12957
|
+
...block,
|
|
12958
|
+
semicolon: ";",
|
|
12959
|
+
children: [...block.children, ";"]
|
|
12960
|
+
};
|
|
12961
|
+
}
|
|
12748
12962
|
return {
|
|
12749
12963
|
type: "IfStatement",
|
|
12750
12964
|
children: [...clause.children, block, e],
|
|
@@ -13201,14 +13415,14 @@ ${js}`
|
|
|
13201
13415
|
}
|
|
13202
13416
|
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) {
|
|
13203
13417
|
var pattern = $1;
|
|
13204
|
-
var
|
|
13205
|
-
|
|
13418
|
+
var typeSuffix = $2;
|
|
13419
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
13206
13420
|
return {
|
|
13207
13421
|
type: "Binding",
|
|
13208
|
-
children: [pattern,
|
|
13422
|
+
children: [pattern, typeSuffix],
|
|
13209
13423
|
names: pattern.names,
|
|
13210
13424
|
pattern,
|
|
13211
|
-
|
|
13425
|
+
typeSuffix,
|
|
13212
13426
|
splices: [],
|
|
13213
13427
|
thisAssignments: []
|
|
13214
13428
|
};
|
|
@@ -13845,6 +14059,16 @@ ${js}`
|
|
|
13845
14059
|
function MaybeNestedExtendedExpression(ctx, state2) {
|
|
13846
14060
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedExtendedExpression", MaybeNestedExtendedExpression$$);
|
|
13847
14061
|
}
|
|
14062
|
+
var NestedExtendedExpression$0 = NestedBulletedArray;
|
|
14063
|
+
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) {
|
|
14064
|
+
if ($3)
|
|
14065
|
+
return $3;
|
|
14066
|
+
return $skip;
|
|
14067
|
+
});
|
|
14068
|
+
var NestedExtendedExpression$$ = [NestedExtendedExpression$0, NestedExtendedExpression$1];
|
|
14069
|
+
function NestedExtendedExpression(ctx, state2) {
|
|
14070
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedExtendedExpression", NestedExtendedExpression$$);
|
|
14071
|
+
}
|
|
13848
14072
|
var MaybeParenNestedExtendedExpression$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ExtendedExpression), function(value) {
|
|
13849
14073
|
return value[1];
|
|
13850
14074
|
});
|
|
@@ -14339,16 +14563,16 @@ ${js}`
|
|
|
14339
14563
|
}
|
|
14340
14564
|
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) {
|
|
14341
14565
|
var pattern = $1;
|
|
14342
|
-
var
|
|
14566
|
+
var typeSuffix = $2;
|
|
14343
14567
|
var initializer = $3;
|
|
14344
14568
|
const [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
14345
|
-
|
|
14569
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
14346
14570
|
return {
|
|
14347
14571
|
type: "Binding",
|
|
14348
|
-
children: [pattern,
|
|
14572
|
+
children: [pattern, typeSuffix, initializer],
|
|
14349
14573
|
names: pattern.names,
|
|
14350
14574
|
pattern,
|
|
14351
|
-
|
|
14575
|
+
typeSuffix,
|
|
14352
14576
|
initializer,
|
|
14353
14577
|
splices: splices.map((s) => [",", s]),
|
|
14354
14578
|
thisAssignments: thisAssignments.map((s) => ["", s, ";"])
|
|
@@ -14356,14 +14580,14 @@ ${js}`
|
|
|
14356
14580
|
});
|
|
14357
14581
|
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) {
|
|
14358
14582
|
var pattern = $1;
|
|
14359
|
-
var
|
|
14583
|
+
var typeSuffix = $2;
|
|
14360
14584
|
var initializer = $3;
|
|
14361
14585
|
return {
|
|
14362
14586
|
type: "Binding",
|
|
14363
14587
|
children: $0,
|
|
14364
14588
|
names: pattern.names,
|
|
14365
14589
|
pattern,
|
|
14366
|
-
|
|
14590
|
+
typeSuffix,
|
|
14367
14591
|
initializer,
|
|
14368
14592
|
splices: [],
|
|
14369
14593
|
thisAssignments: []
|
|
@@ -16308,14 +16532,14 @@ ${js}`
|
|
|
16308
16532
|
}
|
|
16309
16533
|
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) {
|
|
16310
16534
|
var pattern = $1;
|
|
16311
|
-
var
|
|
16535
|
+
var typeSuffix = $2;
|
|
16312
16536
|
var initializer = $3;
|
|
16313
16537
|
return {
|
|
16314
16538
|
type: "Binding",
|
|
16315
16539
|
children: $0,
|
|
16316
16540
|
names: pattern.names,
|
|
16317
16541
|
pattern,
|
|
16318
|
-
|
|
16542
|
+
typeSuffix,
|
|
16319
16543
|
initializer,
|
|
16320
16544
|
splices: [],
|
|
16321
16545
|
thisAssignments: []
|
|
@@ -16421,7 +16645,17 @@ ${js}`
|
|
|
16421
16645
|
function OptionalEquals(ctx, state2) {
|
|
16422
16646
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "OptionalEquals", OptionalEquals$$);
|
|
16423
16647
|
}
|
|
16424
|
-
var TypeLexicalDeclaration$0 =
|
|
16648
|
+
var TypeLexicalDeclaration$0 = TypeLetOrConstDeclaration;
|
|
16649
|
+
var TypeLexicalDeclaration$1 = (0, import_lib3.$S)(__, EnumDeclaration);
|
|
16650
|
+
var TypeLexicalDeclaration$2 = ClassSignature;
|
|
16651
|
+
var TypeLexicalDeclaration$3 = (0, import_lib3.$S)(Namespace, (0, import_lib3.$E)(_), IdentifierName, DeclareBlock);
|
|
16652
|
+
var TypeLexicalDeclaration$4 = (0, import_lib3.$S)(Module, _, StringLiteral, (0, import_lib3.$E)(DeclareBlock));
|
|
16653
|
+
var TypeLexicalDeclaration$5 = (0, import_lib3.$S)(Global, (0, import_lib3.$E)(DeclareBlock));
|
|
16654
|
+
var TypeLexicalDeclaration$$ = [TypeLexicalDeclaration$0, TypeLexicalDeclaration$1, TypeLexicalDeclaration$2, TypeLexicalDeclaration$3, TypeLexicalDeclaration$4, TypeLexicalDeclaration$5];
|
|
16655
|
+
function TypeLexicalDeclaration(ctx, state2) {
|
|
16656
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeLexicalDeclaration", TypeLexicalDeclaration$$);
|
|
16657
|
+
}
|
|
16658
|
+
var TypeLetOrConstDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(__, LetOrConstOrVar, TypeDeclarationBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, __, TypeDeclarationBinding))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
16425
16659
|
var first = $3;
|
|
16426
16660
|
var rest = $4;
|
|
16427
16661
|
const names = first.names.concat(...rest.map((b) => b[2].names));
|
|
@@ -16432,14 +16666,8 @@ ${js}`
|
|
|
16432
16666
|
names
|
|
16433
16667
|
};
|
|
16434
16668
|
});
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
var TypeLexicalDeclaration$3 = (0, import_lib3.$S)(Namespace, (0, import_lib3.$E)(_), IdentifierName, DeclareBlock);
|
|
16438
|
-
var TypeLexicalDeclaration$4 = (0, import_lib3.$S)(Module, _, StringLiteral, (0, import_lib3.$E)(DeclareBlock));
|
|
16439
|
-
var TypeLexicalDeclaration$5 = (0, import_lib3.$S)(Global, (0, import_lib3.$E)(DeclareBlock));
|
|
16440
|
-
var TypeLexicalDeclaration$$ = [TypeLexicalDeclaration$0, TypeLexicalDeclaration$1, TypeLexicalDeclaration$2, TypeLexicalDeclaration$3, TypeLexicalDeclaration$4, TypeLexicalDeclaration$5];
|
|
16441
|
-
function TypeLexicalDeclaration(ctx, state2) {
|
|
16442
|
-
return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeLexicalDeclaration", TypeLexicalDeclaration$$);
|
|
16669
|
+
function TypeLetOrConstDeclaration(ctx, state2) {
|
|
16670
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "TypeLetOrConstDeclaration", TypeLetOrConstDeclaration$0);
|
|
16443
16671
|
}
|
|
16444
16672
|
var TypeDeclarationBinding$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) {
|
|
16445
16673
|
return {
|
|
@@ -16583,13 +16811,14 @@ ${js}`
|
|
|
16583
16811
|
function NestedDeclareElement(ctx, state2) {
|
|
16584
16812
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedDeclareElement", NestedDeclareElement$0);
|
|
16585
16813
|
}
|
|
16586
|
-
var DeclareElement$0 = (0, import_lib3.$
|
|
16814
|
+
var DeclareElement$0 = (0, import_lib3.$S)((0, import_lib3.$E)(Decorators), Export, __, Default, __, (0, import_lib3.$C)(Identifier, ClassSignature, InterfaceDeclaration));
|
|
16815
|
+
var DeclareElement$1 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)(Decorators), (0, import_lib3.$E)((0, import_lib3.$S)(Export, (0, import_lib3.$E)(_))), TypeLexicalDeclaration), function(value) {
|
|
16587
16816
|
return { "ts": true, "children": value };
|
|
16588
16817
|
});
|
|
16589
|
-
var DeclareElement$
|
|
16818
|
+
var DeclareElement$2 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Export, (0, import_lib3.$E)(_))), TypeDeclarationRest), function(value) {
|
|
16590
16819
|
return { "ts": true, "children": value };
|
|
16591
16820
|
});
|
|
16592
|
-
var DeclareElement$$ = [DeclareElement$0, DeclareElement$1];
|
|
16821
|
+
var DeclareElement$$ = [DeclareElement$0, DeclareElement$1, DeclareElement$2];
|
|
16593
16822
|
function DeclareElement(ctx, state2) {
|
|
16594
16823
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "DeclareElement", DeclareElement$$);
|
|
16595
16824
|
}
|
|
@@ -16859,7 +17088,7 @@ ${js}`
|
|
|
16859
17088
|
if (!prefix.length && !suffix.length)
|
|
16860
17089
|
return t;
|
|
16861
17090
|
return {
|
|
16862
|
-
type: "
|
|
17091
|
+
type: "TypeUnary",
|
|
16863
17092
|
prefix,
|
|
16864
17093
|
suffix,
|
|
16865
17094
|
t,
|
|
@@ -16872,7 +17101,8 @@ ${js}`
|
|
|
16872
17101
|
}
|
|
16873
17102
|
var TypeUnarySuffix$0 = TypeIndexedAccess;
|
|
16874
17103
|
var TypeUnarySuffix$1 = QuestionMark;
|
|
16875
|
-
var TypeUnarySuffix
|
|
17104
|
+
var TypeUnarySuffix$2 = NonNullAssertion;
|
|
17105
|
+
var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1, TypeUnarySuffix$2];
|
|
16876
17106
|
function TypeUnarySuffix(ctx, state2) {
|
|
16877
17107
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeUnarySuffix", TypeUnarySuffix$$);
|
|
16878
17108
|
}
|
|
@@ -16937,14 +17167,14 @@ ${js}`
|
|
|
16937
17167
|
var TypePrimary$7 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), TypeLiteral), function($skip, $loc, $0, $1, $2) {
|
|
16938
17168
|
var t = $2;
|
|
16939
17169
|
return {
|
|
16940
|
-
type: "
|
|
17170
|
+
type: "TypeLiteral",
|
|
16941
17171
|
t,
|
|
16942
17172
|
children: $0
|
|
16943
17173
|
};
|
|
16944
17174
|
});
|
|
16945
17175
|
var TypePrimary$8 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), UnknownAlias), function($skip, $loc, $0, $1, $2) {
|
|
16946
17176
|
return {
|
|
16947
|
-
type: "
|
|
17177
|
+
type: "TypeIdentifier",
|
|
16948
17178
|
children: $0,
|
|
16949
17179
|
raw: $2.token,
|
|
16950
17180
|
args: void 0
|
|
@@ -16953,7 +17183,7 @@ ${js}`
|
|
|
16953
17183
|
var TypePrimary$9 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), Identifier, (0, import_lib3.$Q)((0, import_lib3.$S)(Dot, IdentifierName)), (0, import_lib3.$E)((0, import_lib3.$C)(TypeArguments, ImplicitTypeArguments))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
16954
17184
|
var args = $4;
|
|
16955
17185
|
return {
|
|
16956
|
-
type: "
|
|
17186
|
+
type: "TypeIdentifier",
|
|
16957
17187
|
children: $0,
|
|
16958
17188
|
raw: [$2.name, ...$3.map(([dot, id]) => dot.token + id.name)].join(""),
|
|
16959
17189
|
args
|
|
@@ -16963,7 +17193,7 @@ ${js}`
|
|
|
16963
17193
|
if (!$4)
|
|
16964
17194
|
return $skip;
|
|
16965
17195
|
return {
|
|
16966
|
-
type: "
|
|
17196
|
+
type: "TypeParenthesized",
|
|
16967
17197
|
children: [$1, $2, $4, $6, $7]
|
|
16968
17198
|
// omit AllowAll/RestoreAll
|
|
16969
17199
|
};
|
|
@@ -17329,16 +17559,20 @@ ${js}`
|
|
|
17329
17559
|
}
|
|
17330
17560
|
var TypeFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Abstract, (0, import_lib3.$E)(_))), (0, import_lib3.$E)((0, import_lib3.$S)(New, (0, import_lib3.$E)(_))), Parameters, __, TypeArrowFunction, (0, import_lib3.$E)(ReturnType)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
17331
17561
|
var type = $6;
|
|
17332
|
-
const
|
|
17562
|
+
const children = [...$0];
|
|
17333
17563
|
if ($1 && !$2) {
|
|
17334
|
-
|
|
17564
|
+
children[1] = {
|
|
17335
17565
|
type: "Error",
|
|
17336
17566
|
message: "abstract function types must be constructors (abstract new)"
|
|
17337
17567
|
};
|
|
17338
17568
|
}
|
|
17339
17569
|
if (!type)
|
|
17340
|
-
|
|
17341
|
-
return
|
|
17570
|
+
children.push("void");
|
|
17571
|
+
return {
|
|
17572
|
+
type: "TypeFunction",
|
|
17573
|
+
children,
|
|
17574
|
+
ts: true
|
|
17575
|
+
};
|
|
17342
17576
|
});
|
|
17343
17577
|
function TypeFunction(ctx, state2) {
|
|
17344
17578
|
return (0, import_lib3.$EVENT)(ctx, state2, "TypeFunction", TypeFunction$0);
|
|
@@ -17520,17 +17754,22 @@ ${js}`
|
|
|
17520
17754
|
function CivetPrologueContent(ctx, state2) {
|
|
17521
17755
|
return (0, import_lib3.$EVENT)(ctx, state2, "CivetPrologueContent", CivetPrologueContent$0);
|
|
17522
17756
|
}
|
|
17523
|
-
var CivetOption$0 = (0, import_lib3.$TR)((0, import_lib3.$EXPECT)($R94, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([
|
|
17757
|
+
var CivetOption$0 = (0, import_lib3.$TR)((0, import_lib3.$EXPECT)($R94, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
17524
17758
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
17525
17759
|
if (l)
|
|
17526
17760
|
return l.toUpperCase();
|
|
17527
17761
|
return "";
|
|
17528
17762
|
});
|
|
17529
17763
|
let value = $3 ? $4 : $1 === "-" ? false : true;
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
value
|
|
17764
|
+
switch (optionName) {
|
|
17765
|
+
case "tab":
|
|
17766
|
+
value = parseFloat(value);
|
|
17767
|
+
if (isNaN(value))
|
|
17768
|
+
value = 0;
|
|
17769
|
+
break;
|
|
17770
|
+
case "globals":
|
|
17771
|
+
value = value.split(",").filter(Boolean);
|
|
17772
|
+
break;
|
|
17534
17773
|
}
|
|
17535
17774
|
return [optionName, value];
|
|
17536
17775
|
});
|
|
@@ -17883,6 +18122,7 @@ ${js}`
|
|
|
17883
18122
|
coffeeOf: false,
|
|
17884
18123
|
coffeePrototype: false,
|
|
17885
18124
|
defaultElement: "div",
|
|
18125
|
+
globals: [],
|
|
17886
18126
|
implicitReturns: true,
|
|
17887
18127
|
jsxCode: false,
|
|
17888
18128
|
objectIs: false,
|