@danielx/civet 0.7.34 → 0.7.36
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 +13 -0
- package/dist/browser.js +566 -278
- package/dist/main.js +566 -278
- package/dist/main.mjs +566 -278
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -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"
|
|
@@ -2259,6 +2297,9 @@ function expressionizeIteration(exp) {
|
|
|
2259
2297
|
function skipImplicitArguments(args) {
|
|
2260
2298
|
if (args.length === 1) {
|
|
2261
2299
|
let arg0 = args[0];
|
|
2300
|
+
if (arg0.type === "Argument") {
|
|
2301
|
+
arg0 = arg0.expression;
|
|
2302
|
+
}
|
|
2262
2303
|
if (arg0.type === "StatementExpression") {
|
|
2263
2304
|
arg0 = arg0.statement;
|
|
2264
2305
|
}
|
|
@@ -2301,12 +2342,13 @@ function processCoffeeDo(ws, expression) {
|
|
|
2301
2342
|
expression = {
|
|
2302
2343
|
...expression,
|
|
2303
2344
|
parameters: newParameters,
|
|
2304
|
-
children: expression.children.map(($
|
|
2345
|
+
children: expression.children.map(($6) => $6 === parameters ? newParameters : $6)
|
|
2305
2346
|
};
|
|
2306
2347
|
}
|
|
2307
2348
|
return {
|
|
2308
2349
|
type: "CallExpression",
|
|
2309
2350
|
children: [
|
|
2351
|
+
ws,
|
|
2310
2352
|
makeLeftHandSideExpression(expression),
|
|
2311
2353
|
{
|
|
2312
2354
|
type: "Call",
|
|
@@ -2322,7 +2364,7 @@ function makeAmpersandFunction(rhs) {
|
|
|
2322
2364
|
ref = makeRef("$");
|
|
2323
2365
|
inplacePrepend(ref, body);
|
|
2324
2366
|
}
|
|
2325
|
-
if (startsWithPredicate(body, ($
|
|
2367
|
+
if (startsWithPredicate(body, ($7) => $7.type === "ObjectExpression")) {
|
|
2326
2368
|
body = makeLeftHandSideExpression(body);
|
|
2327
2369
|
}
|
|
2328
2370
|
const parameters = makeNode({
|
|
@@ -3512,7 +3554,7 @@ function aliasBinding(p, ref) {
|
|
|
3512
3554
|
function len2(arr, length) {
|
|
3513
3555
|
return arr.length === length;
|
|
3514
3556
|
}
|
|
3515
|
-
function processAssignmentDeclaration(decl, pattern,
|
|
3557
|
+
function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e) {
|
|
3516
3558
|
decl = {
|
|
3517
3559
|
...decl,
|
|
3518
3560
|
$loc: {
|
|
@@ -3524,7 +3566,7 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
|
|
|
3524
3566
|
splices = splices.map((s) => [", ", s]);
|
|
3525
3567
|
const thisAssignments = assignments.map((a) => ["", a, ";"]);
|
|
3526
3568
|
if ("typeSuffix" in pattern) {
|
|
3527
|
-
|
|
3569
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
3528
3570
|
}
|
|
3529
3571
|
const initializer = makeNode({
|
|
3530
3572
|
type: "Initializer",
|
|
@@ -3536,9 +3578,9 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
|
|
|
3536
3578
|
pattern,
|
|
3537
3579
|
initializer,
|
|
3538
3580
|
splices,
|
|
3539
|
-
|
|
3581
|
+
typeSuffix,
|
|
3540
3582
|
thisAssignments,
|
|
3541
|
-
children: [pattern,
|
|
3583
|
+
children: [pattern, typeSuffix, initializer]
|
|
3542
3584
|
});
|
|
3543
3585
|
const children = [decl, binding];
|
|
3544
3586
|
return makeNode({
|
|
@@ -3555,9 +3597,9 @@ function processDeclarations(statements) {
|
|
|
3555
3597
|
gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
|
|
3556
3598
|
const { bindings } = statement;
|
|
3557
3599
|
return bindings?.forEach((binding) => {
|
|
3558
|
-
const
|
|
3559
|
-
if (
|
|
3560
|
-
convertOptionalType(
|
|
3600
|
+
const { typeSuffix } = binding;
|
|
3601
|
+
if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
|
|
3602
|
+
convertOptionalType(typeSuffix);
|
|
3561
3603
|
}
|
|
3562
3604
|
const { initializer } = binding;
|
|
3563
3605
|
if (initializer) {
|
|
@@ -3638,8 +3680,8 @@ function processDeclarationCondition(condition, rootCondition, parent) {
|
|
|
3638
3680
|
}
|
|
3639
3681
|
const { decl, bindings } = condition.declaration;
|
|
3640
3682
|
const binding = bindings[0];
|
|
3641
|
-
let { pattern,
|
|
3642
|
-
const nullCheck =
|
|
3683
|
+
let { pattern, typeSuffix, initializer } = binding;
|
|
3684
|
+
const nullCheck = typeSuffix?.optional && !typeSuffix.t && !typeSuffix.nonnull;
|
|
3643
3685
|
if (!(initializer != null)) {
|
|
3644
3686
|
condition.children = [
|
|
3645
3687
|
{
|
|
@@ -3677,14 +3719,14 @@ function processDeclarationCondition(condition, rootCondition, parent) {
|
|
|
3677
3719
|
if (nullCheck) {
|
|
3678
3720
|
children.unshift("(");
|
|
3679
3721
|
children.push(") != null");
|
|
3680
|
-
|
|
3722
|
+
typeSuffix = void 0;
|
|
3681
3723
|
}
|
|
3682
3724
|
Object.assign(condition, {
|
|
3683
3725
|
type: "AssignmentExpression",
|
|
3684
3726
|
children,
|
|
3685
3727
|
hoistDec: !simple ? {
|
|
3686
3728
|
type: "Declaration",
|
|
3687
|
-
children: ["let ", ref,
|
|
3729
|
+
children: ["let ", ref, typeSuffix],
|
|
3688
3730
|
names: []
|
|
3689
3731
|
} : void 0,
|
|
3690
3732
|
pattern,
|
|
@@ -3692,7 +3734,7 @@ function processDeclarationCondition(condition, rootCondition, parent) {
|
|
|
3692
3734
|
});
|
|
3693
3735
|
}
|
|
3694
3736
|
updateParentPointers(condition, parent);
|
|
3695
|
-
rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl,
|
|
3737
|
+
rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, typeSuffix);
|
|
3696
3738
|
}
|
|
3697
3739
|
function processDeclarationConditions(node) {
|
|
3698
3740
|
gatherRecursiveAll(
|
|
@@ -4070,6 +4112,10 @@ function processUnaryExpression(pre, exp, post) {
|
|
|
4070
4112
|
};
|
|
4071
4113
|
pre = pre.slice(0, -1);
|
|
4072
4114
|
} else {
|
|
4115
|
+
let m;
|
|
4116
|
+
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)) {
|
|
4117
|
+
exp = parenthesizeExpression(exp);
|
|
4118
|
+
}
|
|
4073
4119
|
exp = {
|
|
4074
4120
|
type: "AwaitExpression",
|
|
4075
4121
|
children: [...last.children, exp]
|
|
@@ -4085,6 +4131,77 @@ function processUnaryExpression(pre, exp, post) {
|
|
|
4085
4131
|
children: [...pre, exp, post]
|
|
4086
4132
|
};
|
|
4087
4133
|
}
|
|
4134
|
+
function processUnaryNestedExpression(pre, args, post) {
|
|
4135
|
+
const isArray = args.type === "ArrayExpression";
|
|
4136
|
+
if (!isArray) {
|
|
4137
|
+
args = stripTrailingImplicitComma(args);
|
|
4138
|
+
}
|
|
4139
|
+
if (isArray || args.length > 2) {
|
|
4140
|
+
const last = pre[pre.length - 1];
|
|
4141
|
+
if (!(typeof last === "object" && last != null && "type" in last && last.type === "Await")) {
|
|
4142
|
+
return;
|
|
4143
|
+
}
|
|
4144
|
+
if (last.op) {
|
|
4145
|
+
if (!isArray) {
|
|
4146
|
+
args = {
|
|
4147
|
+
type: "ArrayExpression",
|
|
4148
|
+
children: ["[", args, "]"]
|
|
4149
|
+
};
|
|
4150
|
+
}
|
|
4151
|
+
} else {
|
|
4152
|
+
pre.pop();
|
|
4153
|
+
if (!isArray) {
|
|
4154
|
+
args = args;
|
|
4155
|
+
args = {
|
|
4156
|
+
type: "ArrayExpression",
|
|
4157
|
+
children: [
|
|
4158
|
+
"[",
|
|
4159
|
+
...(() => {
|
|
4160
|
+
const results = [];
|
|
4161
|
+
for (let i = 0, len3 = args.length; i < len3; i++) {
|
|
4162
|
+
const arg = args[i];
|
|
4163
|
+
if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "Argument") {
|
|
4164
|
+
const expression = processUnaryExpression([last], arg.expression);
|
|
4165
|
+
results.push({
|
|
4166
|
+
...arg,
|
|
4167
|
+
expression,
|
|
4168
|
+
children: arg.children.map(($) => $ === arg.expression ? expression : $)
|
|
4169
|
+
});
|
|
4170
|
+
} else {
|
|
4171
|
+
results.push(arg);
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
return results;
|
|
4175
|
+
})(),
|
|
4176
|
+
"]"
|
|
4177
|
+
]
|
|
4178
|
+
};
|
|
4179
|
+
} else {
|
|
4180
|
+
args = trimFirstSpace(args);
|
|
4181
|
+
args = {
|
|
4182
|
+
...args,
|
|
4183
|
+
children: args.children.map(
|
|
4184
|
+
(arg) => {
|
|
4185
|
+
if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "ArrayElement" && "expression" in arg && "children" in arg) {
|
|
4186
|
+
const { type, expression: exp, children } = arg;
|
|
4187
|
+
let expression = processUnaryExpression([last], trimFirstSpace(exp));
|
|
4188
|
+
expression = prepend(getTrimmingSpace(exp), expression);
|
|
4189
|
+
return {
|
|
4190
|
+
...arg,
|
|
4191
|
+
expression,
|
|
4192
|
+
children: children.map(($1) => $1 === exp ? expression : $1)
|
|
4193
|
+
};
|
|
4194
|
+
} else {
|
|
4195
|
+
return arg;
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
)
|
|
4199
|
+
};
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
return processUnaryExpression(pre, args, post);
|
|
4204
|
+
}
|
|
4088
4205
|
|
|
4089
4206
|
// source/parser/pipe.civet
|
|
4090
4207
|
function constructInvocation(fn, arg) {
|
|
@@ -4122,36 +4239,31 @@ function constructInvocation(fn, arg) {
|
|
|
4122
4239
|
};
|
|
4123
4240
|
}
|
|
4124
4241
|
function constructPipeStep(fn, arg, returning) {
|
|
4242
|
+
if (!returning) {
|
|
4243
|
+
returning = null;
|
|
4244
|
+
}
|
|
4125
4245
|
let children = [[fn.leadingComment, fn.expr, fn.trailingComment].map(skipIfOnlyWS), " ", arg];
|
|
4126
4246
|
switch (fn.expr.token) {
|
|
4127
|
-
case "
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
}
|
|
4132
|
-
if (returning) {
|
|
4133
|
-
return [
|
|
4134
|
-
children,
|
|
4135
|
-
returning
|
|
4136
|
-
];
|
|
4137
|
-
}
|
|
4247
|
+
case "await": {
|
|
4248
|
+
children = processUnaryExpression([fn.expr], arg, void 0);
|
|
4249
|
+
}
|
|
4250
|
+
case "yield": {
|
|
4138
4251
|
return [
|
|
4139
4252
|
children,
|
|
4140
|
-
|
|
4253
|
+
returning
|
|
4141
4254
|
];
|
|
4142
|
-
|
|
4255
|
+
}
|
|
4256
|
+
case "return": {
|
|
4143
4257
|
return [{
|
|
4144
4258
|
type: "ReturnStatement",
|
|
4145
4259
|
children
|
|
4146
4260
|
}, null];
|
|
4261
|
+
}
|
|
4147
4262
|
}
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
];
|
|
4153
|
-
}
|
|
4154
|
-
return [constructInvocation(fn, arg), null];
|
|
4263
|
+
return [
|
|
4264
|
+
constructInvocation(fn, arg),
|
|
4265
|
+
returning
|
|
4266
|
+
];
|
|
4155
4267
|
}
|
|
4156
4268
|
function processPipelineExpressions(statements) {
|
|
4157
4269
|
gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
|
|
@@ -4408,7 +4520,29 @@ function processForInOf($0, getRef) {
|
|
|
4408
4520
|
message: "'own' is only meaningful in for..in loops"
|
|
4409
4521
|
};
|
|
4410
4522
|
}
|
|
4411
|
-
|
|
4523
|
+
const { binding } = declaration;
|
|
4524
|
+
let pattern = binding?.pattern;
|
|
4525
|
+
if (binding?.typeSuffix || inOf.token === "in" && declaration2 && pattern.type !== "Identifier") {
|
|
4526
|
+
const itemRef = makeRef(inOf.token === "in" ? "key" : "item");
|
|
4527
|
+
blockPrefix.push(["", {
|
|
4528
|
+
type: "Declaration",
|
|
4529
|
+
children: [declaration, " = ", itemRef],
|
|
4530
|
+
names: declaration.names
|
|
4531
|
+
}, ";"]);
|
|
4532
|
+
pattern = itemRef;
|
|
4533
|
+
declaration = {
|
|
4534
|
+
type: "ForDeclaration",
|
|
4535
|
+
binding: {
|
|
4536
|
+
type: "Binding",
|
|
4537
|
+
pattern,
|
|
4538
|
+
children: [pattern],
|
|
4539
|
+
names: []
|
|
4540
|
+
},
|
|
4541
|
+
children: ["const ", itemRef],
|
|
4542
|
+
names: []
|
|
4543
|
+
};
|
|
4544
|
+
}
|
|
4545
|
+
if (!(declaration2 || own)) {
|
|
4412
4546
|
return {
|
|
4413
4547
|
declaration,
|
|
4414
4548
|
blockPrefix,
|
|
@@ -4447,29 +4581,6 @@ function processForInOf($0, getRef) {
|
|
|
4447
4581
|
children: [" ", expRef2, " =", exp]
|
|
4448
4582
|
};
|
|
4449
4583
|
}
|
|
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
4584
|
if (own) {
|
|
4474
4585
|
const hasPropRef = getRef("hasProp");
|
|
4475
4586
|
blockPrefix.push(["", ["if (!", hasPropRef, "(", insertTrimmingSpace(expRef2, ""), ", ", insertTrimmingSpace(pattern, ""), ")) continue"], ";"]);
|
|
@@ -6151,44 +6262,82 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
6151
6262
|
}
|
|
6152
6263
|
function processTypes(node) {
|
|
6153
6264
|
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) {
|
|
6265
|
+
if (!unary.suffix.length) {
|
|
6162
6266
|
return;
|
|
6163
6267
|
}
|
|
6164
|
-
let
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
unary.suffix.
|
|
6173
|
-
|
|
6268
|
+
let ref10;
|
|
6269
|
+
let m3;
|
|
6270
|
+
if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
|
|
6271
|
+
const { token } = m3;
|
|
6272
|
+
let last;
|
|
6273
|
+
let count = 0;
|
|
6274
|
+
let ref11;
|
|
6275
|
+
while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
|
|
6276
|
+
last = unary.suffix.pop();
|
|
6277
|
+
count++;
|
|
6174
6278
|
}
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6279
|
+
let ref12;
|
|
6280
|
+
while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
|
|
6281
|
+
unary.suffix.pop();
|
|
6282
|
+
}
|
|
6283
|
+
let ref13;
|
|
6284
|
+
if (unary.suffix.length || unary.prefix.length)
|
|
6285
|
+
ref13 = unary;
|
|
6286
|
+
else
|
|
6287
|
+
ref13 = unary.t;
|
|
6288
|
+
const t = ref13;
|
|
6289
|
+
if (unary.parent?.type === "TypeTuple") {
|
|
6290
|
+
if (count === 1) {
|
|
6291
|
+
unary.suffix.push(last);
|
|
6292
|
+
return;
|
|
6293
|
+
}
|
|
6294
|
+
replaceNode(unary, [
|
|
6187
6295
|
getTrimmingSpace(unary),
|
|
6188
6296
|
"(",
|
|
6189
6297
|
parenthesizeType(trimFirstSpace(t)),
|
|
6190
|
-
|
|
6191
|
-
|
|
6298
|
+
" | null)",
|
|
6299
|
+
last
|
|
6300
|
+
]);
|
|
6301
|
+
} else {
|
|
6302
|
+
replaceNode(unary, {
|
|
6303
|
+
type: "TypeParenthesized",
|
|
6304
|
+
ts: true,
|
|
6305
|
+
children: [
|
|
6306
|
+
getTrimmingSpace(unary),
|
|
6307
|
+
"(",
|
|
6308
|
+
parenthesizeType(trimFirstSpace(t)),
|
|
6309
|
+
count === 1 ? " | undefined" : " | undefined | null",
|
|
6310
|
+
")"
|
|
6311
|
+
]
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
} else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
|
|
6315
|
+
const { type } = m3;
|
|
6316
|
+
let ref14;
|
|
6317
|
+
while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
|
|
6318
|
+
unary.suffix.pop();
|
|
6319
|
+
}
|
|
6320
|
+
let ref15;
|
|
6321
|
+
while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
|
|
6322
|
+
unary.suffix.pop();
|
|
6323
|
+
}
|
|
6324
|
+
const t = trimFirstSpace(
|
|
6325
|
+
unary.suffix.length || unary.prefix.length ? unary : unary.t
|
|
6326
|
+
);
|
|
6327
|
+
const args = {
|
|
6328
|
+
type: "TypeArguments",
|
|
6329
|
+
ts: true,
|
|
6330
|
+
types: [t],
|
|
6331
|
+
children: ["<", t, ">"]
|
|
6332
|
+
};
|
|
6333
|
+
replaceNode(unary, {
|
|
6334
|
+
type: "TypeIdentifier",
|
|
6335
|
+
raw: "NonNullable",
|
|
6336
|
+
args,
|
|
6337
|
+
children: [
|
|
6338
|
+
getTrimmingSpace(unary),
|
|
6339
|
+
"NonNullable",
|
|
6340
|
+
args
|
|
6192
6341
|
]
|
|
6193
6342
|
});
|
|
6194
6343
|
}
|
|
@@ -6198,11 +6347,11 @@ function processStatementExpressions(statements) {
|
|
|
6198
6347
|
gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
|
|
6199
6348
|
const exp = _exp;
|
|
6200
6349
|
const { statement } = exp;
|
|
6201
|
-
let
|
|
6350
|
+
let ref16;
|
|
6202
6351
|
switch (statement.type) {
|
|
6203
6352
|
case "IfStatement": {
|
|
6204
|
-
if (
|
|
6205
|
-
const expression =
|
|
6353
|
+
if (ref16 = expressionizeIfStatement(statement)) {
|
|
6354
|
+
const expression = ref16;
|
|
6206
6355
|
return replaceNode(statement, expression, exp);
|
|
6207
6356
|
} else {
|
|
6208
6357
|
return replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -6265,6 +6414,7 @@ function processProgram(root) {
|
|
|
6265
6414
|
assert.equal(state2.forbidBracedApplication.length, 1, "forbidBracedApplication");
|
|
6266
6415
|
assert.equal(state2.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
|
|
6267
6416
|
assert.equal(state2.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
|
|
6417
|
+
assert.equal(state2.forbidNestedBinaryOp.length, 1, "forbidNestedBinaryOp");
|
|
6268
6418
|
assert.equal(state2.forbidNewlineBinaryOp.length, 1, "forbidNewlineBinaryOp");
|
|
6269
6419
|
assert.equal(state2.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
|
|
6270
6420
|
assert.equal(state2.JSXTagStack.length, 1, "JSXTagStack");
|
|
@@ -6348,10 +6498,10 @@ function processPlaceholders(statements) {
|
|
|
6348
6498
|
if (type === "IfStatement") {
|
|
6349
6499
|
liftedIfs.add(ancestor2);
|
|
6350
6500
|
}
|
|
6351
|
-
let m3;
|
|
6352
6501
|
let m4;
|
|
6502
|
+
let m5;
|
|
6353
6503
|
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
6354
|
-
type === "BlockStatement" && !((
|
|
6504
|
+
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
6505
|
type === "Initializer" || // Right-hand side of assignment
|
|
6356
6506
|
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
6357
6507
|
}));
|
|
@@ -6430,14 +6580,18 @@ function processPlaceholders(statements) {
|
|
|
6430
6580
|
for (let i4 = 0, len3 = placeholders.length; i4 < len3; i4++) {
|
|
6431
6581
|
const placeholder = placeholders[i4];
|
|
6432
6582
|
typeSuffix ??= placeholder.typeSuffix;
|
|
6433
|
-
let
|
|
6434
|
-
replaceNode((
|
|
6583
|
+
let ref17;
|
|
6584
|
+
replaceNode((ref17 = placeholder.children)[ref17.length - 1], ref);
|
|
6435
6585
|
}
|
|
6436
6586
|
const { parent } = ancestor;
|
|
6437
6587
|
const body = maybeUnwrap(ancestor);
|
|
6438
6588
|
let fnExp = makeAmpersandFunction({ ref, typeSuffix, body });
|
|
6439
6589
|
let outer;
|
|
6440
6590
|
switch (parent?.type) {
|
|
6591
|
+
case "Argument": {
|
|
6592
|
+
outer = ancestor === parent.expression;
|
|
6593
|
+
break;
|
|
6594
|
+
}
|
|
6441
6595
|
case "Call": {
|
|
6442
6596
|
outer = ancestor === parent.args[findChildIndex(parent.args, ancestor)];
|
|
6443
6597
|
break;
|
|
@@ -6448,16 +6602,16 @@ function processPlaceholders(statements) {
|
|
|
6448
6602
|
}
|
|
6449
6603
|
case "PipelineExpression": {
|
|
6450
6604
|
const i = findChildIndex(parent, ancestor);
|
|
6451
|
-
let
|
|
6605
|
+
let ref18;
|
|
6452
6606
|
if (i === 1) {
|
|
6453
|
-
|
|
6607
|
+
ref18 = ancestor === parent.children[i];
|
|
6454
6608
|
} else if (i === 2) {
|
|
6455
|
-
|
|
6609
|
+
ref18 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
6456
6610
|
} else {
|
|
6457
|
-
|
|
6611
|
+
ref18 = void 0;
|
|
6458
6612
|
}
|
|
6459
6613
|
;
|
|
6460
|
-
outer =
|
|
6614
|
+
outer = ref18;
|
|
6461
6615
|
break;
|
|
6462
6616
|
}
|
|
6463
6617
|
case "AssignmentExpression":
|
|
@@ -6472,9 +6626,9 @@ function processPlaceholders(statements) {
|
|
|
6472
6626
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
6473
6627
|
}
|
|
6474
6628
|
replaceNode(ancestor, fnExp, parent);
|
|
6475
|
-
let
|
|
6476
|
-
if (
|
|
6477
|
-
const ws =
|
|
6629
|
+
let ref19;
|
|
6630
|
+
if (ref19 = getTrimmingSpace(body)) {
|
|
6631
|
+
const ws = ref19;
|
|
6478
6632
|
inplaceInsertTrimmingSpace(body, "");
|
|
6479
6633
|
inplacePrepend(ws, fnExp);
|
|
6480
6634
|
}
|
|
@@ -6519,8 +6673,8 @@ function reorderBindingRestProperty(props) {
|
|
|
6519
6673
|
}
|
|
6520
6674
|
];
|
|
6521
6675
|
}
|
|
6522
|
-
let
|
|
6523
|
-
if (Array.isArray(rest.delim) && (
|
|
6676
|
+
let ref20;
|
|
6677
|
+
if (Array.isArray(rest.delim) && (ref20 = rest.delim)[ref20.length - 1]?.token === ",") {
|
|
6524
6678
|
rest.delim = rest.delim.slice(0, -1);
|
|
6525
6679
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
6526
6680
|
}
|
|
@@ -6681,13 +6835,13 @@ var grammar = {
|
|
|
6681
6835
|
AllowedTrailingCallExpressions,
|
|
6682
6836
|
CommaDelimiter,
|
|
6683
6837
|
ArgumentList,
|
|
6684
|
-
NonPipelineArgumentList,
|
|
6685
6838
|
NestedArgumentList,
|
|
6686
6839
|
NestedArgument,
|
|
6687
6840
|
SingleLineArgumentExpressions,
|
|
6841
|
+
WArgumentPart,
|
|
6688
6842
|
ArgumentPart,
|
|
6689
|
-
NonPipelineArgumentPart,
|
|
6690
6843
|
BinaryOpExpression,
|
|
6844
|
+
BinaryOpNotDedented,
|
|
6691
6845
|
BinaryOpRHS,
|
|
6692
6846
|
IsLike,
|
|
6693
6847
|
WRHS,
|
|
@@ -6696,6 +6850,8 @@ var grammar = {
|
|
|
6696
6850
|
UnaryExpression,
|
|
6697
6851
|
UnaryWithoutParenthesizedAssignment,
|
|
6698
6852
|
UnaryBody,
|
|
6853
|
+
MaybeNestedCoffeeDoBody,
|
|
6854
|
+
CoffeeDoBody,
|
|
6699
6855
|
UnaryWithoutParenthesizedAssignmentBody,
|
|
6700
6856
|
ParenthesizedAssignment,
|
|
6701
6857
|
UnaryPostfix,
|
|
@@ -6718,12 +6874,15 @@ var grammar = {
|
|
|
6718
6874
|
FatArrowToken,
|
|
6719
6875
|
TrailingDeclaration,
|
|
6720
6876
|
TrailingPipe,
|
|
6877
|
+
TrailingPostfix,
|
|
6721
6878
|
FatArrowBody,
|
|
6722
6879
|
ConditionalExpression,
|
|
6723
6880
|
TernaryRest,
|
|
6724
6881
|
NestedTernaryRest,
|
|
6725
6882
|
ShortCircuitExpression,
|
|
6726
6883
|
PipelineExpression,
|
|
6884
|
+
PipelineExpressionBody,
|
|
6885
|
+
PipelineExpressionBodySameLine,
|
|
6727
6886
|
PipelineHeadItem,
|
|
6728
6887
|
PipelineTailItem,
|
|
6729
6888
|
PrimaryExpression,
|
|
@@ -6933,7 +7092,6 @@ var grammar = {
|
|
|
6933
7092
|
PostfixedNoCommaStatement,
|
|
6934
7093
|
PostfixedExpression,
|
|
6935
7094
|
PostfixedCommaExpression,
|
|
6936
|
-
NonPipelinePostfixedExpression,
|
|
6937
7095
|
PostfixStatement,
|
|
6938
7096
|
_PostfixStatement,
|
|
6939
7097
|
Statement,
|
|
@@ -7011,10 +7169,18 @@ var grammar = {
|
|
|
7011
7169
|
AllowTrailingMemberProperty,
|
|
7012
7170
|
RestoreTrailingMemberProperty,
|
|
7013
7171
|
TrailingMemberPropertyAllowed,
|
|
7172
|
+
AllowNestedBinaryOp,
|
|
7173
|
+
ForbidNestedBinaryOp,
|
|
7174
|
+
RestoreNestedBinaryOp,
|
|
7175
|
+
NestedBinaryOpAllowed,
|
|
7014
7176
|
AllowNewlineBinaryOp,
|
|
7015
7177
|
ForbidNewlineBinaryOp,
|
|
7016
7178
|
RestoreNewlineBinaryOp,
|
|
7017
7179
|
NewlineBinaryOpAllowed,
|
|
7180
|
+
AllowPipeline,
|
|
7181
|
+
ForbidPipeline,
|
|
7182
|
+
RestorePipeline,
|
|
7183
|
+
PipelineAllowed,
|
|
7018
7184
|
AllowAll,
|
|
7019
7185
|
RestoreAll,
|
|
7020
7186
|
CommaExpressionStatement,
|
|
@@ -7028,6 +7194,7 @@ var grammar = {
|
|
|
7028
7194
|
MaybeNestedNonPipelineExtendedExpression,
|
|
7029
7195
|
MaybeNestedPostfixedExpression,
|
|
7030
7196
|
MaybeNestedExtendedExpression,
|
|
7197
|
+
NestedExtendedExpression,
|
|
7031
7198
|
MaybeParenNestedExtendedExpression,
|
|
7032
7199
|
ImportDeclaration,
|
|
7033
7200
|
ImpliedImport,
|
|
@@ -7962,16 +8129,16 @@ var Arguments$$ = [Arguments$0, Arguments$1];
|
|
|
7962
8129
|
function Arguments(ctx, state2) {
|
|
7963
8130
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "Arguments", Arguments$$);
|
|
7964
8131
|
}
|
|
7965
|
-
var ImplicitArguments$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ApplicationStart, InsertOpenParen, (0, import_lib3.$E)(Trimmed_),
|
|
8132
|
+
var ImplicitArguments$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ApplicationStart, InsertOpenParen, (0, import_lib3.$E)(Trimmed_), ForbidNestedBinaryOp, ForbidPipeline, (0, import_lib3.$E)(ArgumentList), RestorePipeline, RestoreNestedBinaryOp, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
7966
8133
|
var open = $2;
|
|
7967
8134
|
var ws = $3;
|
|
7968
|
-
var args = $
|
|
7969
|
-
var close = $
|
|
8135
|
+
var args = $6;
|
|
8136
|
+
var close = $9;
|
|
8137
|
+
if (!args)
|
|
8138
|
+
return $skip;
|
|
7970
8139
|
if (skipImplicitArguments(args))
|
|
7971
8140
|
return $skip;
|
|
7972
|
-
|
|
7973
|
-
if (last?.token === "," && last.implicit)
|
|
7974
|
-
args = args.slice(0, -1);
|
|
8141
|
+
args = stripTrailingImplicitComma(args);
|
|
7975
8142
|
return {
|
|
7976
8143
|
type: "Call",
|
|
7977
8144
|
args,
|
|
@@ -8081,33 +8248,7 @@ var CommaDelimiter$0 = (0, import_lib3.$S)(NotDedented, Comma);
|
|
|
8081
8248
|
function CommaDelimiter(ctx, state2) {
|
|
8082
8249
|
return (0, import_lib3.$EVENT)(ctx, state2, "CommaDelimiter", CommaDelimiter$0);
|
|
8083
8250
|
}
|
|
8084
|
-
var ArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$N)(EOS), (0, import_lib3.$E)(_), ArgumentPart)), (0, import_lib3.$P)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2, $3) {
|
|
8085
|
-
return [
|
|
8086
|
-
$1,
|
|
8087
|
-
...$2.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
|
|
8088
|
-
...$3.flatMap(
|
|
8089
|
-
([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
|
|
8090
|
-
)
|
|
8091
|
-
];
|
|
8092
|
-
});
|
|
8093
|
-
var ArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(NestedBulletedArray), function($skip, $loc, $0, $1) {
|
|
8094
|
-
return [trimFirstSpace($1)];
|
|
8095
|
-
});
|
|
8096
|
-
var ArgumentList$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
|
|
8097
|
-
return [trimFirstSpace($1)];
|
|
8098
|
-
});
|
|
8099
|
-
var ArgumentList$3 = NestedArgumentList;
|
|
8100
|
-
var ArgumentList$4 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$E)(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
8101
|
-
return [
|
|
8102
|
-
prepend($1, $2),
|
|
8103
|
-
...$3.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
|
|
8104
|
-
];
|
|
8105
|
-
});
|
|
8106
|
-
var ArgumentList$$ = [ArgumentList$0, ArgumentList$1, ArgumentList$2, ArgumentList$3, ArgumentList$4];
|
|
8107
|
-
function ArgumentList(ctx, state2) {
|
|
8108
|
-
return (0, import_lib3.$EVENT_C)(ctx, state2, "ArgumentList", ArgumentList$$);
|
|
8109
|
-
}
|
|
8110
|
-
var NonPipelineArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), NonPipelineArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$N)(EOS), (0, import_lib3.$E)(_), NonPipelineArgumentPart)), (0, import_lib3.$P)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8251
|
+
var ArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$N)(EOS), (0, import_lib3.$E)(_), ArgumentPart)), (0, import_lib3.$P)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8111
8252
|
return [
|
|
8112
8253
|
$2,
|
|
8113
8254
|
...$3.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
|
|
@@ -8116,7 +8257,7 @@ var NonPipelineArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, imp
|
|
|
8116
8257
|
)
|
|
8117
8258
|
];
|
|
8118
8259
|
});
|
|
8119
|
-
var
|
|
8260
|
+
var ArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral), (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2) {
|
|
8120
8261
|
return [
|
|
8121
8262
|
trimFirstSpace($1),
|
|
8122
8263
|
...$2.flatMap(
|
|
@@ -8124,19 +8265,19 @@ var NonPipelineArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, imp
|
|
|
8124
8265
|
)
|
|
8125
8266
|
];
|
|
8126
8267
|
});
|
|
8127
|
-
var
|
|
8128
|
-
var
|
|
8268
|
+
var ArgumentList$2 = NestedArgumentList;
|
|
8269
|
+
var ArgumentList$3 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$E)(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
8129
8270
|
return [
|
|
8130
|
-
$1,
|
|
8131
|
-
...$
|
|
8271
|
+
prepend($1, $2),
|
|
8272
|
+
...$3.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
|
|
8132
8273
|
];
|
|
8133
8274
|
});
|
|
8134
|
-
var
|
|
8135
|
-
function
|
|
8136
|
-
return (0, import_lib3.$EVENT_C)(ctx, state2, "
|
|
8275
|
+
var ArgumentList$$ = [ArgumentList$0, ArgumentList$1, ArgumentList$2, ArgumentList$3];
|
|
8276
|
+
function ArgumentList(ctx, state2) {
|
|
8277
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "ArgumentList", ArgumentList$$);
|
|
8137
8278
|
}
|
|
8138
|
-
var NestedArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$Q)(NestedArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
8139
|
-
var args = $
|
|
8279
|
+
var NestedArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, AllowPipeline, (0, import_lib3.$Q)(NestedArgument), RestorePipeline, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8280
|
+
var args = $3;
|
|
8140
8281
|
if (!args.length)
|
|
8141
8282
|
return $skip;
|
|
8142
8283
|
return args.flat();
|
|
@@ -8149,40 +8290,48 @@ var NestedArgument$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, SingleLi
|
|
|
8149
8290
|
var args = $2;
|
|
8150
8291
|
var comma = $3;
|
|
8151
8292
|
let [arg0, ...rest] = args;
|
|
8152
|
-
arg0 =
|
|
8293
|
+
arg0 = prepend(indent, arg0);
|
|
8153
8294
|
return [arg0, ...rest, comma];
|
|
8154
8295
|
});
|
|
8155
8296
|
function NestedArgument(ctx, state2) {
|
|
8156
8297
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedArgument", NestedArgument$0);
|
|
8157
8298
|
}
|
|
8158
|
-
var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(
|
|
8299
|
+
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
8300
|
return [$1, ...$2.flat()];
|
|
8160
8301
|
});
|
|
8161
8302
|
function SingleLineArgumentExpressions(ctx, state2) {
|
|
8162
8303
|
return (0, import_lib3.$EVENT)(ctx, state2, "SingleLineArgumentExpressions", SingleLineArgumentExpressions$0);
|
|
8163
8304
|
}
|
|
8164
|
-
var
|
|
8305
|
+
var WArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), function($skip, $loc, $0, $1, $2) {
|
|
8306
|
+
return prepend($1, $2);
|
|
8307
|
+
});
|
|
8308
|
+
function WArgumentPart(ctx, state2) {
|
|
8309
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
|
|
8310
|
+
}
|
|
8311
|
+
var ArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
|
|
8312
|
+
var spread = $1;
|
|
8313
|
+
var expression = $2;
|
|
8314
|
+
return {
|
|
8315
|
+
type: "Argument",
|
|
8316
|
+
children: $0,
|
|
8317
|
+
expression,
|
|
8318
|
+
spread
|
|
8319
|
+
};
|
|
8320
|
+
});
|
|
8165
8321
|
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
|
-
|
|
8322
|
+
var expression = $1;
|
|
8323
|
+
var spread = $2;
|
|
8324
|
+
return {
|
|
8325
|
+
type: "Argument",
|
|
8326
|
+
children: spread ? [spread, expression] : [expression],
|
|
8327
|
+
expression,
|
|
8328
|
+
spread
|
|
8329
|
+
};
|
|
8170
8330
|
});
|
|
8171
8331
|
var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
|
|
8172
8332
|
function ArgumentPart(ctx, state2) {
|
|
8173
8333
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
|
|
8174
8334
|
}
|
|
8175
|
-
var NonPipelineArgumentPart$0 = (0, import_lib3.$S)(DotDotDot, NonPipelineExtendedExpression);
|
|
8176
|
-
var NonPipelineArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(NonPipelineExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
8177
|
-
if ($2) {
|
|
8178
|
-
return [$2, $1];
|
|
8179
|
-
}
|
|
8180
|
-
return $1;
|
|
8181
|
-
});
|
|
8182
|
-
var NonPipelineArgumentPart$$ = [NonPipelineArgumentPart$0, NonPipelineArgumentPart$1];
|
|
8183
|
-
function NonPipelineArgumentPart(ctx, state2) {
|
|
8184
|
-
return (0, import_lib3.$EVENT_C)(ctx, state2, "NonPipelineArgumentPart", NonPipelineArgumentPart$$);
|
|
8185
|
-
}
|
|
8186
8335
|
var BinaryOpExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(UnaryExpression, (0, import_lib3.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
|
|
8187
8336
|
if (!$2.length)
|
|
8188
8337
|
return $1;
|
|
@@ -8191,7 +8340,13 @@ var BinaryOpExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(UnaryExpress
|
|
|
8191
8340
|
function BinaryOpExpression(ctx, state2) {
|
|
8192
8341
|
return (0, import_lib3.$EVENT)(ctx, state2, "BinaryOpExpression", BinaryOpExpression$0);
|
|
8193
8342
|
}
|
|
8194
|
-
var
|
|
8343
|
+
var BinaryOpNotDedented$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$C)(NestedBinaryOpAllowed, (0, import_lib3.$N)(Nested)), NotDedented), function(value) {
|
|
8344
|
+
return value[1];
|
|
8345
|
+
});
|
|
8346
|
+
function BinaryOpNotDedented(ctx, state2) {
|
|
8347
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "BinaryOpNotDedented", BinaryOpNotDedented$0);
|
|
8348
|
+
}
|
|
8349
|
+
var BinaryOpRHS$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BinaryOpNotDedented, IsLike, (0, import_lib3.$E)(_), PatternExpressionList), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8195
8350
|
var ws1 = $1;
|
|
8196
8351
|
var op = $2;
|
|
8197
8352
|
var ws2 = $3;
|
|
@@ -8254,17 +8409,18 @@ var RHS$$ = [RHS$0, RHS$1];
|
|
|
8254
8409
|
function RHS(ctx, state2) {
|
|
8255
8410
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "RHS", RHS$$);
|
|
8256
8411
|
}
|
|
8257
|
-
var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
|
|
8412
|
+
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) {
|
|
8413
|
+
var pre = $2;
|
|
8414
|
+
var args = $3;
|
|
8415
|
+
var post = $4;
|
|
8416
|
+
return processUnaryNestedExpression(pre, args, post) ?? $skip;
|
|
8417
|
+
});
|
|
8418
|
+
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
8419
|
var pre = $1;
|
|
8259
8420
|
var exp = $2;
|
|
8260
8421
|
var post = $3;
|
|
8261
8422
|
return processUnaryExpression(pre, exp, post);
|
|
8262
8423
|
});
|
|
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
8424
|
var UnaryExpression$$ = [UnaryExpression$0, UnaryExpression$1];
|
|
8269
8425
|
function UnaryExpression(ctx, state2) {
|
|
8270
8426
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryExpression", UnaryExpression$$);
|
|
@@ -8278,14 +8434,35 @@ var UnaryWithoutParenthesizedAssignment$0 = (0, import_lib3.$TS)((0, import_lib3
|
|
|
8278
8434
|
function UnaryWithoutParenthesizedAssignment(ctx, state2) {
|
|
8279
8435
|
return (0, import_lib3.$EVENT)(ctx, state2, "UnaryWithoutParenthesizedAssignment", UnaryWithoutParenthesizedAssignment$0);
|
|
8280
8436
|
}
|
|
8281
|
-
var UnaryBody$0 =
|
|
8282
|
-
var
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
var UnaryBody
|
|
8437
|
+
var UnaryBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, MaybeNestedCoffeeDoBody), function($skip, $loc, $0, $1, $2, $3) {
|
|
8438
|
+
var body = $3;
|
|
8439
|
+
return processCoffeeDo(...body);
|
|
8440
|
+
});
|
|
8441
|
+
var UnaryBody$1 = ParenthesizedAssignment;
|
|
8442
|
+
var UnaryBody$2 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
8443
|
+
var UnaryBody$3 = UpdateExpression;
|
|
8444
|
+
var UnaryBody$4 = NestedNonAssignmentExtendedExpression;
|
|
8445
|
+
var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3, UnaryBody$4];
|
|
8286
8446
|
function UnaryBody(ctx, state2) {
|
|
8287
8447
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
|
|
8288
8448
|
}
|
|
8449
|
+
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) {
|
|
8450
|
+
if (!$2)
|
|
8451
|
+
return $skip;
|
|
8452
|
+
return $2;
|
|
8453
|
+
});
|
|
8454
|
+
var MaybeNestedCoffeeDoBody$1 = (0, import_lib3.$S)((0, import_lib3.$E)(_), CoffeeDoBody);
|
|
8455
|
+
var MaybeNestedCoffeeDoBody$$ = [MaybeNestedCoffeeDoBody$0, MaybeNestedCoffeeDoBody$1];
|
|
8456
|
+
function MaybeNestedCoffeeDoBody(ctx, state2) {
|
|
8457
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedCoffeeDoBody", MaybeNestedCoffeeDoBody$$);
|
|
8458
|
+
}
|
|
8459
|
+
var CoffeeDoBody$0 = ArrowFunction;
|
|
8460
|
+
var CoffeeDoBody$1 = (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol)));
|
|
8461
|
+
var CoffeeDoBody$2 = ExtendedExpression;
|
|
8462
|
+
var CoffeeDoBody$$ = [CoffeeDoBody$0, CoffeeDoBody$1, CoffeeDoBody$2];
|
|
8463
|
+
function CoffeeDoBody(ctx, state2) {
|
|
8464
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeDoBody", CoffeeDoBody$$);
|
|
8465
|
+
}
|
|
8289
8466
|
var UnaryWithoutParenthesizedAssignmentBody$0 = UpdateExpression;
|
|
8290
8467
|
var UnaryWithoutParenthesizedAssignmentBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
8291
8468
|
var UnaryWithoutParenthesizedAssignmentBody$2 = NestedNonAssignmentExtendedExpression;
|
|
@@ -8484,7 +8661,7 @@ var ArrowFunction$0 = ThinArrowFunction;
|
|
|
8484
8661
|
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
8662
|
var async = $1;
|
|
8486
8663
|
var parameters = $2;
|
|
8487
|
-
var
|
|
8664
|
+
var returnType = $3;
|
|
8488
8665
|
var arrow = $4;
|
|
8489
8666
|
var expOrBlock = $5;
|
|
8490
8667
|
if (!async)
|
|
@@ -8495,13 +8672,13 @@ var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
|
|
|
8495
8672
|
modifier: {
|
|
8496
8673
|
async: !!async.length
|
|
8497
8674
|
},
|
|
8498
|
-
returnType
|
|
8675
|
+
returnType
|
|
8499
8676
|
},
|
|
8500
8677
|
parameters,
|
|
8501
|
-
returnType
|
|
8678
|
+
returnType,
|
|
8502
8679
|
async,
|
|
8503
8680
|
block: expOrBlock,
|
|
8504
|
-
children: [async, parameters,
|
|
8681
|
+
children: [async, parameters, returnType, arrow, expOrBlock]
|
|
8505
8682
|
};
|
|
8506
8683
|
});
|
|
8507
8684
|
var ArrowFunction$$ = [ArrowFunction$0, ArrowFunction$1];
|
|
@@ -8532,7 +8709,11 @@ var TrailingPipe$0 = (0, import_lib3.$S)((0, import_lib3.$E)(_), Pipe);
|
|
|
8532
8709
|
function TrailingPipe(ctx, state2) {
|
|
8533
8710
|
return (0, import_lib3.$EVENT)(ctx, state2, "TrailingPipe", TrailingPipe$0);
|
|
8534
8711
|
}
|
|
8535
|
-
var
|
|
8712
|
+
var TrailingPostfix$0 = (0, import_lib3.$S)((0, import_lib3.$E)(_), PostfixStatement);
|
|
8713
|
+
function TrailingPostfix(ctx, state2) {
|
|
8714
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "TrailingPostfix", TrailingPostfix$0);
|
|
8715
|
+
}
|
|
8716
|
+
var FatArrowBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), (0, import_lib3.$N)((0, import_lib3.$S)((0, import_lib3.$E)(_), ExpressionizedStatement)), NonPipelineExtendedExpression, (0, import_lib3.$N)(TrailingDeclaration), (0, import_lib3.$N)(TrailingPipe), (0, import_lib3.$N)(TrailingPostfix), (0, import_lib3.$N)(SemicolonDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
8536
8717
|
var exp = $3;
|
|
8537
8718
|
if (exp.type === "ObjectExpression") {
|
|
8538
8719
|
exp = makeLeftHandSideExpression(exp);
|
|
@@ -8582,10 +8763,10 @@ var ShortCircuitExpression$0 = BinaryOpExpression;
|
|
|
8582
8763
|
function ShortCircuitExpression(ctx, state2) {
|
|
8583
8764
|
return (0, import_lib3.$EVENT)(ctx, state2, "ShortCircuitExpression", ShortCircuitExpression$0);
|
|
8584
8765
|
}
|
|
8585
|
-
var PipelineExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), PipelineHeadItem,
|
|
8586
|
-
var ws = $
|
|
8587
|
-
var head = $
|
|
8588
|
-
var body = $
|
|
8766
|
+
var PipelineExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PipelineAllowed, (0, import_lib3.$E)(_), PipelineHeadItem, PipelineExpressionBody), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8767
|
+
var ws = $2;
|
|
8768
|
+
var head = $3;
|
|
8769
|
+
var body = $4;
|
|
8589
8770
|
if (head.type === "ArrowFunction" && head.ampersandBlock) {
|
|
8590
8771
|
const expressions = [{
|
|
8591
8772
|
type: "PipelineExpression",
|
|
@@ -8607,6 +8788,25 @@ var PipelineExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_l
|
|
|
8607
8788
|
function PipelineExpression(ctx, state2) {
|
|
8608
8789
|
return (0, import_lib3.$EVENT)(ctx, state2, "PipelineExpression", PipelineExpression$0);
|
|
8609
8790
|
}
|
|
8791
|
+
var PipelineExpressionBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PipelineExpressionBodySameLine, PushIndent, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)(Nested, Pipe, __, PipelineTailItem), PipelineExpressionBodySameLine)), PopIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8792
|
+
var first = $1;
|
|
8793
|
+
var rest = $3;
|
|
8794
|
+
if (!rest.length)
|
|
8795
|
+
return $skip;
|
|
8796
|
+
return [
|
|
8797
|
+
...first,
|
|
8798
|
+
...rest.map(([nested, line]) => [nested, ...line]).flat()
|
|
8799
|
+
];
|
|
8800
|
+
});
|
|
8801
|
+
var PipelineExpressionBody$1 = (0, import_lib3.$P)((0, import_lib3.$S)(NotDedented, Pipe, __, PipelineTailItem));
|
|
8802
|
+
var PipelineExpressionBody$$ = [PipelineExpressionBody$0, PipelineExpressionBody$1];
|
|
8803
|
+
function PipelineExpressionBody(ctx, state2) {
|
|
8804
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "PipelineExpressionBody", PipelineExpressionBody$$);
|
|
8805
|
+
}
|
|
8806
|
+
var PipelineExpressionBodySameLine$0 = (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(_), Pipe, __, PipelineTailItem));
|
|
8807
|
+
function PipelineExpressionBodySameLine(ctx, state2) {
|
|
8808
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "PipelineExpressionBodySameLine", PipelineExpressionBodySameLine$0);
|
|
8809
|
+
}
|
|
8610
8810
|
var PipelineHeadItem$0 = NonPipelineExtendedExpression;
|
|
8611
8811
|
var PipelineHeadItem$1 = ParenthesizedExpression;
|
|
8612
8812
|
var PipelineHeadItem$$ = [PipelineHeadItem$0, PipelineHeadItem$1];
|
|
@@ -10233,7 +10433,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10233
10433
|
var wid = $4;
|
|
10234
10434
|
var w = $5;
|
|
10235
10435
|
var parameters = $6;
|
|
10236
|
-
var
|
|
10436
|
+
var returnType = $7;
|
|
10237
10437
|
if (!async)
|
|
10238
10438
|
async = [];
|
|
10239
10439
|
if (!generator)
|
|
@@ -10244,7 +10444,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10244
10444
|
id,
|
|
10245
10445
|
name: id?.name,
|
|
10246
10446
|
parameters,
|
|
10247
|
-
returnType
|
|
10447
|
+
returnType,
|
|
10248
10448
|
async,
|
|
10249
10449
|
generator,
|
|
10250
10450
|
modifier: {
|
|
@@ -10252,7 +10452,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10252
10452
|
generator: !!generator.length
|
|
10253
10453
|
},
|
|
10254
10454
|
block: null,
|
|
10255
|
-
children: !parameters.implicit ? [async, func, generator, wid, w, parameters,
|
|
10455
|
+
children: !parameters.implicit ? [async, func, generator, wid, w, parameters, returnType] : [async, func, generator, wid, parameters, w, returnType]
|
|
10256
10456
|
// move whitespace w to after implicit () in parameters
|
|
10257
10457
|
};
|
|
10258
10458
|
});
|
|
@@ -10451,7 +10651,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10451
10651
|
var behavior = $7;
|
|
10452
10652
|
var w2 = $8;
|
|
10453
10653
|
var parameters = $9;
|
|
10454
|
-
var
|
|
10654
|
+
var returnType = $10;
|
|
10455
10655
|
if (!async)
|
|
10456
10656
|
async = [];
|
|
10457
10657
|
if (!generator)
|
|
@@ -10466,7 +10666,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10466
10666
|
id,
|
|
10467
10667
|
name: id.name,
|
|
10468
10668
|
parameters,
|
|
10469
|
-
returnType
|
|
10669
|
+
returnType,
|
|
10470
10670
|
async,
|
|
10471
10671
|
generator,
|
|
10472
10672
|
modifier: {
|
|
@@ -10474,7 +10674,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10474
10674
|
generator: !!generator.length
|
|
10475
10675
|
},
|
|
10476
10676
|
block: null,
|
|
10477
|
-
children: [async, func, generator, w1, id, w2, parameters,
|
|
10677
|
+
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
10478
10678
|
behavior
|
|
10479
10679
|
};
|
|
10480
10680
|
});
|
|
@@ -10521,7 +10721,7 @@ function OperatorAssociativity(ctx, state2) {
|
|
|
10521
10721
|
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
10722
|
var async = $1;
|
|
10523
10723
|
var parameters = $2;
|
|
10524
|
-
var
|
|
10724
|
+
var returnType = $3;
|
|
10525
10725
|
var arrow = $5;
|
|
10526
10726
|
var block = $6;
|
|
10527
10727
|
if (!async)
|
|
@@ -10531,7 +10731,7 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10531
10731
|
type: "FunctionExpression",
|
|
10532
10732
|
id: void 0,
|
|
10533
10733
|
parameters,
|
|
10534
|
-
returnType
|
|
10734
|
+
returnType,
|
|
10535
10735
|
async,
|
|
10536
10736
|
generator,
|
|
10537
10737
|
block,
|
|
@@ -10543,14 +10743,14 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
|
|
|
10543
10743
|
async: !!async.length,
|
|
10544
10744
|
generator: !!generator.length
|
|
10545
10745
|
},
|
|
10546
|
-
returnType
|
|
10746
|
+
returnType
|
|
10547
10747
|
},
|
|
10548
10748
|
children: [
|
|
10549
10749
|
async,
|
|
10550
10750
|
{ $loc: arrow.$loc, token: "function" },
|
|
10551
10751
|
generator,
|
|
10552
10752
|
parameters,
|
|
10553
|
-
|
|
10753
|
+
returnType,
|
|
10554
10754
|
block
|
|
10555
10755
|
]
|
|
10556
10756
|
};
|
|
@@ -11247,6 +11447,7 @@ var ArrayElementExpression$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Extended
|
|
|
11247
11447
|
return {
|
|
11248
11448
|
type: "SpreadElement",
|
|
11249
11449
|
children: [ws, dots, exp],
|
|
11450
|
+
expression: exp,
|
|
11250
11451
|
names: exp.names
|
|
11251
11452
|
};
|
|
11252
11453
|
});
|
|
@@ -11258,12 +11459,14 @@ var ArrayElementExpression$3 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, impo
|
|
|
11258
11459
|
return {
|
|
11259
11460
|
type: "ArrayElement",
|
|
11260
11461
|
children: [exp],
|
|
11462
|
+
expression: exp,
|
|
11261
11463
|
names: exp.names
|
|
11262
11464
|
};
|
|
11263
11465
|
} else {
|
|
11264
11466
|
return {
|
|
11265
11467
|
type: "SpreadElement",
|
|
11266
11468
|
children: [...spread, exp],
|
|
11469
|
+
expression: exp,
|
|
11267
11470
|
names: exp.names
|
|
11268
11471
|
};
|
|
11269
11472
|
}
|
|
@@ -11277,10 +11480,10 @@ var ArrayElementExpression$$ = [ArrayElementExpression$0, ArrayElementExpression
|
|
|
11277
11480
|
function ArrayElementExpression(ctx, state2) {
|
|
11278
11481
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ArrayElementExpression", ArrayElementExpression$$);
|
|
11279
11482
|
}
|
|
11280
|
-
var NestedBulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$S)(InsertSpace, InsertOpenBracket), PushIndent, (0, import_lib3.$Q)(NestedArrayBullet), InsertCloseBracket, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
11483
|
+
var NestedBulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$S)(InsertSpace, InsertOpenBracket), PushIndent, AllowPipeline, (0, import_lib3.$Q)(NestedArrayBullet), RestorePipeline, InsertCloseBracket, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
11281
11484
|
var open = $1;
|
|
11282
|
-
var content = $
|
|
11283
|
-
var close = $
|
|
11485
|
+
var content = $4;
|
|
11486
|
+
var close = $6;
|
|
11284
11487
|
if (!content.length)
|
|
11285
11488
|
return $skip;
|
|
11286
11489
|
content = content.flat();
|
|
@@ -11307,9 +11510,9 @@ var BulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBracket
|
|
|
11307
11510
|
// replace first space with bracket
|
|
11308
11511
|
...content[1].flat()
|
|
11309
11512
|
];
|
|
11310
|
-
|
|
11513
|
+
let last = content[content.length - 1];
|
|
11311
11514
|
if (last.children?.at(-1)?.implicit) {
|
|
11312
|
-
|
|
11515
|
+
content[content.length - 1] = last = { ...last, children: last.children.slice(0, -1) };
|
|
11313
11516
|
}
|
|
11314
11517
|
return {
|
|
11315
11518
|
type: "ArrayExpression",
|
|
@@ -11447,8 +11650,8 @@ var BracedObjectLiteralContent$$ = [BracedObjectLiteralContent$0, BracedObjectLi
|
|
|
11447
11650
|
function BracedObjectLiteralContent(ctx, state2) {
|
|
11448
11651
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "BracedObjectLiteralContent", BracedObjectLiteralContent$$);
|
|
11449
11652
|
}
|
|
11450
|
-
var NestedImplicitObjectLiteral$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBrace, PushIndent, (0, import_lib3.$E)(NestedImplicitPropertyDefinitions), PopIndent, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
11451
|
-
var properties = $
|
|
11653
|
+
var NestedImplicitObjectLiteral$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBrace, PushIndent, AllowPipeline, (0, import_lib3.$E)(NestedImplicitPropertyDefinitions), RestorePipeline, PopIndent, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11654
|
+
var properties = $4;
|
|
11452
11655
|
if (!properties)
|
|
11453
11656
|
return $skip;
|
|
11454
11657
|
return {
|
|
@@ -12141,18 +12344,23 @@ function CoffeeWordAssignmentOp(ctx, state2) {
|
|
|
12141
12344
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeWordAssignmentOp", CoffeeWordAssignmentOp$$);
|
|
12142
12345
|
}
|
|
12143
12346
|
var NotDedentedBinaryOp$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(IndentedFurther), (0, import_lib3.$E)(_), BinaryOp), function($skip, $loc, $0, $1, $2, $3) {
|
|
12347
|
+
var ws1 = $1;
|
|
12348
|
+
var ws2 = $2;
|
|
12349
|
+
var op = $3;
|
|
12144
12350
|
const ws = [];
|
|
12145
|
-
if (
|
|
12146
|
-
ws.push(
|
|
12147
|
-
if (
|
|
12148
|
-
ws.push(
|
|
12149
|
-
return [ws,
|
|
12351
|
+
if (ws1)
|
|
12352
|
+
ws.push(...ws1);
|
|
12353
|
+
if (ws2)
|
|
12354
|
+
ws.push(...ws2);
|
|
12355
|
+
return [ws, op];
|
|
12150
12356
|
});
|
|
12151
|
-
var NotDedentedBinaryOp$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, (0, import_lib3.$E)(_), (0, import_lib3.$N)(Identifier), (0, import_lib3.$C)((0, import_lib3.$N)((0, import_lib3.$EXPECT)($L75, 'NotDedentedBinaryOp "*"')), (0, import_lib3.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12152
|
-
var
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12357
|
+
var NotDedentedBinaryOp$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(NestedBinaryOpAllowed, Nested, (0, import_lib3.$E)(_), (0, import_lib3.$N)(Identifier), (0, import_lib3.$C)((0, import_lib3.$N)((0, import_lib3.$EXPECT)($L75, 'NotDedentedBinaryOp "*"')), (0, import_lib3.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12358
|
+
var ws1 = $2;
|
|
12359
|
+
var ws2 = $3;
|
|
12360
|
+
var op = $6;
|
|
12361
|
+
const ws = [...ws1];
|
|
12362
|
+
if (ws2)
|
|
12363
|
+
ws.push(...ws2);
|
|
12156
12364
|
return [ws, op];
|
|
12157
12365
|
});
|
|
12158
12366
|
var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
|
|
@@ -12580,16 +12788,6 @@ var PostfixedCommaExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Postfi
|
|
|
12580
12788
|
function PostfixedCommaExpression(ctx, state2) {
|
|
12581
12789
|
return (0, import_lib3.$EVENT)(ctx, state2, "PostfixedCommaExpression", PostfixedCommaExpression$0);
|
|
12582
12790
|
}
|
|
12583
|
-
var NonPipelinePostfixedExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(NonPipelineExtendedExpression, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
12584
|
-
var expression = $1;
|
|
12585
|
-
var post = $2;
|
|
12586
|
-
if (post)
|
|
12587
|
-
return attachPostfixStatementAsExpression(expression, post);
|
|
12588
|
-
return expression;
|
|
12589
|
-
});
|
|
12590
|
-
function NonPipelinePostfixedExpression(ctx, state2) {
|
|
12591
|
-
return (0, import_lib3.$EVENT)(ctx, state2, "NonPipelinePostfixedExpression", NonPipelinePostfixedExpression$0);
|
|
12592
|
-
}
|
|
12593
12791
|
var PostfixStatement$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($R29, "PostfixStatement /(?=for|if|loop|unless|until|while)/"), _PostfixStatement), function(value) {
|
|
12594
12792
|
return value[1];
|
|
12595
12793
|
});
|
|
@@ -13199,14 +13397,14 @@ function ForDeclaration(ctx, state2) {
|
|
|
13199
13397
|
}
|
|
13200
13398
|
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
13399
|
var pattern = $1;
|
|
13202
|
-
var
|
|
13203
|
-
|
|
13400
|
+
var typeSuffix = $2;
|
|
13401
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
13204
13402
|
return {
|
|
13205
13403
|
type: "Binding",
|
|
13206
|
-
children: [pattern,
|
|
13404
|
+
children: [pattern, typeSuffix],
|
|
13207
13405
|
names: pattern.names,
|
|
13208
13406
|
pattern,
|
|
13209
|
-
|
|
13407
|
+
typeSuffix,
|
|
13210
13408
|
splices: [],
|
|
13211
13409
|
thisAssignments: []
|
|
13212
13410
|
};
|
|
@@ -13679,6 +13877,34 @@ var TrailingMemberPropertyAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPE
|
|
|
13679
13877
|
function TrailingMemberPropertyAllowed(ctx, state2) {
|
|
13680
13878
|
return (0, import_lib3.$EVENT)(ctx, state2, "TrailingMemberPropertyAllowed", TrailingMemberPropertyAllowed$0);
|
|
13681
13879
|
}
|
|
13880
|
+
var AllowNestedBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'AllowNestedBinaryOp ""'), function($skip, $loc, $0, $1) {
|
|
13881
|
+
state.forbidNestedBinaryOp.push(false);
|
|
13882
|
+
});
|
|
13883
|
+
function AllowNestedBinaryOp(ctx, state2) {
|
|
13884
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "AllowNestedBinaryOp", AllowNestedBinaryOp$0);
|
|
13885
|
+
}
|
|
13886
|
+
var ForbidNestedBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ForbidNestedBinaryOp ""'), function($skip, $loc, $0, $1) {
|
|
13887
|
+
state.forbidNestedBinaryOp.push(true);
|
|
13888
|
+
});
|
|
13889
|
+
function ForbidNestedBinaryOp(ctx, state2) {
|
|
13890
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "ForbidNestedBinaryOp", ForbidNestedBinaryOp$0);
|
|
13891
|
+
}
|
|
13892
|
+
var RestoreNestedBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'RestoreNestedBinaryOp ""'), function($skip, $loc, $0, $1) {
|
|
13893
|
+
state.forbidNestedBinaryOp.pop();
|
|
13894
|
+
});
|
|
13895
|
+
function RestoreNestedBinaryOp(ctx, state2) {
|
|
13896
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "RestoreNestedBinaryOp", RestoreNestedBinaryOp$0);
|
|
13897
|
+
}
|
|
13898
|
+
var NestedBinaryOpAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'NestedBinaryOpAllowed ""'), function($skip, $loc, $0, $1) {
|
|
13899
|
+
if (config.verbose) {
|
|
13900
|
+
console.log("forbidNestedBinaryOp:", state.forbidNestedBinaryOp);
|
|
13901
|
+
}
|
|
13902
|
+
if (state.nestedBinaryOpForbidden)
|
|
13903
|
+
return $skip;
|
|
13904
|
+
});
|
|
13905
|
+
function NestedBinaryOpAllowed(ctx, state2) {
|
|
13906
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "NestedBinaryOpAllowed", NestedBinaryOpAllowed$0);
|
|
13907
|
+
}
|
|
13682
13908
|
var AllowNewlineBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'AllowNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
|
|
13683
13909
|
state.forbidNewlineBinaryOp.push(false);
|
|
13684
13910
|
});
|
|
@@ -13707,11 +13933,39 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0
|
|
|
13707
13933
|
function NewlineBinaryOpAllowed(ctx, state2) {
|
|
13708
13934
|
return (0, import_lib3.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
|
|
13709
13935
|
}
|
|
13710
|
-
var
|
|
13936
|
+
var AllowPipeline$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'AllowPipeline ""'), function($skip, $loc, $0, $1) {
|
|
13937
|
+
state.forbidPipeline.push(false);
|
|
13938
|
+
});
|
|
13939
|
+
function AllowPipeline(ctx, state2) {
|
|
13940
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "AllowPipeline", AllowPipeline$0);
|
|
13941
|
+
}
|
|
13942
|
+
var ForbidPipeline$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ForbidPipeline ""'), function($skip, $loc, $0, $1) {
|
|
13943
|
+
state.forbidPipeline.push(true);
|
|
13944
|
+
});
|
|
13945
|
+
function ForbidPipeline(ctx, state2) {
|
|
13946
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "ForbidPipeline", ForbidPipeline$0);
|
|
13947
|
+
}
|
|
13948
|
+
var RestorePipeline$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'RestorePipeline ""'), function($skip, $loc, $0, $1) {
|
|
13949
|
+
state.forbidPipeline.pop();
|
|
13950
|
+
});
|
|
13951
|
+
function RestorePipeline(ctx, state2) {
|
|
13952
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "RestorePipeline", RestorePipeline$0);
|
|
13953
|
+
}
|
|
13954
|
+
var PipelineAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'PipelineAllowed ""'), function($skip, $loc, $0, $1) {
|
|
13955
|
+
if (config.verbose) {
|
|
13956
|
+
console.log("forbidPipeline:", state.forbidPipeline);
|
|
13957
|
+
}
|
|
13958
|
+
if (state.pipelineForbidden)
|
|
13959
|
+
return $skip;
|
|
13960
|
+
});
|
|
13961
|
+
function PipelineAllowed(ctx, state2) {
|
|
13962
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
|
|
13963
|
+
}
|
|
13964
|
+
var AllowAll$0 = (0, import_lib3.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowPipeline);
|
|
13711
13965
|
function AllowAll(ctx, state2) {
|
|
13712
13966
|
return (0, import_lib3.$EVENT)(ctx, state2, "AllowAll", AllowAll$0);
|
|
13713
13967
|
}
|
|
13714
|
-
var RestoreAll$0 = (0, import_lib3.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNewlineBinaryOp);
|
|
13968
|
+
var RestoreAll$0 = (0, import_lib3.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestorePipeline);
|
|
13715
13969
|
function RestoreAll(ctx, state2) {
|
|
13716
13970
|
return (0, import_lib3.$EVENT)(ctx, state2, "RestoreAll", RestoreAll$0);
|
|
13717
13971
|
}
|
|
@@ -13843,6 +14097,16 @@ var MaybeNestedExtendedExpression$$ = [MaybeNestedExtendedExpression$0, MaybeNes
|
|
|
13843
14097
|
function MaybeNestedExtendedExpression(ctx, state2) {
|
|
13844
14098
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedExtendedExpression", MaybeNestedExtendedExpression$$);
|
|
13845
14099
|
}
|
|
14100
|
+
var NestedExtendedExpression$0 = NestedBulletedArray;
|
|
14101
|
+
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) {
|
|
14102
|
+
if ($3)
|
|
14103
|
+
return $3;
|
|
14104
|
+
return $skip;
|
|
14105
|
+
});
|
|
14106
|
+
var NestedExtendedExpression$$ = [NestedExtendedExpression$0, NestedExtendedExpression$1];
|
|
14107
|
+
function NestedExtendedExpression(ctx, state2) {
|
|
14108
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedExtendedExpression", NestedExtendedExpression$$);
|
|
14109
|
+
}
|
|
13846
14110
|
var MaybeParenNestedExtendedExpression$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ExtendedExpression), function(value) {
|
|
13847
14111
|
return value[1];
|
|
13848
14112
|
});
|
|
@@ -14337,16 +14601,16 @@ function TypeAssignment(ctx, state2) {
|
|
|
14337
14601
|
}
|
|
14338
14602
|
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
14603
|
var pattern = $1;
|
|
14340
|
-
var
|
|
14604
|
+
var typeSuffix = $2;
|
|
14341
14605
|
var initializer = $3;
|
|
14342
14606
|
const [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
14343
|
-
|
|
14607
|
+
typeSuffix ??= pattern.typeSuffix;
|
|
14344
14608
|
return {
|
|
14345
14609
|
type: "Binding",
|
|
14346
|
-
children: [pattern,
|
|
14610
|
+
children: [pattern, typeSuffix, initializer],
|
|
14347
14611
|
names: pattern.names,
|
|
14348
14612
|
pattern,
|
|
14349
|
-
|
|
14613
|
+
typeSuffix,
|
|
14350
14614
|
initializer,
|
|
14351
14615
|
splices: splices.map((s) => [",", s]),
|
|
14352
14616
|
thisAssignments: thisAssignments.map((s) => ["", s, ";"])
|
|
@@ -14354,14 +14618,14 @@ var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern,
|
|
|
14354
14618
|
});
|
|
14355
14619
|
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
14620
|
var pattern = $1;
|
|
14357
|
-
var
|
|
14621
|
+
var typeSuffix = $2;
|
|
14358
14622
|
var initializer = $3;
|
|
14359
14623
|
return {
|
|
14360
14624
|
type: "Binding",
|
|
14361
14625
|
children: $0,
|
|
14362
14626
|
names: pattern.names,
|
|
14363
14627
|
pattern,
|
|
14364
|
-
|
|
14628
|
+
typeSuffix,
|
|
14365
14629
|
initializer,
|
|
14366
14630
|
splices: [],
|
|
14367
14631
|
thisAssignments: []
|
|
@@ -16306,14 +16570,14 @@ function UsingDeclaration(ctx, state2) {
|
|
|
16306
16570
|
}
|
|
16307
16571
|
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
16572
|
var pattern = $1;
|
|
16309
|
-
var
|
|
16573
|
+
var typeSuffix = $2;
|
|
16310
16574
|
var initializer = $3;
|
|
16311
16575
|
return {
|
|
16312
16576
|
type: "Binding",
|
|
16313
16577
|
children: $0,
|
|
16314
16578
|
names: pattern.names,
|
|
16315
16579
|
pattern,
|
|
16316
|
-
|
|
16580
|
+
typeSuffix,
|
|
16317
16581
|
initializer,
|
|
16318
16582
|
splices: [],
|
|
16319
16583
|
thisAssignments: []
|
|
@@ -16875,7 +17139,8 @@ function TypeUnary(ctx, state2) {
|
|
|
16875
17139
|
}
|
|
16876
17140
|
var TypeUnarySuffix$0 = TypeIndexedAccess;
|
|
16877
17141
|
var TypeUnarySuffix$1 = QuestionMark;
|
|
16878
|
-
var TypeUnarySuffix
|
|
17142
|
+
var TypeUnarySuffix$2 = NonNullAssertion;
|
|
17143
|
+
var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1, TypeUnarySuffix$2];
|
|
16879
17144
|
function TypeUnarySuffix(ctx, state2) {
|
|
16880
17145
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeUnarySuffix", TypeUnarySuffix$$);
|
|
16881
17146
|
}
|
|
@@ -17870,7 +18135,9 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
17870
18135
|
state.forbidIndentedApplication = [false];
|
|
17871
18136
|
state.forbidBracedApplication = [false];
|
|
17872
18137
|
state.forbidTrailingMemberProperty = [false];
|
|
18138
|
+
state.forbidNestedBinaryOp = [false];
|
|
17873
18139
|
state.forbidNewlineBinaryOp = [false];
|
|
18140
|
+
state.forbidPipeline = [false];
|
|
17874
18141
|
state.JSXTagStack = [void 0];
|
|
17875
18142
|
state.operators = /* @__PURE__ */ new Map();
|
|
17876
18143
|
state.helperRefs = {};
|
|
@@ -18141,12 +18408,24 @@ Object.defineProperties(state, {
|
|
|
18141
18408
|
return s[s.length - 1];
|
|
18142
18409
|
}
|
|
18143
18410
|
},
|
|
18411
|
+
nestedBinaryOpForbidden: {
|
|
18412
|
+
get() {
|
|
18413
|
+
const { forbidNestedBinaryOp: s } = state;
|
|
18414
|
+
return s[s.length - 1];
|
|
18415
|
+
}
|
|
18416
|
+
},
|
|
18144
18417
|
newlineBinaryOpForbidden: {
|
|
18145
18418
|
get() {
|
|
18146
18419
|
const { forbidNewlineBinaryOp: s } = state;
|
|
18147
18420
|
return s[s.length - 1];
|
|
18148
18421
|
}
|
|
18149
18422
|
},
|
|
18423
|
+
pipelineForbidden: {
|
|
18424
|
+
get() {
|
|
18425
|
+
const { forbidPipeline: s } = state;
|
|
18426
|
+
return s[s.length - 1];
|
|
18427
|
+
}
|
|
18428
|
+
},
|
|
18150
18429
|
currentJSXTag: {
|
|
18151
18430
|
get() {
|
|
18152
18431
|
const { JSXTagStack: s } = state;
|
|
@@ -18155,12 +18434,12 @@ Object.defineProperties(state, {
|
|
|
18155
18434
|
}
|
|
18156
18435
|
});
|
|
18157
18436
|
function getStateKey() {
|
|
18158
|
-
const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.
|
|
18437
|
+
const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.nestedBinaryOpForbidden << 3 | state.newlineBinaryOpForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
|
|
18159
18438
|
// since it is affected by the directive prologue and may be hit
|
|
18160
18439
|
// by the EOL rule early in the parse. Later if we wanted to
|
|
18161
18440
|
// allow block scoping of the compat directives we would need to
|
|
18162
18441
|
// add them all here.
|
|
18163
|
-
config.coffeeComment <<
|
|
18442
|
+
config.coffeeComment << 0;
|
|
18164
18443
|
return [stateInt, state.currentJSXTag];
|
|
18165
18444
|
}
|
|
18166
18445
|
function parseProgram(input, options) {
|
|
@@ -18560,21 +18839,27 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
18560
18839
|
"AllowBracedApplication",
|
|
18561
18840
|
"AllowIndentedApplication",
|
|
18562
18841
|
"AllowMultiLineImplicitObjectLiteral",
|
|
18842
|
+
"AllowNestedBinaryOp",
|
|
18563
18843
|
"AllowNewlineBinaryOp",
|
|
18564
18844
|
"AllowTrailingMemberProperty",
|
|
18845
|
+
"AllowPipeline",
|
|
18565
18846
|
"ForbidClassImplicitCall",
|
|
18566
18847
|
"ForbidBracedApplication",
|
|
18567
18848
|
"ForbidIndentedApplication",
|
|
18568
18849
|
"ForbidMultiLineImplicitObjectLiteral",
|
|
18850
|
+
"ForbidNestedBinaryOp",
|
|
18569
18851
|
"ForbidNewlineBinaryOp",
|
|
18570
18852
|
"ForbidTrailingMemberProperty",
|
|
18853
|
+
"ForbidPipeline",
|
|
18571
18854
|
"RestoreAll",
|
|
18572
18855
|
"RestoreClassImplicitCall",
|
|
18573
18856
|
"RestoreMultiLineImplicitObjectLiteral",
|
|
18574
18857
|
"RestoreBracedApplication",
|
|
18575
18858
|
"RestoreIndentedApplication",
|
|
18576
18859
|
"RestoreTrailingMemberProperty",
|
|
18577
|
-
"
|
|
18860
|
+
"RestoreNestedBinaryOp",
|
|
18861
|
+
"RestoreNewlineBinaryOp",
|
|
18862
|
+
"RestorePipeline"
|
|
18578
18863
|
]);
|
|
18579
18864
|
function compile(src, options) {
|
|
18580
18865
|
if (!options) {
|
|
@@ -18719,13 +19004,16 @@ var makeCache = function({ hits, trace } = {}) {
|
|
|
18719
19004
|
};
|
|
18720
19005
|
}
|
|
18721
19006
|
if (trace) {
|
|
18722
|
-
logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "
|
|
19007
|
+
logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "{");
|
|
18723
19008
|
stack.push(ruleName);
|
|
18724
19009
|
}
|
|
18725
19010
|
return;
|
|
18726
19011
|
},
|
|
18727
19012
|
exit: function(ruleName, state2, result) {
|
|
18728
19013
|
if (uncacheable.has(ruleName)) {
|
|
19014
|
+
if (trace) {
|
|
19015
|
+
logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "\u26A0\uFE0F " + (result ? "\u2705" : "\u274C"));
|
|
19016
|
+
}
|
|
18729
19017
|
return;
|
|
18730
19018
|
}
|
|
18731
19019
|
const [stateKey, tagKey] = getStateKey();
|
|
@@ -18739,7 +19027,7 @@ var makeCache = function({ hits, trace } = {}) {
|
|
|
18739
19027
|
}
|
|
18740
19028
|
if (trace) {
|
|
18741
19029
|
stack.pop();
|
|
18742
|
-
logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + " " + (result ? "\u2705" : "\u274C"));
|
|
19030
|
+
logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "} " + (result ? "\u2705" : "\u274C"));
|
|
18743
19031
|
}
|
|
18744
19032
|
return;
|
|
18745
19033
|
}
|