@danielx/civet 0.9.1 → 0.9.3
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 +11 -0
- package/dist/babel-plugin.js +6 -7
- package/dist/babel-plugin.mjs +3 -3
- package/dist/browser.js +4719 -9822
- package/dist/civet +11 -10
- package/dist/config.js +6 -7
- package/dist/config.mjs +3 -3
- package/dist/esbuild-plugin.js +6 -7
- package/dist/esm.mjs +1 -1
- package/dist/main.js +1175 -995
- package/dist/main.mjs +1179 -992
- package/dist/node-worker.mjs +29 -0
- package/dist/ts-diagnostic.js +5 -8
- package/dist/ts-diagnostic.mjs +2 -4
- package/dist/types.d.ts +4 -0
- package/dist/unplugin/unplugin.d.ts +2 -0
- package/dist/unplugin/unplugin.js +135 -142
- package/dist/unplugin/unplugin.mjs +135 -142
- package/package.json +4 -4
package/dist/main.mjs
CHANGED
|
@@ -485,15 +485,16 @@ ${body}`;
|
|
|
485
485
|
// source/parser.hera
|
|
486
486
|
var import_lib2 = __toESM(require_machine());
|
|
487
487
|
|
|
488
|
-
// source
|
|
489
|
-
var
|
|
490
|
-
__export(
|
|
488
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
|
|
489
|
+
var lib_civet_exports = {};
|
|
490
|
+
__export(lib_civet_exports, {
|
|
491
491
|
addPostfixStatement: () => addPostfixStatement,
|
|
492
492
|
adjustBindingElements: () => adjustBindingElements,
|
|
493
493
|
adjustIndexAccess: () => adjustIndexAccess,
|
|
494
494
|
append: () => append,
|
|
495
495
|
attachPostfixStatementAsExpression: () => attachPostfixStatementAsExpression,
|
|
496
496
|
blockWithPrefix: () => blockWithPrefix,
|
|
497
|
+
braceBlock: () => braceBlock,
|
|
497
498
|
convertNamedImportsToObject: () => convertNamedImportsToObject,
|
|
498
499
|
convertObjectToJSXAttributes: () => convertObjectToJSXAttributes,
|
|
499
500
|
convertWithClause: () => convertWithClause,
|
|
@@ -561,7 +562,7 @@ __export(lib_exports, {
|
|
|
561
562
|
wrapTypeInPromise: () => wrapTypeInPromise
|
|
562
563
|
});
|
|
563
564
|
|
|
564
|
-
// source
|
|
565
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
|
|
565
566
|
function len(arr, length) {
|
|
566
567
|
return arr.length === length;
|
|
567
568
|
}
|
|
@@ -585,10 +586,8 @@ var assert = {
|
|
|
585
586
|
}
|
|
586
587
|
};
|
|
587
588
|
function addParentPointers(node, parent) {
|
|
588
|
-
if (node == null)
|
|
589
|
-
|
|
590
|
-
if (typeof node !== "object")
|
|
591
|
-
return;
|
|
589
|
+
if (node == null) return;
|
|
590
|
+
if (typeof node !== "object") return;
|
|
592
591
|
if (Array.isArray(node)) {
|
|
593
592
|
for (const child of node) {
|
|
594
593
|
addParentPointers(child, parent);
|
|
@@ -654,8 +653,7 @@ function isToken(node) {
|
|
|
654
653
|
return node != null && node.token != null;
|
|
655
654
|
}
|
|
656
655
|
function isEmptyBareBlock(node) {
|
|
657
|
-
if (node?.type !== "BlockStatement")
|
|
658
|
-
return false;
|
|
656
|
+
if (node?.type !== "BlockStatement") return false;
|
|
659
657
|
const { bare, expressions } = node;
|
|
660
658
|
return bare && (Array.isArray(expressions) && len(expressions, 0) || Array.isArray(expressions) && len(expressions, 1) && Array.isArray(expressions[0]) && expressions[0].length >= 2 && typeof expressions[0][1] === "object" && expressions[0][1] != null && "type" in expressions[0][1] && expressions[0][1].type === "EmptyStatement");
|
|
661
659
|
}
|
|
@@ -688,20 +686,13 @@ function isStatement(node) {
|
|
|
688
686
|
statementTypes.has(node.type);
|
|
689
687
|
}
|
|
690
688
|
function isWhitespaceOrEmpty(node) {
|
|
691
|
-
if (!node)
|
|
692
|
-
|
|
693
|
-
if (node.
|
|
694
|
-
|
|
695
|
-
if (node.
|
|
696
|
-
|
|
697
|
-
if (node.
|
|
698
|
-
node = node.children;
|
|
699
|
-
if (!node.length)
|
|
700
|
-
return true;
|
|
701
|
-
if (typeof node === "string")
|
|
702
|
-
return /^\s*$/.test(node);
|
|
703
|
-
if (Array.isArray(node))
|
|
704
|
-
return node.every(isWhitespaceOrEmpty);
|
|
689
|
+
if (!node) return true;
|
|
690
|
+
if (node.type === "Ref") return false;
|
|
691
|
+
if (node.token) return /^\s*$/.test(node.token);
|
|
692
|
+
if (node.children) node = node.children;
|
|
693
|
+
if (!node.length) return true;
|
|
694
|
+
if (typeof node === "string") return /^\s*$/.test(node);
|
|
695
|
+
if (Array.isArray(node)) return node.every(isWhitespaceOrEmpty);
|
|
705
696
|
return false;
|
|
706
697
|
}
|
|
707
698
|
function firstNonSpace(node) {
|
|
@@ -745,12 +736,14 @@ function isExit(node) {
|
|
|
745
736
|
let ref3;
|
|
746
737
|
let ref4;
|
|
747
738
|
switch (node.type) {
|
|
739
|
+
// Exit from normal flow
|
|
748
740
|
case "ReturnStatement":
|
|
749
741
|
case "ThrowStatement":
|
|
750
742
|
case "BreakStatement":
|
|
751
743
|
case "ContinueStatement": {
|
|
752
744
|
return true;
|
|
753
745
|
}
|
|
746
|
+
// if checks then and else clause
|
|
754
747
|
case "IfStatement": {
|
|
755
748
|
return (
|
|
756
749
|
// `insertReturn` for IfStatement adds a return to children
|
|
@@ -774,9 +767,11 @@ function isExit(node) {
|
|
|
774
767
|
case "BlockStatement": {
|
|
775
768
|
return node.expressions.some((s) => isExit(s[1]));
|
|
776
769
|
}
|
|
770
|
+
// Infinite loops
|
|
777
771
|
case "IterationStatement": {
|
|
778
772
|
return isLoopStatement(node) && gatherRecursiveWithinFunction(node.block, ($1) => $1.type === "BreakStatement").length === 0;
|
|
779
773
|
}
|
|
774
|
+
// TODO: Distinguish between break of this loop vs. break of inner loops
|
|
780
775
|
default: {
|
|
781
776
|
return false;
|
|
782
777
|
}
|
|
@@ -980,6 +975,57 @@ function literalValue(literal) {
|
|
|
980
975
|
}
|
|
981
976
|
}
|
|
982
977
|
}
|
|
978
|
+
function literalType(literal) {
|
|
979
|
+
let t;
|
|
980
|
+
switch (literal.type) {
|
|
981
|
+
case "RegularExpressionLiteral": {
|
|
982
|
+
t = "RegExp";
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
985
|
+
case "TemplateLiteral": {
|
|
986
|
+
t = "string";
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
case "Literal": {
|
|
990
|
+
switch (literal.subtype) {
|
|
991
|
+
case "NullLiteral": {
|
|
992
|
+
t = "null";
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
case "BooleanLiteral": {
|
|
996
|
+
t = "boolean";
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
case "NumericLiteral": {
|
|
1000
|
+
if (literal.raw.endsWith("n")) {
|
|
1001
|
+
t = "bigint";
|
|
1002
|
+
} else {
|
|
1003
|
+
t = "number";
|
|
1004
|
+
}
|
|
1005
|
+
;
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
case "StringLiteral": {
|
|
1009
|
+
t = "string";
|
|
1010
|
+
break;
|
|
1011
|
+
}
|
|
1012
|
+
default: {
|
|
1013
|
+
throw new Error(`unknown literal subtype ${literal.subtype}`);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
;
|
|
1017
|
+
break;
|
|
1018
|
+
}
|
|
1019
|
+
default: {
|
|
1020
|
+
throw new Error(`unknown literal type ${literal.type}`);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return {
|
|
1024
|
+
type: "TypeLiteral",
|
|
1025
|
+
t,
|
|
1026
|
+
children: [t]
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
983
1029
|
function makeNumericLiteral(n) {
|
|
984
1030
|
const s = n.toString();
|
|
985
1031
|
return {
|
|
@@ -996,8 +1042,7 @@ function makeNumericLiteral(n) {
|
|
|
996
1042
|
};
|
|
997
1043
|
}
|
|
998
1044
|
function startsWith(target, value) {
|
|
999
|
-
if (!target)
|
|
1000
|
-
return;
|
|
1045
|
+
if (!target) return;
|
|
1001
1046
|
if (Array.isArray(target)) {
|
|
1002
1047
|
let i = 0;
|
|
1003
1048
|
let l = target.length;
|
|
@@ -1012,12 +1057,9 @@ function startsWith(target, value) {
|
|
|
1012
1057
|
return startsWith(target[i], value);
|
|
1013
1058
|
}
|
|
1014
1059
|
}
|
|
1015
|
-
if (typeof target === "string")
|
|
1016
|
-
|
|
1017
|
-
if (target.
|
|
1018
|
-
return startsWith(target.children, value);
|
|
1019
|
-
if (target.token)
|
|
1020
|
-
return value.test(target.token);
|
|
1060
|
+
if (typeof target === "string") return value.test(target);
|
|
1061
|
+
if (target.children) return startsWith(target.children, value);
|
|
1062
|
+
if (target.token) return value.test(target.token);
|
|
1021
1063
|
return;
|
|
1022
1064
|
}
|
|
1023
1065
|
function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
|
|
@@ -1148,10 +1190,8 @@ function replaceNodes(root, predicate, replacer) {
|
|
|
1148
1190
|
return root;
|
|
1149
1191
|
}
|
|
1150
1192
|
function removeHoistDecs(node) {
|
|
1151
|
-
if (node == null)
|
|
1152
|
-
|
|
1153
|
-
if (typeof node !== "object")
|
|
1154
|
-
return;
|
|
1193
|
+
if (node == null) return;
|
|
1194
|
+
if (typeof node !== "object") return;
|
|
1155
1195
|
if ("hoistDec" in node) {
|
|
1156
1196
|
node.hoistDec = void 0;
|
|
1157
1197
|
}
|
|
@@ -1283,8 +1323,7 @@ function makeNode(node) {
|
|
|
1283
1323
|
return node;
|
|
1284
1324
|
}
|
|
1285
1325
|
function skipIfOnlyWS(target) {
|
|
1286
|
-
if (!target)
|
|
1287
|
-
return target;
|
|
1326
|
+
if (!target) return target;
|
|
1288
1327
|
if (Array.isArray(target)) {
|
|
1289
1328
|
if (target.length === 1) {
|
|
1290
1329
|
return skipIfOnlyWS(target[0]);
|
|
@@ -1299,7 +1338,7 @@ function skipIfOnlyWS(target) {
|
|
|
1299
1338
|
return target;
|
|
1300
1339
|
}
|
|
1301
1340
|
function spliceChild(node, child, del, ...replacements) {
|
|
1302
|
-
const children = node
|
|
1341
|
+
const children = Array.isArray(node) ? node : node.children;
|
|
1303
1342
|
if (!Array.isArray(children)) {
|
|
1304
1343
|
throw new Error("spliceChild: non-array node has no children field");
|
|
1305
1344
|
}
|
|
@@ -1345,8 +1384,9 @@ function parenthesizeType(type) {
|
|
|
1345
1384
|
children: ["(", type, ")"]
|
|
1346
1385
|
});
|
|
1347
1386
|
}
|
|
1348
|
-
function wrapIIFE(expressions, asyncFlag,
|
|
1387
|
+
function wrapIIFE(expressions, asyncFlag, generatorStar) {
|
|
1349
1388
|
let awaitPrefix;
|
|
1389
|
+
const generator = generatorStar ? [generatorStar] : [];
|
|
1350
1390
|
const async = [];
|
|
1351
1391
|
if (asyncFlag) {
|
|
1352
1392
|
async.push("async ");
|
|
@@ -1358,9 +1398,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1358
1398
|
};
|
|
1359
1399
|
}
|
|
1360
1400
|
let yieldWrap = false;
|
|
1361
|
-
if (!generator) {
|
|
1401
|
+
if (!generator.length) {
|
|
1362
1402
|
if (hasYield(expressions)) {
|
|
1363
|
-
generator
|
|
1403
|
+
generator.push("*");
|
|
1364
1404
|
yieldWrap = true;
|
|
1365
1405
|
}
|
|
1366
1406
|
}
|
|
@@ -1371,30 +1411,34 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1371
1411
|
bare: false,
|
|
1372
1412
|
root: false
|
|
1373
1413
|
});
|
|
1414
|
+
const parameterList = [];
|
|
1374
1415
|
const parameters = {
|
|
1375
1416
|
type: "Parameters",
|
|
1376
|
-
children: ["()"],
|
|
1417
|
+
children: ["(", parameterList, ")"],
|
|
1418
|
+
parameters: parameterList,
|
|
1377
1419
|
names: []
|
|
1378
1420
|
};
|
|
1379
1421
|
const signature = {
|
|
1422
|
+
type: "FunctionSignature",
|
|
1380
1423
|
modifier: {
|
|
1381
1424
|
async: !!async.length,
|
|
1382
|
-
generator: !!generator
|
|
1425
|
+
generator: !!generator.length
|
|
1383
1426
|
},
|
|
1384
|
-
|
|
1427
|
+
parameters,
|
|
1428
|
+
returnType: void 0,
|
|
1429
|
+
children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
|
|
1385
1430
|
};
|
|
1386
1431
|
let fn;
|
|
1387
|
-
if (generator) {
|
|
1432
|
+
if (generator.length) {
|
|
1388
1433
|
fn = makeNode({
|
|
1389
1434
|
type: "FunctionExpression",
|
|
1390
1435
|
signature,
|
|
1391
1436
|
parameters,
|
|
1392
1437
|
returnType: void 0,
|
|
1393
|
-
ts: false,
|
|
1394
1438
|
async,
|
|
1395
1439
|
block,
|
|
1396
1440
|
generator,
|
|
1397
|
-
children: [
|
|
1441
|
+
children: [...signature.children, block]
|
|
1398
1442
|
});
|
|
1399
1443
|
} else {
|
|
1400
1444
|
fn = makeNode({
|
|
@@ -1402,10 +1446,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1402
1446
|
signature,
|
|
1403
1447
|
parameters,
|
|
1404
1448
|
returnType: void 0,
|
|
1405
|
-
ts: false,
|
|
1406
1449
|
async,
|
|
1407
1450
|
block,
|
|
1408
|
-
children: [
|
|
1451
|
+
children: [...signature.children, "=>", block]
|
|
1409
1452
|
});
|
|
1410
1453
|
}
|
|
1411
1454
|
const children = [makeLeftHandSideExpression(fn), "()"];
|
|
@@ -1414,8 +1457,19 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1414
1457
|
children.splice(1, 0, ".bind(this)");
|
|
1415
1458
|
}
|
|
1416
1459
|
if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1460
|
+
const binding = {
|
|
1461
|
+
type: "Identifier",
|
|
1462
|
+
name: "arguments",
|
|
1463
|
+
names: ["arguments"],
|
|
1464
|
+
children: ["arguments"]
|
|
1465
|
+
};
|
|
1466
|
+
parameterList.push({
|
|
1467
|
+
type: "Parameter",
|
|
1468
|
+
children: [binding],
|
|
1469
|
+
names: ["arguments"],
|
|
1470
|
+
binding
|
|
1471
|
+
});
|
|
1472
|
+
children[children.length - 1] = "(arguments)";
|
|
1419
1473
|
}
|
|
1420
1474
|
}
|
|
1421
1475
|
let exp = makeNode({
|
|
@@ -1467,7 +1521,7 @@ function flatJoin(array, separator) {
|
|
|
1467
1521
|
return result;
|
|
1468
1522
|
}
|
|
1469
1523
|
|
|
1470
|
-
// source
|
|
1524
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
|
|
1471
1525
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
1472
1526
|
return gatherRecursive(node, predicate, isFunction);
|
|
1473
1527
|
}
|
|
@@ -1534,7 +1588,6 @@ function gatherNodes(node, predicate) {
|
|
|
1534
1588
|
}
|
|
1535
1589
|
default: {
|
|
1536
1590
|
return gatherNodes(
|
|
1537
|
-
//@ts-ignore
|
|
1538
1591
|
node.children,
|
|
1539
1592
|
predicate
|
|
1540
1593
|
);
|
|
@@ -1555,7 +1608,6 @@ function gatherRecursive(node, predicate, skipPredicate) {
|
|
|
1555
1608
|
return [node];
|
|
1556
1609
|
}
|
|
1557
1610
|
return gatherRecursive(
|
|
1558
|
-
//@ts-ignore
|
|
1559
1611
|
node.children,
|
|
1560
1612
|
predicate,
|
|
1561
1613
|
skipPredicate
|
|
@@ -1569,7 +1621,6 @@ function gatherRecursiveAll(node, predicate) {
|
|
|
1569
1621
|
return node.flatMap((n) => gatherRecursiveAll(n, predicate));
|
|
1570
1622
|
}
|
|
1571
1623
|
const nodes = gatherRecursiveAll(
|
|
1572
|
-
//@ts-ignore
|
|
1573
1624
|
node.children,
|
|
1574
1625
|
predicate
|
|
1575
1626
|
);
|
|
@@ -1579,7 +1630,7 @@ function gatherRecursiveAll(node, predicate) {
|
|
|
1579
1630
|
return nodes;
|
|
1580
1631
|
}
|
|
1581
1632
|
|
|
1582
|
-
// source
|
|
1633
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
|
|
1583
1634
|
function makeRef(base = "ref", id = base) {
|
|
1584
1635
|
return {
|
|
1585
1636
|
type: "Ref",
|
|
@@ -1640,9 +1691,10 @@ function maybeRefAssignment(exp, base = "ref") {
|
|
|
1640
1691
|
}
|
|
1641
1692
|
}
|
|
1642
1693
|
|
|
1643
|
-
// source
|
|
1694
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
|
|
1644
1695
|
function adjustAtBindings(statements, asThis = false) {
|
|
1645
|
-
gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty").
|
|
1696
|
+
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
|
|
1697
|
+
const binding = ref1[i1];
|
|
1646
1698
|
const { ref } = binding;
|
|
1647
1699
|
if (asThis) {
|
|
1648
1700
|
const atBinding = binding.binding;
|
|
@@ -1653,20 +1705,18 @@ function adjustAtBindings(statements, asThis = false) {
|
|
|
1653
1705
|
binding.ref = void 0;
|
|
1654
1706
|
return;
|
|
1655
1707
|
}
|
|
1656
|
-
if (ref.names[0]
|
|
1657
|
-
|
|
1708
|
+
if (!(ref.names[0] === ref.base)) {
|
|
1709
|
+
binding.children.unshift(ref.base, ": ");
|
|
1658
1710
|
}
|
|
1659
|
-
|
|
1660
|
-
return;
|
|
1661
|
-
});
|
|
1711
|
+
}
|
|
1662
1712
|
}
|
|
1663
1713
|
function adjustBindingElements(elements) {
|
|
1664
1714
|
const names = elements.flatMap(($1) => $1.names || []);
|
|
1665
1715
|
const { length } = elements;
|
|
1666
1716
|
let blockPrefix, restIndex = -1, restCount = 0;
|
|
1667
|
-
for (let
|
|
1668
|
-
const i =
|
|
1669
|
-
const { type } = elements[
|
|
1717
|
+
for (let i2 = 0, len1 = elements.length; i2 < len1; i2++) {
|
|
1718
|
+
const i = i2;
|
|
1719
|
+
const { type } = elements[i2];
|
|
1670
1720
|
if (type === "BindingRestElement") {
|
|
1671
1721
|
if (restIndex < 0) {
|
|
1672
1722
|
restIndex = i;
|
|
@@ -1688,8 +1738,7 @@ function adjustBindingElements(elements) {
|
|
|
1688
1738
|
names.push(...rest.names || []);
|
|
1689
1739
|
let l = after.length;
|
|
1690
1740
|
if (l) {
|
|
1691
|
-
if (arrayElementHasTrailingComma(after[l - 1]))
|
|
1692
|
-
l++;
|
|
1741
|
+
if (arrayElementHasTrailingComma(after[l - 1])) l++;
|
|
1693
1742
|
const elements2 = trimFirstSpace(after);
|
|
1694
1743
|
blockPrefix = {
|
|
1695
1744
|
type: "PostRestBindingElements",
|
|
@@ -1724,35 +1773,63 @@ function gatherBindingCode(statements, opts) {
|
|
|
1724
1773
|
const thisAssignments = [];
|
|
1725
1774
|
const splices = [];
|
|
1726
1775
|
function insertRestSplices(s, p, thisAssignments2) {
|
|
1727
|
-
|
|
1776
|
+
let m;
|
|
1777
|
+
for (let ref2 = gatherRecursiveAll(
|
|
1778
|
+
s,
|
|
1779
|
+
(n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding" || opts?.assignPins && (m = n.type, m === "PinPattern" || m === "PinProperty")
|
|
1780
|
+
), i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
|
|
1781
|
+
let n = ref2[i3];
|
|
1728
1782
|
if (n.type === "AtBinding") {
|
|
1729
1783
|
const { ref } = n;
|
|
1730
1784
|
const { id } = ref;
|
|
1731
1785
|
thisAssignments2.push([`this.${id} = `, ref]);
|
|
1732
|
-
|
|
1786
|
+
continue;
|
|
1787
|
+
}
|
|
1788
|
+
if (opts?.assignPins) {
|
|
1789
|
+
if (n.type === "PinProperty") {
|
|
1790
|
+
n.children = n.children.flatMap(($2) => $2 === n.name ? [n.name, ": ", n.value] : $2);
|
|
1791
|
+
updateParentPointers(n);
|
|
1792
|
+
n = n.value;
|
|
1793
|
+
}
|
|
1794
|
+
if (n.type === "PinPattern") {
|
|
1795
|
+
n.ref = makeRef(
|
|
1796
|
+
n.expression.type === "Identifier" ? n.expression.name : "pin"
|
|
1797
|
+
);
|
|
1798
|
+
n.children = [n.ref];
|
|
1799
|
+
updateParentPointers(n);
|
|
1800
|
+
thisAssignments2.push({
|
|
1801
|
+
type: "AssignmentExpression",
|
|
1802
|
+
children: [n.expression, " = ", n.ref],
|
|
1803
|
+
names: [],
|
|
1804
|
+
lhs: n.expression,
|
|
1805
|
+
assigned: n.expression,
|
|
1806
|
+
expression: n.ref
|
|
1807
|
+
});
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1733
1810
|
}
|
|
1734
1811
|
if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
|
|
1735
|
-
for (let
|
|
1736
|
-
const id =
|
|
1812
|
+
for (let ref3 = n.names, i4 = 0, len3 = ref3.length; i4 < len3; i4++) {
|
|
1813
|
+
const id = ref3[i4];
|
|
1737
1814
|
thisAssignments2.push({
|
|
1738
1815
|
type: "AssignmentExpression",
|
|
1739
1816
|
children: [`this.${id} = `, id],
|
|
1740
1817
|
js: true
|
|
1741
1818
|
});
|
|
1742
1819
|
}
|
|
1743
|
-
|
|
1820
|
+
continue;
|
|
1744
1821
|
}
|
|
1745
1822
|
const { blockPrefix } = n;
|
|
1746
1823
|
p.push(blockPrefix);
|
|
1747
|
-
|
|
1748
|
-
}
|
|
1824
|
+
insertRestSplices(blockPrefix, p, thisAssignments2);
|
|
1825
|
+
}
|
|
1749
1826
|
}
|
|
1750
1827
|
insertRestSplices(statements, splices, thisAssignments);
|
|
1751
1828
|
return [splices, thisAssignments];
|
|
1752
1829
|
}
|
|
1753
1830
|
function arrayElementHasTrailingComma(elementNode) {
|
|
1754
|
-
let
|
|
1755
|
-
const lastChild = (
|
|
1831
|
+
let ref4;
|
|
1832
|
+
const lastChild = (ref4 = elementNode.children)[ref4.length - 1];
|
|
1756
1833
|
return lastChild && lastChild[lastChild.length - 1]?.token === ",";
|
|
1757
1834
|
}
|
|
1758
1835
|
function gatherBindingPatternTypeSuffix(pattern) {
|
|
@@ -1764,8 +1841,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1764
1841
|
case "ArrayBindingPattern": {
|
|
1765
1842
|
{
|
|
1766
1843
|
const results = [];
|
|
1767
|
-
for (let
|
|
1768
|
-
const elem =
|
|
1844
|
+
for (let ref5 = pattern.elements, i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
|
|
1845
|
+
const elem = ref5[i5];
|
|
1769
1846
|
let { typeSuffix } = elem;
|
|
1770
1847
|
typeSuffix ??= elem.binding?.typeSuffix;
|
|
1771
1848
|
if (typeSuffix) {
|
|
@@ -1803,8 +1880,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1803
1880
|
{
|
|
1804
1881
|
let restType;
|
|
1805
1882
|
const results1 = [];
|
|
1806
|
-
for (let
|
|
1807
|
-
const prop =
|
|
1883
|
+
for (let ref6 = pattern.properties, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
|
|
1884
|
+
const prop = ref6[i6];
|
|
1808
1885
|
let { typeSuffix } = prop;
|
|
1809
1886
|
typeSuffix ??= prop.value?.typeSuffix;
|
|
1810
1887
|
if (typeSuffix) {
|
|
@@ -1854,12 +1931,12 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1854
1931
|
return pattern;
|
|
1855
1932
|
}
|
|
1856
1933
|
|
|
1857
|
-
// source
|
|
1934
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
|
|
1858
1935
|
import { resolve, dirname } from "node:path";
|
|
1859
1936
|
import { createRequire } from "node:module";
|
|
1860
1937
|
import vm from "node:vm";
|
|
1861
1938
|
|
|
1862
|
-
// source
|
|
1939
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
|
|
1863
1940
|
var preludeVar = "var ";
|
|
1864
1941
|
function ts(children) {
|
|
1865
1942
|
return {
|
|
@@ -2089,7 +2166,7 @@ function extractPreludeFor(node) {
|
|
|
2089
2166
|
return state.prelude.filter((s) => gatherRecursive(s, helpers.has.bind(helpers)).length);
|
|
2090
2167
|
}
|
|
2091
2168
|
|
|
2092
|
-
// source
|
|
2169
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
|
|
2093
2170
|
function stringify(node) {
|
|
2094
2171
|
try {
|
|
2095
2172
|
return JSON.stringify(removeParentPointers(node));
|
|
@@ -2170,7 +2247,7 @@ function gen(root, options) {
|
|
|
2170
2247
|
throw new Error(`Unknown node ${stringify(node)}`);
|
|
2171
2248
|
}
|
|
2172
2249
|
}
|
|
2173
|
-
var
|
|
2250
|
+
var generate_civet_default = gen;
|
|
2174
2251
|
function prune(node) {
|
|
2175
2252
|
if (!(node != null)) {
|
|
2176
2253
|
return;
|
|
@@ -2198,7 +2275,7 @@ function prune(node) {
|
|
|
2198
2275
|
return node;
|
|
2199
2276
|
}
|
|
2200
2277
|
|
|
2201
|
-
// source
|
|
2278
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
|
|
2202
2279
|
function expressionizeComptime(statement) {
|
|
2203
2280
|
const { expressions } = statement.block;
|
|
2204
2281
|
const expression = wrapIIFE(expressions, hasAwait(expressions));
|
|
@@ -2237,7 +2314,7 @@ function runComptime(statements) {
|
|
|
2237
2314
|
content
|
|
2238
2315
|
];
|
|
2239
2316
|
const options = { js: true };
|
|
2240
|
-
let js =
|
|
2317
|
+
let js = generate_civet_default(prune(content), options);
|
|
2241
2318
|
js = `"use strict";${js}`;
|
|
2242
2319
|
if (options.errors != null) {
|
|
2243
2320
|
return;
|
|
@@ -2321,10 +2398,8 @@ function serialize(value, context) {
|
|
|
2321
2398
|
if (typeof val === "string") {
|
|
2322
2399
|
return JSON.stringify(val);
|
|
2323
2400
|
} else if (typeof val === "number") {
|
|
2324
|
-
if (Object.is(-0, val))
|
|
2325
|
-
|
|
2326
|
-
else
|
|
2327
|
-
return val.toString();
|
|
2401
|
+
if (Object.is(-0, val)) return "-0";
|
|
2402
|
+
else return val.toString();
|
|
2328
2403
|
} else if (typeof val === "boolean" || val == null) {
|
|
2329
2404
|
return String(val);
|
|
2330
2405
|
} else if (typeof val === "bigint") {
|
|
@@ -2496,6 +2571,7 @@ function serialize(value, context) {
|
|
|
2496
2571
|
ref1 = `new ${val.constructor.name}([${Array.from(val, ($1) => `${$1}n`).join(",")}])`;
|
|
2497
2572
|
break;
|
|
2498
2573
|
}
|
|
2574
|
+
// Spelled differently for browsers, where `Buffer` doesn't exist
|
|
2499
2575
|
case globalThis.Buffer?.prototype:
|
|
2500
2576
|
case context?.Buffer?.prototype: {
|
|
2501
2577
|
ref1 = `Buffer.from([${val.join(",")}])`;
|
|
@@ -2520,7 +2596,8 @@ function serialize(value, context) {
|
|
|
2520
2596
|
return recurse(value);
|
|
2521
2597
|
}
|
|
2522
2598
|
|
|
2523
|
-
// source
|
|
2599
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
|
|
2600
|
+
var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
|
|
2524
2601
|
function getTypeArguments(args) {
|
|
2525
2602
|
while (typeof args === "object" && args != null && "args" in args) {
|
|
2526
2603
|
args = args.args;
|
|
@@ -2578,8 +2655,7 @@ function wrapTypeInApplication(t, id, raw) {
|
|
|
2578
2655
|
};
|
|
2579
2656
|
}
|
|
2580
2657
|
function implicitFunctionBlock(f) {
|
|
2581
|
-
if (f.abstract || f.block || f.signature?.optional)
|
|
2582
|
-
return;
|
|
2658
|
+
if (f.abstract || f.block || f.signature?.optional) return;
|
|
2583
2659
|
const { name, parent } = f;
|
|
2584
2660
|
let ancestor = parent;
|
|
2585
2661
|
let child = f;
|
|
@@ -2718,16 +2794,14 @@ function patternAsValue(pattern) {
|
|
|
2718
2794
|
case "ArrayBindingPattern": {
|
|
2719
2795
|
const children = [...pattern.children];
|
|
2720
2796
|
const index = children.indexOf(pattern.elements);
|
|
2721
|
-
if (index < 0)
|
|
2722
|
-
throw new Error("failed to find elements in ArrayBindingPattern");
|
|
2797
|
+
if (index < 0) throw new Error("failed to find elements in ArrayBindingPattern");
|
|
2723
2798
|
const elements = children[index] = pattern.elements.map(patternAsValue);
|
|
2724
2799
|
return { ...pattern, elements, children };
|
|
2725
2800
|
}
|
|
2726
2801
|
case "ObjectBindingPattern": {
|
|
2727
2802
|
const children = [...pattern.children];
|
|
2728
2803
|
const index = children.indexOf(pattern.properties);
|
|
2729
|
-
if (index < 0)
|
|
2730
|
-
throw new Error("failed to find properties in ArrayBindingPattern");
|
|
2804
|
+
if (index < 0) throw new Error("failed to find properties in ArrayBindingPattern");
|
|
2731
2805
|
const properties = children[index] = pattern.properties.map(patternAsValue);
|
|
2732
2806
|
return { ...pattern, properties, children };
|
|
2733
2807
|
}
|
|
@@ -2820,8 +2894,7 @@ function patternBindings(pattern) {
|
|
|
2820
2894
|
}
|
|
2821
2895
|
}
|
|
2822
2896
|
function assignResults(node, collect) {
|
|
2823
|
-
if (!node)
|
|
2824
|
-
return;
|
|
2897
|
+
if (!node) return;
|
|
2825
2898
|
switch (node.type) {
|
|
2826
2899
|
case "BlockStatement":
|
|
2827
2900
|
if (node.expressions.length) {
|
|
@@ -2956,8 +3029,7 @@ function assignResults(node, collect) {
|
|
|
2956
3029
|
node[1] = collect(node[1]);
|
|
2957
3030
|
}
|
|
2958
3031
|
function insertReturn(node) {
|
|
2959
|
-
if (!node)
|
|
2960
|
-
return;
|
|
3032
|
+
if (!node) return;
|
|
2961
3033
|
switch (node.type) {
|
|
2962
3034
|
case "BlockStatement": {
|
|
2963
3035
|
if (node.expressions.length) {
|
|
@@ -2974,6 +3046,7 @@ function insertReturn(node) {
|
|
|
2974
3046
|
}
|
|
2975
3047
|
return;
|
|
2976
3048
|
}
|
|
3049
|
+
// NOTE: "CaseClause"s don't get a return statement inserted
|
|
2977
3050
|
case "WhenClause": {
|
|
2978
3051
|
if (node.break) {
|
|
2979
3052
|
const breakIndex = node.children.indexOf(node.break);
|
|
@@ -2997,8 +3070,7 @@ function insertReturn(node) {
|
|
|
2997
3070
|
return;
|
|
2998
3071
|
}
|
|
2999
3072
|
}
|
|
3000
|
-
if (!Array.isArray(node))
|
|
3001
|
-
return;
|
|
3073
|
+
if (!Array.isArray(node)) return;
|
|
3002
3074
|
let [, exp, semi] = node;
|
|
3003
3075
|
if (semi?.type === "SemicolonDelimiter") {
|
|
3004
3076
|
return;
|
|
@@ -3078,14 +3150,12 @@ function insertReturn(node) {
|
|
|
3078
3150
|
}
|
|
3079
3151
|
case "IfStatement": {
|
|
3080
3152
|
insertReturn(exp.then);
|
|
3081
|
-
if (exp.else)
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
wrapWithReturn(void 0, exp, true)
|
|
3088
|
-
]);
|
|
3153
|
+
if (exp.else) insertReturn(exp.else.block);
|
|
3154
|
+
else exp.children.push([
|
|
3155
|
+
"",
|
|
3156
|
+
// NOTE: add a prefixed semicolon because the if block may not be braced
|
|
3157
|
+
wrapWithReturn(void 0, exp, true)
|
|
3158
|
+
]);
|
|
3089
3159
|
return;
|
|
3090
3160
|
}
|
|
3091
3161
|
case "PatternMatchingStatement": {
|
|
@@ -3382,6 +3452,183 @@ function processParams(f) {
|
|
|
3382
3452
|
if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
|
|
3383
3453
|
parameters.tp.parameters.push(",");
|
|
3384
3454
|
}
|
|
3455
|
+
let tt, before = [], rest, after = [];
|
|
3456
|
+
function append2(p) {
|
|
3457
|
+
(rest ? after : before).push(p);
|
|
3458
|
+
}
|
|
3459
|
+
for (let ref16 = parameters.parameters, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
|
|
3460
|
+
const param = ref16[i8];
|
|
3461
|
+
switch (param.type) {
|
|
3462
|
+
case "ThisType": {
|
|
3463
|
+
if (tt) {
|
|
3464
|
+
append2({
|
|
3465
|
+
type: "Error",
|
|
3466
|
+
message: "Only one typed this parameter is allowed"
|
|
3467
|
+
});
|
|
3468
|
+
append2(param);
|
|
3469
|
+
} else {
|
|
3470
|
+
tt = trimFirstSpace(param);
|
|
3471
|
+
if (before.length || rest) {
|
|
3472
|
+
let ref17;
|
|
3473
|
+
let delim = (ref17 = tt.children)[ref17.length - 1];
|
|
3474
|
+
if (Array.isArray(delim)) {
|
|
3475
|
+
delim = delim[delim.length - 1];
|
|
3476
|
+
}
|
|
3477
|
+
if (!(typeof delim === "object" && delim != null && "token" in delim && delim.token === ",")) {
|
|
3478
|
+
tt = {
|
|
3479
|
+
...tt,
|
|
3480
|
+
children: [...tt.children, ", "]
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
;
|
|
3486
|
+
break;
|
|
3487
|
+
}
|
|
3488
|
+
case "FunctionRestParameter": {
|
|
3489
|
+
if (rest) {
|
|
3490
|
+
append2({
|
|
3491
|
+
type: "Error",
|
|
3492
|
+
message: "Only one rest parameter is allowed"
|
|
3493
|
+
});
|
|
3494
|
+
append2(param);
|
|
3495
|
+
} else {
|
|
3496
|
+
rest = param;
|
|
3497
|
+
}
|
|
3498
|
+
;
|
|
3499
|
+
break;
|
|
3500
|
+
}
|
|
3501
|
+
default: {
|
|
3502
|
+
append2(param);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
parameters.names = before.flatMap(($6) => $6.names);
|
|
3507
|
+
parameters.parameters.splice(0, 1 / 0, ...[]);
|
|
3508
|
+
if (tt) {
|
|
3509
|
+
parameters.parameters.push(tt);
|
|
3510
|
+
}
|
|
3511
|
+
parameters.parameters.push(...before);
|
|
3512
|
+
if (rest) {
|
|
3513
|
+
const restIdentifier = rest.binding.ref || rest.binding;
|
|
3514
|
+
parameters.names.push(...rest.names || []);
|
|
3515
|
+
rest.children.pop();
|
|
3516
|
+
if (after.length) {
|
|
3517
|
+
if (rest.binding.type === "ArrayBindingPattern" || rest.binding.type === "ObjectBindingPattern") {
|
|
3518
|
+
parameters.parameters.push({
|
|
3519
|
+
type: "Error",
|
|
3520
|
+
message: "Non-end rest parameter cannot be binding pattern"
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
after = trimFirstSpace(after);
|
|
3524
|
+
const names = after.flatMap(($7) => $7.names);
|
|
3525
|
+
const elements = after.map((p) => {
|
|
3526
|
+
if (p.type === "Error") {
|
|
3527
|
+
return p;
|
|
3528
|
+
}
|
|
3529
|
+
return {
|
|
3530
|
+
...p,
|
|
3531
|
+
// omit individual argument types from output
|
|
3532
|
+
children: p.children.filter((a2) => a2 !== p.typeSuffix),
|
|
3533
|
+
type: "BindingElement"
|
|
3534
|
+
};
|
|
3535
|
+
});
|
|
3536
|
+
const pattern = gatherBindingPatternTypeSuffix(makeNode({
|
|
3537
|
+
type: "ArrayBindingPattern",
|
|
3538
|
+
elements,
|
|
3539
|
+
length: after.length,
|
|
3540
|
+
children: ["[", elements, "]"],
|
|
3541
|
+
names
|
|
3542
|
+
}));
|
|
3543
|
+
const { typeSuffix } = pattern;
|
|
3544
|
+
const blockPrefix = parameters.blockPrefix = makeNode({
|
|
3545
|
+
type: "PostRestBindingElements",
|
|
3546
|
+
children: [
|
|
3547
|
+
pattern,
|
|
3548
|
+
" = ",
|
|
3549
|
+
restIdentifier,
|
|
3550
|
+
".splice(-",
|
|
3551
|
+
after.length.toString(),
|
|
3552
|
+
")"
|
|
3553
|
+
],
|
|
3554
|
+
elements,
|
|
3555
|
+
names
|
|
3556
|
+
});
|
|
3557
|
+
if (rest.typeSuffix) {
|
|
3558
|
+
let optionalType = function(typeSuffix3, fallback) {
|
|
3559
|
+
const t2 = typeSuffix3?.t ?? fallback;
|
|
3560
|
+
if (typeSuffix3?.optional) {
|
|
3561
|
+
return [
|
|
3562
|
+
t2,
|
|
3563
|
+
{
|
|
3564
|
+
type: "Error",
|
|
3565
|
+
message: "Optional parameter not allowed in/after rest parameter"
|
|
3566
|
+
}
|
|
3567
|
+
];
|
|
3568
|
+
}
|
|
3569
|
+
return t2;
|
|
3570
|
+
};
|
|
3571
|
+
const ref = makeRef("rest");
|
|
3572
|
+
const restRef = [
|
|
3573
|
+
{ children: [ref], ts: true },
|
|
3574
|
+
{ children: [restIdentifier], js: true }
|
|
3575
|
+
];
|
|
3576
|
+
blockPrefix.children[blockPrefix.children.indexOf(restIdentifier)] = restRef;
|
|
3577
|
+
blockPrefix.children.push({
|
|
3578
|
+
ts: true,
|
|
3579
|
+
children: [
|
|
3580
|
+
", ",
|
|
3581
|
+
restIdentifier,
|
|
3582
|
+
" = ",
|
|
3583
|
+
ref,
|
|
3584
|
+
" as ",
|
|
3585
|
+
trimFirstSpace(rest.typeSuffix.t)
|
|
3586
|
+
]
|
|
3587
|
+
});
|
|
3588
|
+
const bindingIndex = rest.rest.children.indexOf(rest.rest.binding);
|
|
3589
|
+
assert.notEqual(bindingIndex, -1, "Could not find binding in rest parameter");
|
|
3590
|
+
rest.rest.children[bindingIndex] = rest.rest.binding = { ...rest.rest.binding, js: true };
|
|
3591
|
+
rest.rest.children.splice(bindingIndex + 1, 0, {
|
|
3592
|
+
children: [ref],
|
|
3593
|
+
ts: true
|
|
3594
|
+
});
|
|
3595
|
+
const oldSuffix = rest.typeSuffix;
|
|
3596
|
+
const colon = oldSuffix.colon ?? ": ";
|
|
3597
|
+
const afterTypes = after.flatMap((p) => {
|
|
3598
|
+
return [",", optionalType(p.typeSuffix, " unknown")];
|
|
3599
|
+
});
|
|
3600
|
+
const t = [
|
|
3601
|
+
"[",
|
|
3602
|
+
"...",
|
|
3603
|
+
optionalType(oldSuffix, "unknown[]"),
|
|
3604
|
+
...afterTypes,
|
|
3605
|
+
"]"
|
|
3606
|
+
];
|
|
3607
|
+
const typeSuffix2 = makeNode({
|
|
3608
|
+
type: "TypeSuffix",
|
|
3609
|
+
ts: true,
|
|
3610
|
+
colon,
|
|
3611
|
+
t,
|
|
3612
|
+
children: [
|
|
3613
|
+
...oldSuffix.children.filter(($8) => (
|
|
3614
|
+
// spaces and colon
|
|
3615
|
+
$8 !== oldSuffix.optional && $8 !== oldSuffix.t
|
|
3616
|
+
)),
|
|
3617
|
+
!oldSuffix.colon ? colon : void 0,
|
|
3618
|
+
t
|
|
3619
|
+
]
|
|
3620
|
+
});
|
|
3621
|
+
const suffixIndex = rest.children.indexOf(rest.typeSuffix);
|
|
3622
|
+
assert.notEqual(suffixIndex, -1, "Could not find typeSuffix in rest parameter");
|
|
3623
|
+
rest.children[suffixIndex] = rest.typeSuffix = typeSuffix2;
|
|
3624
|
+
blockPrefix.children.splice(-1, 0, {
|
|
3625
|
+
ts: true,
|
|
3626
|
+
children: [" as [", afterTypes.slice(1), "]"]
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
parameters.parameters.push(rest);
|
|
3631
|
+
}
|
|
3385
3632
|
if (!block) {
|
|
3386
3633
|
return;
|
|
3387
3634
|
}
|
|
@@ -3396,28 +3643,29 @@ function processParams(f) {
|
|
|
3396
3643
|
indent = expressions[0][0];
|
|
3397
3644
|
}
|
|
3398
3645
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
3399
|
-
injectParamProps: isConstructor
|
|
3646
|
+
injectParamProps: isConstructor,
|
|
3647
|
+
assignPins: true
|
|
3400
3648
|
});
|
|
3401
3649
|
if (isConstructor) {
|
|
3402
|
-
const { ancestor } = findAncestor(f, ($
|
|
3650
|
+
const { ancestor } = findAncestor(f, ($9) => $9.type === "ClassExpression");
|
|
3403
3651
|
if (ancestor != null) {
|
|
3404
|
-
const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($
|
|
3652
|
+
const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($10) => $10.type === "FieldDefinition").map(($11) => $11.id).filter((a3) => typeof a3 === "object" && a3 != null && "type" in a3 && a3.type === "Identifier").map(($12) => $12.name));
|
|
3405
3653
|
const classExpressions = ancestor.body.expressions;
|
|
3406
|
-
let
|
|
3407
|
-
assert.notEqual(
|
|
3654
|
+
let index2 = findChildIndex(classExpressions, f);
|
|
3655
|
+
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3408
3656
|
let m4;
|
|
3409
|
-
while (m4 = classExpressions[
|
|
3410
|
-
|
|
3657
|
+
while (m4 = classExpressions[index2 - 1]?.[1], typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "MethodDefinition" && "name" in m4 && m4.name === "constructor") {
|
|
3658
|
+
index2--;
|
|
3411
3659
|
}
|
|
3412
|
-
const fStatement = classExpressions[
|
|
3413
|
-
for (let
|
|
3414
|
-
const parameter =
|
|
3660
|
+
const fStatement = classExpressions[index2];
|
|
3661
|
+
for (let ref18 = gatherRecursive(parameters, ($13) => $13.type === "Parameter"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
|
|
3662
|
+
const parameter = ref18[i9];
|
|
3415
3663
|
const { accessModifier } = parameter;
|
|
3416
3664
|
if (!(accessModifier || parameter.typeSuffix)) {
|
|
3417
3665
|
continue;
|
|
3418
3666
|
}
|
|
3419
|
-
for (let
|
|
3420
|
-
const binding =
|
|
3667
|
+
for (let ref19 = gatherRecursive(parameter, ($14) => $14.type === "AtBinding"), i10 = 0, len9 = ref19.length; i10 < len9; i10++) {
|
|
3668
|
+
const binding = ref19[i10];
|
|
3421
3669
|
const typeSuffix = binding.parent?.typeSuffix;
|
|
3422
3670
|
if (!(accessModifier || typeSuffix)) {
|
|
3423
3671
|
continue;
|
|
@@ -3430,7 +3678,7 @@ function processParams(f) {
|
|
|
3430
3678
|
if (fields.has(id)) {
|
|
3431
3679
|
continue;
|
|
3432
3680
|
}
|
|
3433
|
-
classExpressions.splice(
|
|
3681
|
+
classExpressions.splice(index2++, 0, [fStatement[0], {
|
|
3434
3682
|
type: "FieldDefinition",
|
|
3435
3683
|
id,
|
|
3436
3684
|
typeSuffix,
|
|
@@ -3445,34 +3693,53 @@ function processParams(f) {
|
|
|
3445
3693
|
type: "SemicolonDelimiter",
|
|
3446
3694
|
children: [";"]
|
|
3447
3695
|
};
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3696
|
+
let prefix = [];
|
|
3697
|
+
for (let ref20 = splices, i11 = 0, len10 = ref20.length; i11 < len10; i11++) {
|
|
3698
|
+
const binding = ref20[i11];
|
|
3699
|
+
assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
|
|
3700
|
+
prefix.push(makeNode({
|
|
3701
|
+
type: "Declaration",
|
|
3702
|
+
children: ["let ", binding],
|
|
3703
|
+
names: binding.names,
|
|
3704
|
+
bindings: [],
|
|
3705
|
+
// avoid implicit return of any bindings
|
|
3706
|
+
decl: "let"
|
|
3707
|
+
}));
|
|
3708
|
+
}
|
|
3709
|
+
concatAssign(prefix, thisAssignments);
|
|
3710
|
+
prefix = prefix.map((s) => s?.js ? ["", makeNode({
|
|
3711
|
+
// TODO: figure out how to get JS only statement tuples
|
|
3712
|
+
...s,
|
|
3713
|
+
children: [indent, ...s.children, delimiter]
|
|
3714
|
+
})] : [indent, s, delimiter]);
|
|
3455
3715
|
if (!prefix.length) {
|
|
3456
3716
|
return;
|
|
3457
3717
|
}
|
|
3718
|
+
let index = -1;
|
|
3458
3719
|
if (isConstructor) {
|
|
3459
|
-
|
|
3460
|
-
expressions,
|
|
3461
|
-
(a3) => typeof a3 === "object" && a3 != null && "type" in a3 && a3.type === "CallExpression" && "children" in a3 && Array.isArray(a3.children) && a3.children.length >= 1 && typeof a3.children[0] === "object" && a3.children[0] != null && "token" in a3.children[0] && a3.children[0].token === "super"
|
|
3462
|
-
);
|
|
3463
|
-
if (superCalls.length) {
|
|
3464
|
-
const { child } = findAncestor(superCalls[0], (a4) => a4 === block);
|
|
3465
|
-
const index = findChildIndex(expressions, child);
|
|
3466
|
-
if (index < 0) {
|
|
3467
|
-
throw new Error("Could not find super call within top-level expressions");
|
|
3468
|
-
}
|
|
3469
|
-
expressions.splice(index + 1, 0, ...prefix);
|
|
3470
|
-
return;
|
|
3471
|
-
}
|
|
3720
|
+
index = findSuperCall(block);
|
|
3472
3721
|
}
|
|
3473
|
-
expressions.
|
|
3722
|
+
expressions.splice(index + 1, 0, ...prefix);
|
|
3723
|
+
updateParentPointers(block);
|
|
3474
3724
|
braceBlock(block);
|
|
3475
3725
|
}
|
|
3726
|
+
function findSuperCall(block) {
|
|
3727
|
+
const { expressions } = block;
|
|
3728
|
+
const superCalls = gatherNodes(
|
|
3729
|
+
expressions,
|
|
3730
|
+
(a4) => typeof a4 === "object" && a4 != null && "type" in a4 && a4.type === "CallExpression" && "children" in a4 && Array.isArray(a4.children) && a4.children.length >= 1 && typeof a4.children[0] === "object" && a4.children[0] != null && "token" in a4.children[0] && a4.children[0].token === "super"
|
|
3731
|
+
);
|
|
3732
|
+
if (superCalls.length) {
|
|
3733
|
+
const { child } = findAncestor(superCalls[0], (a5) => a5 === block);
|
|
3734
|
+
const index = findChildIndex(expressions, child);
|
|
3735
|
+
if (index < 0) {
|
|
3736
|
+
throw new Error("Could not find super call within top-level expressions");
|
|
3737
|
+
}
|
|
3738
|
+
return index;
|
|
3739
|
+
} else {
|
|
3740
|
+
return -1;
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3476
3743
|
function processSignature(f) {
|
|
3477
3744
|
const { block, signature } = f;
|
|
3478
3745
|
if (!f.async?.length && hasAwait(block)) {
|
|
@@ -3480,8 +3747,8 @@ function processSignature(f) {
|
|
|
3480
3747
|
f.async.push("async ");
|
|
3481
3748
|
signature.modifier.async = true;
|
|
3482
3749
|
} else {
|
|
3483
|
-
for (let
|
|
3484
|
-
const a =
|
|
3750
|
+
for (let ref21 = gatherRecursiveWithinFunction(block, ($15) => $15.type === "Await"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
|
|
3751
|
+
const a = ref21[i12];
|
|
3485
3752
|
const i = findChildIndex(a.parent, a);
|
|
3486
3753
|
a.parent.children.splice(i + 1, 0, {
|
|
3487
3754
|
type: "Error",
|
|
@@ -3495,9 +3762,9 @@ function processSignature(f) {
|
|
|
3495
3762
|
f.generator.push("*");
|
|
3496
3763
|
signature.modifier.generator = true;
|
|
3497
3764
|
} else {
|
|
3498
|
-
for (let
|
|
3499
|
-
const y =
|
|
3500
|
-
const i = y.children.findIndex(($
|
|
3765
|
+
for (let ref22 = gatherRecursiveWithinFunction(block, ($16) => $16.type === "YieldExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
|
|
3766
|
+
const y = ref22[i13];
|
|
3767
|
+
const i = y.children.findIndex(($17) => $17.type === "Yield");
|
|
3501
3768
|
y.children.splice(i + 1, 0, {
|
|
3502
3769
|
type: "Error",
|
|
3503
3770
|
message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
|
|
@@ -3510,8 +3777,8 @@ function processSignature(f) {
|
|
|
3510
3777
|
}
|
|
3511
3778
|
}
|
|
3512
3779
|
function processFunctions(statements, config2) {
|
|
3513
|
-
for (let
|
|
3514
|
-
const f =
|
|
3780
|
+
for (let ref23 = gatherRecursiveAll(statements, ($18) => $18.type === "FunctionExpression" || $18.type === "ArrowFunction" || $18.type === "MethodDefinition"), i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
|
|
3781
|
+
const f = ref23[i14];
|
|
3515
3782
|
if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
|
|
3516
3783
|
implicitFunctionBlock(f);
|
|
3517
3784
|
}
|
|
@@ -3567,9 +3834,9 @@ function expressionizeIteration(exp) {
|
|
|
3567
3834
|
}
|
|
3568
3835
|
let done;
|
|
3569
3836
|
if (!async) {
|
|
3570
|
-
let
|
|
3571
|
-
if ((
|
|
3572
|
-
const { block: parentBlock, index } =
|
|
3837
|
+
let ref24;
|
|
3838
|
+
if ((ref24 = blockContainingStatement(exp)) && typeof ref24 === "object" && "block" in ref24 && "index" in ref24) {
|
|
3839
|
+
const { block: parentBlock, index } = ref24;
|
|
3573
3840
|
statements[0][0] = parentBlock.expressions[index][0];
|
|
3574
3841
|
parentBlock.expressions.splice(index, index + 1 - index, ...statements);
|
|
3575
3842
|
updateParentPointers(parentBlock);
|
|
@@ -3586,8 +3853,8 @@ function expressionizeIteration(exp) {
|
|
|
3586
3853
|
}
|
|
3587
3854
|
}
|
|
3588
3855
|
function processIterationExpressions(statements) {
|
|
3589
|
-
for (let
|
|
3590
|
-
const s =
|
|
3856
|
+
for (let ref25 = gatherRecursiveAll(statements, ($19) => $19.type === "IterationExpression"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
|
|
3857
|
+
const s = ref25[i15];
|
|
3591
3858
|
expressionizeIteration(s);
|
|
3592
3859
|
}
|
|
3593
3860
|
}
|
|
@@ -3608,38 +3875,40 @@ function processCoffeeDo(ws, expression) {
|
|
|
3608
3875
|
ws = trimFirstSpace(ws);
|
|
3609
3876
|
const args = [];
|
|
3610
3877
|
if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
|
|
3611
|
-
|
|
3878
|
+
let { parameters } = expression;
|
|
3879
|
+
const parameterList = parameters.parameters;
|
|
3880
|
+
const results1 = [];
|
|
3881
|
+
for (let i16 = 0, len15 = parameterList.length; i16 < len15; i16++) {
|
|
3882
|
+
let parameter = parameterList[i16];
|
|
3883
|
+
if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
|
|
3884
|
+
let ref26;
|
|
3885
|
+
if (ref26 = parameter.initializer) {
|
|
3886
|
+
const initializer = ref26;
|
|
3887
|
+
args.push(initializer.expression, parameter.delim);
|
|
3888
|
+
parameter = {
|
|
3889
|
+
...parameter,
|
|
3890
|
+
initializer: void 0,
|
|
3891
|
+
children: parameter.children.filter((a6) => a6 !== initializer)
|
|
3892
|
+
};
|
|
3893
|
+
} else {
|
|
3894
|
+
args.push(parameter.children.filter(
|
|
3895
|
+
(a7) => a7 !== parameter.typeSuffix
|
|
3896
|
+
));
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
results1.push(parameter);
|
|
3900
|
+
}
|
|
3901
|
+
;
|
|
3902
|
+
const newParameterList = results1;
|
|
3612
3903
|
const newParameters = {
|
|
3613
3904
|
...parameters,
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
for (let ref23 = parameters.children, i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
|
|
3617
|
-
let parameter = ref23[i14];
|
|
3618
|
-
if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
|
|
3619
|
-
let ref24;
|
|
3620
|
-
if (ref24 = parameter.initializer) {
|
|
3621
|
-
const initializer = ref24;
|
|
3622
|
-
args.push(initializer.expression, parameter.delim);
|
|
3623
|
-
parameter = {
|
|
3624
|
-
...parameter,
|
|
3625
|
-
initializer: void 0,
|
|
3626
|
-
children: parameter.children.filter((a5) => a5 !== initializer)
|
|
3627
|
-
};
|
|
3628
|
-
} else {
|
|
3629
|
-
args.push(parameter.children.filter(
|
|
3630
|
-
(a6) => a6 !== parameter.typeSuffix
|
|
3631
|
-
));
|
|
3632
|
-
}
|
|
3633
|
-
}
|
|
3634
|
-
results1.push(parameter);
|
|
3635
|
-
}
|
|
3636
|
-
return results1;
|
|
3637
|
-
})()
|
|
3905
|
+
parameters: newParameterList,
|
|
3906
|
+
children: parameters.children.map(($20) => $20 === parameterList ? newParameterList : $20)
|
|
3638
3907
|
};
|
|
3639
3908
|
expression = {
|
|
3640
3909
|
...expression,
|
|
3641
3910
|
parameters: newParameters,
|
|
3642
|
-
children: expression.children.map(($
|
|
3911
|
+
children: expression.children.map(($21) => $21 === parameters ? newParameters : $21)
|
|
3643
3912
|
};
|
|
3644
3913
|
}
|
|
3645
3914
|
return {
|
|
@@ -3661,12 +3930,16 @@ function makeAmpersandFunction(rhs) {
|
|
|
3661
3930
|
ref = makeRef("$");
|
|
3662
3931
|
inplacePrepend(ref, body);
|
|
3663
3932
|
}
|
|
3664
|
-
if (startsWithPredicate(body, ($
|
|
3933
|
+
if (startsWithPredicate(body, ($22) => $22.type === "ObjectExpression")) {
|
|
3665
3934
|
body = makeLeftHandSideExpression(body);
|
|
3666
3935
|
}
|
|
3936
|
+
const parameterList = [
|
|
3937
|
+
typeSuffix ? [ref, typeSuffix] : ref
|
|
3938
|
+
];
|
|
3667
3939
|
const parameters = makeNode({
|
|
3668
3940
|
type: "Parameters",
|
|
3669
|
-
children: typeSuffix ? ["(",
|
|
3941
|
+
children: typeSuffix ? ["(", parameterList, ")"] : [parameterList],
|
|
3942
|
+
parameters: parameterList,
|
|
3670
3943
|
names: []
|
|
3671
3944
|
});
|
|
3672
3945
|
const expressions = [[" ", body]];
|
|
@@ -3700,14 +3973,14 @@ function makeAmpersandFunction(rhs) {
|
|
|
3700
3973
|
}
|
|
3701
3974
|
if (gatherRecursiveWithinFunction(
|
|
3702
3975
|
block,
|
|
3703
|
-
(
|
|
3976
|
+
(a8) => a8 === ref
|
|
3704
3977
|
).length > 1) {
|
|
3705
3978
|
fn.ampersandBlock = false;
|
|
3706
3979
|
}
|
|
3707
3980
|
return fn;
|
|
3708
3981
|
}
|
|
3709
3982
|
|
|
3710
|
-
// source
|
|
3983
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
|
|
3711
3984
|
function blockWithPrefix(prefixStatements, block) {
|
|
3712
3985
|
if (prefixStatements && prefixStatements.length) {
|
|
3713
3986
|
const expressions = [...prefixStatements, ...block.expressions];
|
|
@@ -3794,10 +4067,8 @@ function getIndent(statement) {
|
|
|
3794
4067
|
if (Array.isArray(indent)) {
|
|
3795
4068
|
indent = indent.flat(Infinity);
|
|
3796
4069
|
return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
|
|
3797
|
-
if (typeof n === "string")
|
|
3798
|
-
|
|
3799
|
-
if (n.token != null)
|
|
3800
|
-
return n.token;
|
|
4070
|
+
if (typeof n === "string") return n;
|
|
4071
|
+
if (n.token != null) return n.token;
|
|
3801
4072
|
return "";
|
|
3802
4073
|
});
|
|
3803
4074
|
}
|
|
@@ -3925,7 +4196,7 @@ function blockContainingStatement(exp) {
|
|
|
3925
4196
|
};
|
|
3926
4197
|
}
|
|
3927
4198
|
|
|
3928
|
-
// source
|
|
4199
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
|
|
3929
4200
|
var precedenceOrder = [
|
|
3930
4201
|
["||", "??"],
|
|
3931
4202
|
["^^"],
|
|
@@ -3989,7 +4260,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
3989
4260
|
while (i < expandedOps.length) {
|
|
3990
4261
|
let op = expandedOps[i];
|
|
3991
4262
|
if (op.special) {
|
|
3992
|
-
let
|
|
4263
|
+
let advanceLeft = function(allowEqual) {
|
|
3993
4264
|
while (start >= 4) {
|
|
3994
4265
|
const prevPrec = getPrecedence(expandedOps[start - 2]);
|
|
3995
4266
|
if (!(prevPrec > prec || allowEqual && prevPrec === prec)) {
|
|
@@ -3998,7 +4269,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
3998
4269
|
start -= 4;
|
|
3999
4270
|
}
|
|
4000
4271
|
return false;
|
|
4001
|
-
},
|
|
4272
|
+
}, advanceRight = function(allowEqual) {
|
|
4002
4273
|
while (end + 4 < expandedOps.length) {
|
|
4003
4274
|
const nextPrec = getPrecedence(expandedOps[end + 2]);
|
|
4004
4275
|
if (!(nextPrec > prec || allowEqual && nextPrec === prec)) {
|
|
@@ -4008,24 +4279,23 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4008
4279
|
}
|
|
4009
4280
|
return false;
|
|
4010
4281
|
};
|
|
4011
|
-
var advanceLeft = advanceLeft2, advanceRight = advanceRight2;
|
|
4012
4282
|
let start = i - 2, end = i + 2;
|
|
4013
4283
|
const prec = getPrecedence(op);
|
|
4014
4284
|
let error;
|
|
4015
4285
|
switch (op.assoc) {
|
|
4016
4286
|
case "left":
|
|
4017
4287
|
case void 0: {
|
|
4018
|
-
|
|
4019
|
-
|
|
4288
|
+
advanceLeft(true);
|
|
4289
|
+
advanceRight(false);
|
|
4020
4290
|
break;
|
|
4021
4291
|
}
|
|
4022
4292
|
case "right": {
|
|
4023
|
-
|
|
4024
|
-
|
|
4293
|
+
advanceLeft(false);
|
|
4294
|
+
advanceRight(true);
|
|
4025
4295
|
break;
|
|
4026
4296
|
}
|
|
4027
4297
|
case "non": {
|
|
4028
|
-
if (
|
|
4298
|
+
if (advanceLeft(false) || advanceRight(false)) {
|
|
4029
4299
|
error = {
|
|
4030
4300
|
type: "Error",
|
|
4031
4301
|
message: `non-associative operator ${op.token} used at same precedence level without parenthesization`
|
|
@@ -4035,13 +4305,13 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4035
4305
|
break;
|
|
4036
4306
|
}
|
|
4037
4307
|
case "arguments": {
|
|
4038
|
-
if (
|
|
4308
|
+
if (advanceLeft(false)) {
|
|
4039
4309
|
error = {
|
|
4040
4310
|
type: "Error",
|
|
4041
4311
|
message: `arguments operator ${op.token} used at same precedence level as ${expandedOps[start - 2].token} to the left`
|
|
4042
4312
|
};
|
|
4043
4313
|
}
|
|
4044
|
-
|
|
4314
|
+
advanceRight(true);
|
|
4045
4315
|
break;
|
|
4046
4316
|
}
|
|
4047
4317
|
default: {
|
|
@@ -4125,13 +4395,11 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4125
4395
|
type = "CallExpression";
|
|
4126
4396
|
} else if (op.token) {
|
|
4127
4397
|
children = [a, wsOp, op, wsB, b];
|
|
4128
|
-
if (op.negated)
|
|
4129
|
-
children = ["(", ...children, ")"];
|
|
4398
|
+
if (op.negated) children = ["(", ...children, ")"];
|
|
4130
4399
|
} else {
|
|
4131
4400
|
throw new Error("Unknown operator: " + JSON.stringify(op));
|
|
4132
4401
|
}
|
|
4133
|
-
if (op.negated)
|
|
4134
|
-
children.unshift("!");
|
|
4402
|
+
if (op.negated) children.unshift("!");
|
|
4135
4403
|
if (error != null) {
|
|
4136
4404
|
children.push(error);
|
|
4137
4405
|
}
|
|
@@ -4264,7 +4532,7 @@ function expandChainedComparisons([first, binops]) {
|
|
|
4264
4532
|
}
|
|
4265
4533
|
}
|
|
4266
4534
|
|
|
4267
|
-
// source
|
|
4535
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
|
|
4268
4536
|
function processPatternTest(lhs, patterns) {
|
|
4269
4537
|
const { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m");
|
|
4270
4538
|
const conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
|
|
@@ -4386,8 +4654,7 @@ function processPatternMatching(statements) {
|
|
|
4386
4654
|
});
|
|
4387
4655
|
}
|
|
4388
4656
|
function getPatternConditions(pattern, ref, conditions = []) {
|
|
4389
|
-
if (pattern.rest)
|
|
4390
|
-
return conditions;
|
|
4657
|
+
if (pattern.rest) return conditions;
|
|
4391
4658
|
switch (pattern.type) {
|
|
4392
4659
|
case "ArrayBindingPattern": {
|
|
4393
4660
|
const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), l = (length - +hasRest).toString(), lengthCheck = hasRest ? [ref, ".length >= ", l] : [getHelperRef("len"), "(", ref, ", ", l, ")"];
|
|
@@ -4498,7 +4765,7 @@ function getPatternConditions(pattern, ref, conditions = []) {
|
|
|
4498
4765
|
}
|
|
4499
4766
|
return conditions;
|
|
4500
4767
|
}
|
|
4501
|
-
function getPatternBlockPrefix(pattern, ref, decl = "const ",
|
|
4768
|
+
function getPatternBlockPrefix(pattern, ref, decl = "const ", typeSuffix) {
|
|
4502
4769
|
switch (pattern.type) {
|
|
4503
4770
|
case "ArrayBindingPattern": {
|
|
4504
4771
|
if (!pattern.length) {
|
|
@@ -4529,7 +4796,7 @@ function getPatternBlockPrefix(pattern, ref, decl = "const ", suffix) {
|
|
|
4529
4796
|
return [
|
|
4530
4797
|
["", {
|
|
4531
4798
|
type: "Declaration",
|
|
4532
|
-
children: [decl, patternBindings2,
|
|
4799
|
+
children: [decl, patternBindings2, typeSuffix, " = ", ref, ...splices],
|
|
4533
4800
|
names: [],
|
|
4534
4801
|
bindings: []
|
|
4535
4802
|
// avoid implicit return of any bindings
|
|
@@ -4718,7 +4985,7 @@ function aliasBinding(p, ref) {
|
|
|
4718
4985
|
}
|
|
4719
4986
|
}
|
|
4720
4987
|
|
|
4721
|
-
// source
|
|
4988
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
|
|
4722
4989
|
function len2(arr, length) {
|
|
4723
4990
|
return arr.length === length;
|
|
4724
4991
|
}
|
|
@@ -4762,21 +5029,51 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
|
|
|
4762
5029
|
});
|
|
4763
5030
|
}
|
|
4764
5031
|
function processDeclarations(statements) {
|
|
4765
|
-
gatherRecursiveAll(statements, ($) => $.type === "Declaration").
|
|
4766
|
-
const
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
const
|
|
5032
|
+
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len1 = ref1.length; i1 < len1; i1++) {
|
|
5033
|
+
const declaration = ref1[i1];
|
|
5034
|
+
const { bindings } = declaration;
|
|
5035
|
+
if (!(bindings != null)) {
|
|
5036
|
+
continue;
|
|
5037
|
+
}
|
|
5038
|
+
for (let i2 = 0, len22 = bindings.length; i2 < len22; i2++) {
|
|
5039
|
+
const binding = bindings[i2];
|
|
5040
|
+
let { typeSuffix, initializer } = binding;
|
|
5041
|
+
if (typeSuffix && typeSuffix.optional) {
|
|
5042
|
+
if (initializer && !typeSuffix.t) {
|
|
5043
|
+
const expression = trimFirstSpace(initializer.expression);
|
|
5044
|
+
let m;
|
|
5045
|
+
if (m = expression.type, m === "Identifier" || m === "MemberExpression") {
|
|
5046
|
+
typeSuffix.children.push(": ", typeSuffix.t = {
|
|
5047
|
+
type: "TypeTypeof",
|
|
5048
|
+
children: ["typeof ", expression],
|
|
5049
|
+
expression
|
|
5050
|
+
});
|
|
5051
|
+
} else if (expression.type === "Literal" || expression.type === "RegularExpressionLiteral" || expression.type === "TemplateLiteral") {
|
|
5052
|
+
typeSuffix.children.push(": ", typeSuffix.t = literalType(expression));
|
|
5053
|
+
} else {
|
|
5054
|
+
spliceChild(binding, typeSuffix, 1, {
|
|
5055
|
+
type: "Error",
|
|
5056
|
+
message: `Optional type can only be inferred from literals or member expressions, not ${expression.type}`
|
|
5057
|
+
});
|
|
5058
|
+
continue;
|
|
5059
|
+
}
|
|
5060
|
+
}
|
|
5061
|
+
if (typeSuffix.t) {
|
|
5062
|
+
convertOptionalType(typeSuffix);
|
|
5063
|
+
} else {
|
|
5064
|
+
spliceChild(binding, typeSuffix, 1);
|
|
5065
|
+
binding.children.push(initializer = binding.initializer = {
|
|
5066
|
+
type: "Initializer",
|
|
5067
|
+
expression: "undefined",
|
|
5068
|
+
children: [" = ", "undefined"]
|
|
5069
|
+
});
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
4773
5072
|
if (initializer) {
|
|
4774
|
-
|
|
5073
|
+
prependStatementExpressionBlock(initializer, declaration);
|
|
4775
5074
|
}
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
});
|
|
4779
|
-
});
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
4780
5077
|
}
|
|
4781
5078
|
function prependStatementExpressionBlock(initializer, statement) {
|
|
4782
5079
|
let { expression: exp } = initializer;
|
|
@@ -4938,16 +5235,16 @@ function processDeclarationConditionStatement(s) {
|
|
|
4938
5235
|
if (conditions.length) {
|
|
4939
5236
|
let children = condition.children;
|
|
4940
5237
|
if (s.negated) {
|
|
4941
|
-
let
|
|
4942
|
-
if (!(
|
|
5238
|
+
let m1;
|
|
5239
|
+
if (!(m1 = condition.expression, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "UnaryExpression" && "children" in m1 && Array.isArray(m1.children) && len2(m1.children, 2) && Array.isArray(m1.children[0]) && len2(m1.children[0], 1) && m1.children[0][0] === "!" && typeof m1.children[1] === "object" && m1.children[1] != null && "type" in m1.children[1] && m1.children[1].type === "ParenthesizedExpression")) {
|
|
4943
5240
|
throw new Error("Unsupported negated condition");
|
|
4944
5241
|
}
|
|
4945
5242
|
;
|
|
4946
5243
|
({ children } = condition.expression.children[1]);
|
|
4947
5244
|
}
|
|
4948
5245
|
children.unshift("(");
|
|
4949
|
-
for (let
|
|
4950
|
-
const c = conditions[
|
|
5246
|
+
for (let i3 = 0, len3 = conditions.length; i3 < len3; i3++) {
|
|
5247
|
+
const c = conditions[i3];
|
|
4951
5248
|
children.push(" && ", c);
|
|
4952
5249
|
}
|
|
4953
5250
|
children.push(")");
|
|
@@ -4969,11 +5266,11 @@ function processDeclarationConditionStatement(s) {
|
|
|
4969
5266
|
ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
|
|
4970
5267
|
updateParentPointers(ancestor);
|
|
4971
5268
|
braceBlock(ancestor);
|
|
4972
|
-
let
|
|
5269
|
+
let ref2;
|
|
4973
5270
|
switch (s.type) {
|
|
4974
5271
|
case "IfStatement": {
|
|
4975
|
-
if (
|
|
4976
|
-
const elseBlock =
|
|
5272
|
+
if (ref2 = s.else?.block) {
|
|
5273
|
+
const elseBlock = ref2;
|
|
4977
5274
|
if (elseBlock.bare && !elseBlock.semicolon) {
|
|
4978
5275
|
elseBlock.children.push(elseBlock.semicolon = ";");
|
|
4979
5276
|
}
|
|
@@ -5064,11 +5361,12 @@ function processDeclarationConditionStatement(s) {
|
|
|
5064
5361
|
function dynamizeFromClause(from) {
|
|
5065
5362
|
from = from.slice(1);
|
|
5066
5363
|
from = trimFirstSpace(from);
|
|
5067
|
-
let
|
|
5068
|
-
if (
|
|
5069
|
-
const assert2 =
|
|
5070
|
-
let
|
|
5071
|
-
|
|
5364
|
+
let ref3;
|
|
5365
|
+
if (ref3 = from[from.length - 1]?.assertion) {
|
|
5366
|
+
const assert2 = ref3;
|
|
5367
|
+
let ref4;
|
|
5368
|
+
ref4 = from[from.length - 1];
|
|
5369
|
+
ref4.children = ref4.children.filter((a2) => a2 !== assert2);
|
|
5072
5370
|
from.push(", {", assert2.keyword, ":", assert2.object, "}");
|
|
5073
5371
|
}
|
|
5074
5372
|
return ["(", ...from, ")"];
|
|
@@ -5077,20 +5375,20 @@ function dynamizeImportDeclaration(decl) {
|
|
|
5077
5375
|
const { imports } = decl;
|
|
5078
5376
|
let { star, binding, specifiers } = imports;
|
|
5079
5377
|
const justDefault = binding && !specifiers && !star;
|
|
5080
|
-
let
|
|
5378
|
+
let ref5;
|
|
5081
5379
|
{
|
|
5082
5380
|
if (binding) {
|
|
5083
5381
|
if (specifiers) {
|
|
5084
|
-
|
|
5382
|
+
ref5 = makeRef();
|
|
5085
5383
|
} else {
|
|
5086
|
-
|
|
5384
|
+
ref5 = binding;
|
|
5087
5385
|
}
|
|
5088
5386
|
} else {
|
|
5089
|
-
|
|
5387
|
+
ref5 = convertNamedImportsToObject(imports, true);
|
|
5090
5388
|
}
|
|
5091
5389
|
}
|
|
5092
5390
|
;
|
|
5093
|
-
const pattern =
|
|
5391
|
+
const pattern = ref5;
|
|
5094
5392
|
const c = "const";
|
|
5095
5393
|
const expression = [
|
|
5096
5394
|
justDefault ? "(" : void 0,
|
|
@@ -5213,7 +5511,7 @@ function convertWithClause(withClause, extendsClause) {
|
|
|
5213
5511
|
return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
|
|
5214
5512
|
}
|
|
5215
5513
|
|
|
5216
|
-
// source
|
|
5514
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
|
|
5217
5515
|
function processUnaryExpression(pre, exp, post) {
|
|
5218
5516
|
if (!(pre.length || post)) {
|
|
5219
5517
|
return exp;
|
|
@@ -5375,7 +5673,7 @@ function processUnaryNestedExpression(pre, args, post) {
|
|
|
5375
5673
|
return processUnaryExpression(pre, args, post);
|
|
5376
5674
|
}
|
|
5377
5675
|
|
|
5378
|
-
// source
|
|
5676
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
|
|
5379
5677
|
function constructInvocation(fn, arg) {
|
|
5380
5678
|
let expr = fn.expr;
|
|
5381
5679
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -5398,11 +5696,9 @@ function constructInvocation(fn, arg) {
|
|
|
5398
5696
|
lhs = makeLeftHandSideExpression(lhs);
|
|
5399
5697
|
}
|
|
5400
5698
|
let comment = skipIfOnlyWS(fn.trailingComment);
|
|
5401
|
-
if (comment)
|
|
5402
|
-
lhs.children.push(comment);
|
|
5699
|
+
if (comment) lhs.children.push(comment);
|
|
5403
5700
|
comment = skipIfOnlyWS(fn.leadingComment);
|
|
5404
|
-
if (comment)
|
|
5405
|
-
lhs.children.splice(1, 0, comment);
|
|
5701
|
+
if (comment) lhs.children.splice(1, 0, comment);
|
|
5406
5702
|
switch (arg.type) {
|
|
5407
5703
|
case "CommaExpression": {
|
|
5408
5704
|
arg = makeLeftHandSideExpression(arg);
|
|
@@ -5491,27 +5787,26 @@ function processPipelineExpressions(statements) {
|
|
|
5491
5787
|
let initRef;
|
|
5492
5788
|
if (i2 === 0) {
|
|
5493
5789
|
checkValidLHS(arg);
|
|
5494
|
-
outer:
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
if (arg.children.length <= 2) {
|
|
5498
|
-
break;
|
|
5499
|
-
}
|
|
5500
|
-
}
|
|
5501
|
-
case "CallExpression": {
|
|
5502
|
-
const access = arg.children.pop();
|
|
5503
|
-
usingRef = makeRef();
|
|
5504
|
-
initRef = {
|
|
5505
|
-
type: "AssignmentExpression",
|
|
5506
|
-
children: [usingRef, " = ", arg, comma]
|
|
5507
|
-
};
|
|
5508
|
-
arg = {
|
|
5509
|
-
type: "MemberExpression",
|
|
5510
|
-
children: [usingRef, access]
|
|
5511
|
-
};
|
|
5790
|
+
outer: switch (arg.type) {
|
|
5791
|
+
case "MemberExpression": {
|
|
5792
|
+
if (arg.children.length <= 2) {
|
|
5512
5793
|
break;
|
|
5513
5794
|
}
|
|
5514
5795
|
}
|
|
5796
|
+
case "CallExpression": {
|
|
5797
|
+
const access = arg.children.pop();
|
|
5798
|
+
usingRef = makeRef();
|
|
5799
|
+
initRef = {
|
|
5800
|
+
type: "AssignmentExpression",
|
|
5801
|
+
children: [usingRef, " = ", arg, comma]
|
|
5802
|
+
};
|
|
5803
|
+
arg = {
|
|
5804
|
+
type: "MemberExpression",
|
|
5805
|
+
children: [usingRef, access]
|
|
5806
|
+
};
|
|
5807
|
+
break;
|
|
5808
|
+
}
|
|
5809
|
+
}
|
|
5515
5810
|
const lhs = [[
|
|
5516
5811
|
[initRef],
|
|
5517
5812
|
arg,
|
|
@@ -5539,8 +5834,7 @@ function processPipelineExpressions(statements) {
|
|
|
5539
5834
|
});
|
|
5540
5835
|
}
|
|
5541
5836
|
} else {
|
|
5542
|
-
if (i2 === 0)
|
|
5543
|
-
s.children = children;
|
|
5837
|
+
if (i2 === 0) s.children = children;
|
|
5544
5838
|
}
|
|
5545
5839
|
if (returns && (ref = needsRef(arg))) {
|
|
5546
5840
|
usingRef = usingRef || ref;
|
|
@@ -5604,7 +5898,7 @@ function processPipelineExpressions(statements) {
|
|
|
5604
5898
|
});
|
|
5605
5899
|
}
|
|
5606
5900
|
|
|
5607
|
-
// source
|
|
5901
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
|
|
5608
5902
|
function processRangeExpression(start, ws1, range, end) {
|
|
5609
5903
|
ws1 = [ws1, range.children[0]];
|
|
5610
5904
|
const ws2 = range.children[1];
|
|
@@ -5627,10 +5921,8 @@ function processRangeExpression(start, ws1, range, end) {
|
|
|
5627
5921
|
const abs = ref;
|
|
5628
5922
|
const lengthAdjust = 1 - Number(!range.left.inclusive) - Number(!range.right.inclusive);
|
|
5629
5923
|
let ref1;
|
|
5630
|
-
if (lengthAdjust > 0)
|
|
5631
|
-
|
|
5632
|
-
else if (lengthAdjust < 0)
|
|
5633
|
-
ref1 = ` - ${-lengthAdjust}`;
|
|
5924
|
+
if (lengthAdjust > 0) ref1 = ` + ${lengthAdjust}`;
|
|
5925
|
+
else if (lengthAdjust < 0) ref1 = ` - ${-lengthAdjust}`;
|
|
5634
5926
|
else {
|
|
5635
5927
|
ref1 = void 0;
|
|
5636
5928
|
}
|
|
@@ -5766,10 +6058,8 @@ function forRange(open, forDeclaration, range, stepExp, close) {
|
|
|
5766
6058
|
asc = stepValue > 0;
|
|
5767
6059
|
}
|
|
5768
6060
|
let ref3;
|
|
5769
|
-
if (stepRef)
|
|
5770
|
-
|
|
5771
|
-
else
|
|
5772
|
-
ref3 = maybeRef(start, "start");
|
|
6061
|
+
if (stepRef) ref3 = start;
|
|
6062
|
+
else ref3 = maybeRef(start, "start");
|
|
5773
6063
|
let startRef = ref3;
|
|
5774
6064
|
let endRef = maybeRef(end, "end");
|
|
5775
6065
|
const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
|
|
@@ -5946,8 +6236,7 @@ function processForInOf($0) {
|
|
|
5946
6236
|
};
|
|
5947
6237
|
}
|
|
5948
6238
|
let ws2, decl2;
|
|
5949
|
-
if (declaration2)
|
|
5950
|
-
[, , ws2, decl2] = declaration2;
|
|
6239
|
+
if (declaration2) [, , ws2, decl2] = declaration2;
|
|
5951
6240
|
switch (inOf.token) {
|
|
5952
6241
|
case "of": {
|
|
5953
6242
|
const counterRef = makeRef("i");
|
|
@@ -6012,8 +6301,8 @@ function processForInOf($0) {
|
|
|
6012
6301
|
};
|
|
6013
6302
|
}
|
|
6014
6303
|
|
|
6015
|
-
// source
|
|
6016
|
-
var
|
|
6304
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
|
|
6305
|
+
var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
|
|
6017
6306
|
function findDecs(statements) {
|
|
6018
6307
|
const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
|
|
6019
6308
|
const declarationNames = declarations.flatMap((d) => d.names);
|
|
@@ -6068,8 +6357,7 @@ function createConstLetDecs(statements, scopes, letOrConst) {
|
|
|
6068
6357
|
}
|
|
6069
6358
|
continue;
|
|
6070
6359
|
}
|
|
6071
|
-
if (node.names == null)
|
|
6072
|
-
continue;
|
|
6360
|
+
if (node.names == null) continue;
|
|
6073
6361
|
let names = node.names.filter((name) => !hasDec(name));
|
|
6074
6362
|
if (node.type == "AssignmentExpression") {
|
|
6075
6363
|
undeclaredIdentifiers.push(...names);
|
|
@@ -6105,19 +6393,17 @@ function createVarDecs(block, scopes, pushVar) {
|
|
|
6105
6393
|
function findAssignments(statements2, decs2) {
|
|
6106
6394
|
let assignmentStatements2 = gatherNodes(statements2, ($3) => $3.type === "AssignmentExpression");
|
|
6107
6395
|
if (assignmentStatements2.length) {
|
|
6108
|
-
|
|
6396
|
+
concatAssign2(
|
|
6109
6397
|
assignmentStatements2,
|
|
6110
6398
|
findAssignments(assignmentStatements2.map((s) => s.children), decs2)
|
|
6111
6399
|
);
|
|
6112
6400
|
}
|
|
6113
6401
|
return assignmentStatements2;
|
|
6114
6402
|
}
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
};
|
|
6120
|
-
}
|
|
6403
|
+
pushVar ??= (name) => {
|
|
6404
|
+
varIds.push(name);
|
|
6405
|
+
return decs.add(name);
|
|
6406
|
+
};
|
|
6121
6407
|
const { expressions: statements } = block;
|
|
6122
6408
|
const decs = findDecs(statements);
|
|
6123
6409
|
scopes.push(decs);
|
|
@@ -6125,8 +6411,7 @@ function createVarDecs(block, scopes, pushVar) {
|
|
|
6125
6411
|
const assignmentStatements = findAssignments(statements, scopes);
|
|
6126
6412
|
const undeclaredIdentifiers = assignmentStatements.flatMap(($4) => $4?.names || []);
|
|
6127
6413
|
undeclaredIdentifiers.filter((x, i, a) => {
|
|
6128
|
-
if (!hasDec(x))
|
|
6129
|
-
return a.indexOf(x) === i;
|
|
6414
|
+
if (!hasDec(x)) return a.indexOf(x) === i;
|
|
6130
6415
|
return;
|
|
6131
6416
|
}).forEach(pushVar);
|
|
6132
6417
|
const fnNodes = gatherNodes(statements, isFunction);
|
|
@@ -6162,7 +6447,7 @@ function createVarDecs(block, scopes, pushVar) {
|
|
|
6162
6447
|
scopes.pop();
|
|
6163
6448
|
}
|
|
6164
6449
|
|
|
6165
|
-
// source
|
|
6450
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
|
|
6166
6451
|
function getIndentLevel(str, tab) {
|
|
6167
6452
|
if (tab != null && tab != 1) {
|
|
6168
6453
|
const tabs = str.match(/\t/g);
|
|
@@ -6330,7 +6615,7 @@ function quoteString(str) {
|
|
|
6330
6615
|
return JSON.stringify(str);
|
|
6331
6616
|
}
|
|
6332
6617
|
|
|
6333
|
-
// source
|
|
6618
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
|
|
6334
6619
|
var xor = (a, b) => a ? !b && a : b;
|
|
6335
6620
|
function addPostfixStatement(statement, ws, post) {
|
|
6336
6621
|
const expressions = [
|
|
@@ -6344,8 +6629,7 @@ function addPostfixStatement(statement, ws, post) {
|
|
|
6344
6629
|
bare: false
|
|
6345
6630
|
});
|
|
6346
6631
|
const children = [...post.children, block];
|
|
6347
|
-
if (!isWhitespaceOrEmpty(ws))
|
|
6348
|
-
children.push(ws);
|
|
6632
|
+
if (!isWhitespaceOrEmpty(ws)) children.push(ws);
|
|
6349
6633
|
post = makeNode({ ...post, children, block });
|
|
6350
6634
|
if (post.type === "IfStatement") {
|
|
6351
6635
|
post.then = block;
|
|
@@ -6417,8 +6701,7 @@ function expressionizeBlock(blockOrExpression) {
|
|
|
6417
6701
|
let i1 = 0;
|
|
6418
6702
|
for (const [ws, s, _delim] of expressions) {
|
|
6419
6703
|
const i = i1++;
|
|
6420
|
-
if (!isExpression(s))
|
|
6421
|
-
return;
|
|
6704
|
+
if (!isExpression(s)) return;
|
|
6422
6705
|
const wrapped = makeLeftHandSideExpression(s);
|
|
6423
6706
|
if (i === l - 1) {
|
|
6424
6707
|
results.push([ws, wrapped]);
|
|
@@ -6780,8 +7063,7 @@ function processCallMemberExpression(node) {
|
|
|
6780
7063
|
prefix = [ref].concat(glob.dot);
|
|
6781
7064
|
}
|
|
6782
7065
|
}
|
|
6783
|
-
if (wValue)
|
|
6784
|
-
value.unshift(wValue);
|
|
7066
|
+
if (wValue) value.unshift(wValue);
|
|
6785
7067
|
if (part.type === "SpreadProperty") {
|
|
6786
7068
|
parts.push({
|
|
6787
7069
|
type: part.type,
|
|
@@ -6824,8 +7106,7 @@ function processCallMemberExpression(node) {
|
|
|
6824
7106
|
],
|
|
6825
7107
|
properties: parts
|
|
6826
7108
|
};
|
|
6827
|
-
if (i === children.length - 1)
|
|
6828
|
-
return object;
|
|
7109
|
+
if (i === children.length - 1) return object;
|
|
6829
7110
|
return processCallMemberExpression({
|
|
6830
7111
|
// in case there are more
|
|
6831
7112
|
...node,
|
|
@@ -6966,10 +7247,8 @@ function lastAccessInCallExpression(exp) {
|
|
|
6966
7247
|
;
|
|
6967
7248
|
({ children } = exp);
|
|
6968
7249
|
i = children.length - 1;
|
|
6969
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
|
|
6970
|
-
|
|
6971
|
-
if (i < 0)
|
|
6972
|
-
return;
|
|
7250
|
+
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7251
|
+
if (i < 0) return;
|
|
6973
7252
|
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
6974
7253
|
return children[i];
|
|
6975
7254
|
}
|
|
@@ -7042,8 +7321,7 @@ function convertObjectToJSXAttributes(obj) {
|
|
|
7042
7321
|
rest.push(part);
|
|
7043
7322
|
continue;
|
|
7044
7323
|
}
|
|
7045
|
-
if (i > 0)
|
|
7046
|
-
parts.push(" ");
|
|
7324
|
+
if (i > 0) parts.push(" ");
|
|
7047
7325
|
switch (part.type) {
|
|
7048
7326
|
case "Identifier": {
|
|
7049
7327
|
parts.push([part.name, "={", part.name, "}"]);
|
|
@@ -7089,16 +7367,16 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
|
|
|
7089
7367
|
const { token } = kind;
|
|
7090
7368
|
ws = trimFirstSpace(ws);
|
|
7091
7369
|
let setVal;
|
|
7092
|
-
const
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7370
|
+
const parameterList = [];
|
|
7371
|
+
const isGet = token === "get";
|
|
7372
|
+
if (!isGet) {
|
|
7373
|
+
parameterList.push(setVal = makeRef("value"));
|
|
7374
|
+
}
|
|
7375
|
+
const parameters = {
|
|
7098
7376
|
type: "Parameters",
|
|
7099
|
-
children: ["(",
|
|
7100
|
-
|
|
7101
|
-
implicit:
|
|
7377
|
+
children: ["(", parameterList, ")"],
|
|
7378
|
+
parameters: parameterList,
|
|
7379
|
+
implicit: isGet
|
|
7102
7380
|
};
|
|
7103
7381
|
let expressions;
|
|
7104
7382
|
if (block) {
|
|
@@ -7114,7 +7392,7 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
|
|
|
7114
7392
|
};
|
|
7115
7393
|
}
|
|
7116
7394
|
if (autoReturn) {
|
|
7117
|
-
const finalStatement =
|
|
7395
|
+
const finalStatement = isGet ? [[expressions[0]?.[0] || "", ws], wrapWithReturn(value)] : [[expressions[0]?.[0] || "", ws], [value, " = ", setVal]];
|
|
7118
7396
|
expressions.push(finalStatement);
|
|
7119
7397
|
}
|
|
7120
7398
|
const children = [kind, " ", name, parameters, returnType, block];
|
|
@@ -7143,7 +7421,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7143
7421
|
}
|
|
7144
7422
|
function processAssignments(statements) {
|
|
7145
7423
|
for (let ref7 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref7.length; i5 < len3; i5++) {
|
|
7146
|
-
let
|
|
7424
|
+
let extractAssignment = function(lhs) {
|
|
7147
7425
|
let expr = lhs;
|
|
7148
7426
|
while (expr.type === "ParenthesizedExpression") {
|
|
7149
7427
|
expr = expr.expression;
|
|
@@ -7162,7 +7440,6 @@ function processAssignments(statements) {
|
|
|
7162
7440
|
;
|
|
7163
7441
|
return;
|
|
7164
7442
|
};
|
|
7165
|
-
var extractAssignment = extractAssignment2;
|
|
7166
7443
|
const exp = ref7[i5];
|
|
7167
7444
|
checkValidLHS(exp.assigned);
|
|
7168
7445
|
const pre = [], post = [];
|
|
@@ -7175,7 +7452,7 @@ function processAssignments(statements) {
|
|
|
7175
7452
|
for (let ref9 = exp.lhs, i6 = 0, len4 = ref9.length; i6 < len4; i6++) {
|
|
7176
7453
|
const lhsPart = ref9[i6];
|
|
7177
7454
|
let ref10;
|
|
7178
|
-
if (ref10 =
|
|
7455
|
+
if (ref10 = extractAssignment(lhsPart[1])) {
|
|
7179
7456
|
const newLhs = ref10;
|
|
7180
7457
|
lhsPart[1] = newLhs;
|
|
7181
7458
|
}
|
|
@@ -7184,7 +7461,7 @@ function processAssignments(statements) {
|
|
|
7184
7461
|
break;
|
|
7185
7462
|
}
|
|
7186
7463
|
case "UpdateExpression": {
|
|
7187
|
-
if (ref8 =
|
|
7464
|
+
if (ref8 = extractAssignment(exp.assigned)) {
|
|
7188
7465
|
const newLhs = ref8;
|
|
7189
7466
|
const i = exp.children.indexOf(exp.assigned);
|
|
7190
7467
|
exp.assigned = exp.children[i] = newLhs;
|
|
@@ -7240,13 +7517,11 @@ function processAssignments(statements) {
|
|
|
7240
7517
|
}
|
|
7241
7518
|
}
|
|
7242
7519
|
if ($1.some(($8) => $8[$8.length - 1].special)) {
|
|
7243
|
-
if ($1.length !== 1)
|
|
7244
|
-
throw new Error("Only one assignment with id= is allowed");
|
|
7520
|
+
if ($1.length !== 1) throw new Error("Only one assignment with id= is allowed");
|
|
7245
7521
|
const [, lhs, , op] = $1[0];
|
|
7246
7522
|
const { call, omitLhs } = op;
|
|
7247
7523
|
const index = exp.children.indexOf($2);
|
|
7248
|
-
if (index < 0)
|
|
7249
|
-
throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7524
|
+
if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7250
7525
|
exp.children.splice(
|
|
7251
7526
|
index,
|
|
7252
7527
|
1,
|
|
@@ -7297,8 +7572,7 @@ function processAssignments(statements) {
|
|
|
7297
7572
|
c[4] = [", ...", $2];
|
|
7298
7573
|
c[5] = ")";
|
|
7299
7574
|
lastAssignment.pop();
|
|
7300
|
-
if (isWhitespaceOrEmpty(lastAssignment[2]))
|
|
7301
|
-
lastAssignment.pop();
|
|
7575
|
+
if (isWhitespaceOrEmpty(lastAssignment[2])) lastAssignment.pop();
|
|
7302
7576
|
if ($1.length > 1) {
|
|
7303
7577
|
throw new Error("Not implemented yet! TODO: Handle multiple splice assignments");
|
|
7304
7578
|
}
|
|
@@ -7358,8 +7632,7 @@ function processAssignments(statements) {
|
|
|
7358
7632
|
exp.names = $1.flatMap(([, l]) => l.names || []);
|
|
7359
7633
|
if (tail.length) {
|
|
7360
7634
|
const index = exp.children.indexOf($2);
|
|
7361
|
-
if (index < 0)
|
|
7362
|
-
throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7635
|
+
if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7363
7636
|
exp.children.splice(index + 1, 0, ...tail);
|
|
7364
7637
|
}
|
|
7365
7638
|
if (block) {
|
|
@@ -7536,10 +7809,8 @@ function processTypes(node) {
|
|
|
7536
7809
|
const space = getTrimmingSpace(unary);
|
|
7537
7810
|
inplaceInsertTrimmingSpace(unary, "");
|
|
7538
7811
|
let ref16;
|
|
7539
|
-
if (unary.suffix.length)
|
|
7540
|
-
|
|
7541
|
-
else
|
|
7542
|
-
ref16 = unary.t;
|
|
7812
|
+
if (unary.suffix.length) ref16 = unary;
|
|
7813
|
+
else ref16 = unary.t;
|
|
7543
7814
|
const t = ref16;
|
|
7544
7815
|
const arg = makeNode({
|
|
7545
7816
|
type: "TypeArgument",
|
|
@@ -7615,6 +7886,7 @@ function processStatementExpressions(statements) {
|
|
|
7615
7886
|
;
|
|
7616
7887
|
break;
|
|
7617
7888
|
}
|
|
7889
|
+
// else do nothing, handled separately currently
|
|
7618
7890
|
default: {
|
|
7619
7891
|
replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
7620
7892
|
}
|
|
@@ -7731,6 +8003,91 @@ function processBreaksContinues(statements) {
|
|
|
7731
8003
|
delete label.special;
|
|
7732
8004
|
}
|
|
7733
8005
|
}
|
|
8006
|
+
function processCoffeeClasses(statements) {
|
|
8007
|
+
for (let ref21 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref21.length; i11 < len9; i11++) {
|
|
8008
|
+
const ce = ref21[i11];
|
|
8009
|
+
const { expressions } = ce.body;
|
|
8010
|
+
const indent = expressions[0]?.[0] ?? "\n";
|
|
8011
|
+
const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
|
|
8012
|
+
if (autoBinds.length) {
|
|
8013
|
+
let construct;
|
|
8014
|
+
for (const [, c] of expressions) {
|
|
8015
|
+
if (typeof c === "object" && c != null && "type" in c && c.type === "MethodDefinition" && "name" in c && c.name === "constructor" && c.block) {
|
|
8016
|
+
construct = c;
|
|
8017
|
+
break;
|
|
8018
|
+
}
|
|
8019
|
+
}
|
|
8020
|
+
if (!construct) {
|
|
8021
|
+
const parametersList = [];
|
|
8022
|
+
const parameters = {
|
|
8023
|
+
type: "Parameters",
|
|
8024
|
+
children: [parametersList],
|
|
8025
|
+
parameters: parametersList,
|
|
8026
|
+
names: []
|
|
8027
|
+
};
|
|
8028
|
+
const signature = {
|
|
8029
|
+
type: "MethodSignature",
|
|
8030
|
+
children: ["constructor(", parameters, ")"],
|
|
8031
|
+
parameters,
|
|
8032
|
+
modifier: {},
|
|
8033
|
+
returnType: void 0
|
|
8034
|
+
};
|
|
8035
|
+
const block = makeEmptyBlock();
|
|
8036
|
+
construct = {
|
|
8037
|
+
...signature,
|
|
8038
|
+
type: "MethodDefinition",
|
|
8039
|
+
name: "constructor",
|
|
8040
|
+
block,
|
|
8041
|
+
signature,
|
|
8042
|
+
children: [...signature.children, block]
|
|
8043
|
+
};
|
|
8044
|
+
expressions.unshift([indent, construct]);
|
|
8045
|
+
}
|
|
8046
|
+
const index = findSuperCall(construct.block);
|
|
8047
|
+
construct.block.expressions.splice(
|
|
8048
|
+
index + 1,
|
|
8049
|
+
0,
|
|
8050
|
+
...(() => {
|
|
8051
|
+
const results3 = [];
|
|
8052
|
+
for (let i12 = 0, len10 = autoBinds.length; i12 < len10; i12++) {
|
|
8053
|
+
const [, a] = autoBinds[i12];
|
|
8054
|
+
results3.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
|
|
8055
|
+
}
|
|
8056
|
+
return results3;
|
|
8057
|
+
})()
|
|
8058
|
+
);
|
|
8059
|
+
}
|
|
8060
|
+
const privates = expressions.filter(($15) => $15[1]?.type === "CoffeeClassPrivate");
|
|
8061
|
+
if (!privates.length) {
|
|
8062
|
+
continue;
|
|
8063
|
+
}
|
|
8064
|
+
const { parent } = ce;
|
|
8065
|
+
for (let i13 = expressions.length + -1; i13 >= 0; --i13) {
|
|
8066
|
+
const i = i13;
|
|
8067
|
+
if (expressions[i][1]?.type === "CoffeeClassPrivate") {
|
|
8068
|
+
expressions.splice(i, 1);
|
|
8069
|
+
}
|
|
8070
|
+
}
|
|
8071
|
+
let wrapped = wrapIIFE([
|
|
8072
|
+
...privates,
|
|
8073
|
+
[indent, wrapWithReturn(ce)]
|
|
8074
|
+
]);
|
|
8075
|
+
if (ce && typeof ce === "object" && "binding" in ce) {
|
|
8076
|
+
let { binding } = ce;
|
|
8077
|
+
binding = trimFirstSpace(binding);
|
|
8078
|
+
wrapped = makeNode({
|
|
8079
|
+
type: "AssignmentExpression",
|
|
8080
|
+
children: [binding, " = ", wrapped],
|
|
8081
|
+
lhs: binding,
|
|
8082
|
+
// TODO: incorrect shape
|
|
8083
|
+
assigned: binding,
|
|
8084
|
+
expression: wrapped,
|
|
8085
|
+
names: [ce.name]
|
|
8086
|
+
});
|
|
8087
|
+
}
|
|
8088
|
+
replaceNode(ce, wrapped, parent);
|
|
8089
|
+
}
|
|
8090
|
+
}
|
|
7734
8091
|
function processProgram(root) {
|
|
7735
8092
|
const state2 = getState();
|
|
7736
8093
|
const config2 = getConfig();
|
|
@@ -7745,7 +8102,7 @@ function processProgram(root) {
|
|
|
7745
8102
|
if (config2.iife || config2.repl) {
|
|
7746
8103
|
rootIIFE = wrapIIFE(root.expressions, root.topLevelAwait);
|
|
7747
8104
|
const newExpressions = [["", rootIIFE]];
|
|
7748
|
-
root.children = root.children.map(($
|
|
8105
|
+
root.children = root.children.map(($16) => $16 === root.expressions ? newExpressions : $16);
|
|
7749
8106
|
root.expressions = newExpressions;
|
|
7750
8107
|
}
|
|
7751
8108
|
addParentPointers(root);
|
|
@@ -7764,6 +8121,9 @@ function processProgram(root) {
|
|
|
7764
8121
|
processBreaksContinues(statements);
|
|
7765
8122
|
hoistRefDecs(statements);
|
|
7766
8123
|
processFunctions(statements, config2);
|
|
8124
|
+
if (config2.coffeeClasses) {
|
|
8125
|
+
processCoffeeClasses(statements);
|
|
8126
|
+
}
|
|
7767
8127
|
statements.unshift(...state2.prelude);
|
|
7768
8128
|
if (config2.autoLet) {
|
|
7769
8129
|
createConstLetDecs(statements, [], "let");
|
|
@@ -7787,10 +8147,10 @@ async function processProgramAsync(root) {
|
|
|
7787
8147
|
await processComptime(statements);
|
|
7788
8148
|
}
|
|
7789
8149
|
function processRepl(root, rootIIFE) {
|
|
7790
|
-
const topBlock = gatherRecursive(rootIIFE, ($
|
|
8150
|
+
const topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0];
|
|
7791
8151
|
let i = 0;
|
|
7792
|
-
for (let
|
|
7793
|
-
const decl =
|
|
8152
|
+
for (let ref22 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref22.length; i14 < len11; i14++) {
|
|
8153
|
+
const decl = ref22[i14];
|
|
7794
8154
|
if (!decl.names?.length) {
|
|
7795
8155
|
continue;
|
|
7796
8156
|
}
|
|
@@ -7803,8 +8163,8 @@ function processRepl(root, rootIIFE) {
|
|
|
7803
8163
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
7804
8164
|
}
|
|
7805
8165
|
}
|
|
7806
|
-
for (let
|
|
7807
|
-
const func =
|
|
8166
|
+
for (let ref23 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref23.length; i15 < len12; i15++) {
|
|
8167
|
+
const func = ref23[i15];
|
|
7808
8168
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
7809
8169
|
if (func.parent === topBlock) {
|
|
7810
8170
|
replaceNode(func, void 0);
|
|
@@ -7816,8 +8176,8 @@ function processRepl(root, rootIIFE) {
|
|
|
7816
8176
|
}
|
|
7817
8177
|
}
|
|
7818
8178
|
}
|
|
7819
|
-
for (let
|
|
7820
|
-
const classExp =
|
|
8179
|
+
for (let ref24 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref24.length; i16 < len13; i16++) {
|
|
8180
|
+
const classExp = ref24[i16];
|
|
7821
8181
|
let m8;
|
|
7822
8182
|
if (classExp.name && classExp.parent === topBlock || (m8 = classExp.parent, typeof m8 === "object" && m8 != null && "type" in m8 && m8.type === "ReturnStatement" && "parent" in m8 && m8.parent === topBlock)) {
|
|
7823
8183
|
classExp.children.unshift(classExp.name, "=");
|
|
@@ -7826,14 +8186,13 @@ function processRepl(root, rootIIFE) {
|
|
|
7826
8186
|
}
|
|
7827
8187
|
}
|
|
7828
8188
|
function populateRefs(statements) {
|
|
7829
|
-
const refNodes = gatherRecursive(statements, ($
|
|
8189
|
+
const refNodes = gatherRecursive(statements, ($21) => $21.type === "Ref");
|
|
7830
8190
|
if (refNodes.length) {
|
|
7831
8191
|
const ids = gatherRecursive(statements, (s) => s.type === "Identifier");
|
|
7832
8192
|
const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
|
|
7833
8193
|
refNodes.forEach((ref) => {
|
|
7834
8194
|
const { type, base } = ref;
|
|
7835
|
-
if (type !== "Ref")
|
|
7836
|
-
return;
|
|
8195
|
+
if (type !== "Ref") return;
|
|
7837
8196
|
ref.type = "Identifier";
|
|
7838
8197
|
let n = 0;
|
|
7839
8198
|
let name = base;
|
|
@@ -7849,8 +8208,8 @@ function populateRefs(statements) {
|
|
|
7849
8208
|
function processPlaceholders(statements) {
|
|
7850
8209
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
7851
8210
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
7852
|
-
for (let
|
|
7853
|
-
const exp =
|
|
8211
|
+
for (let ref25 = gatherRecursiveAll(statements, ($22) => $22.type === "Placeholder"), i17 = 0, len14 = ref25.length; i17 < len14; i17++) {
|
|
8212
|
+
const exp = ref25[i17];
|
|
7854
8213
|
let ancestor;
|
|
7855
8214
|
if (exp.subtype === ".") {
|
|
7856
8215
|
({ ancestor } = findAncestor(
|
|
@@ -7959,11 +8318,11 @@ function processPlaceholders(statements) {
|
|
|
7959
8318
|
for (const [ancestor, placeholders] of placeholderMap) {
|
|
7960
8319
|
let ref = makeRef("$");
|
|
7961
8320
|
let typeSuffix;
|
|
7962
|
-
for (let
|
|
7963
|
-
const placeholder = placeholders[
|
|
8321
|
+
for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
|
|
8322
|
+
const placeholder = placeholders[i18];
|
|
7964
8323
|
typeSuffix ??= placeholder.typeSuffix;
|
|
7965
|
-
let
|
|
7966
|
-
(
|
|
8324
|
+
let ref26;
|
|
8325
|
+
(ref26 = placeholder.children)[ref26.length - 1] = ref;
|
|
7967
8326
|
}
|
|
7968
8327
|
const { parent } = ancestor;
|
|
7969
8328
|
const body = maybeUnwrap(ancestor);
|
|
@@ -7984,16 +8343,16 @@ function processPlaceholders(statements) {
|
|
|
7984
8343
|
}
|
|
7985
8344
|
case "PipelineExpression": {
|
|
7986
8345
|
const i = findChildIndex(parent, ancestor);
|
|
7987
|
-
let
|
|
8346
|
+
let ref27;
|
|
7988
8347
|
if (i === 1) {
|
|
7989
|
-
|
|
8348
|
+
ref27 = ancestor === parent.children[i];
|
|
7990
8349
|
} else if (i === 2) {
|
|
7991
|
-
|
|
8350
|
+
ref27 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
7992
8351
|
} else {
|
|
7993
|
-
|
|
8352
|
+
ref27 = void 0;
|
|
7994
8353
|
}
|
|
7995
8354
|
;
|
|
7996
|
-
outer =
|
|
8355
|
+
outer = ref27;
|
|
7997
8356
|
break;
|
|
7998
8357
|
}
|
|
7999
8358
|
case "AssignmentExpression":
|
|
@@ -8008,9 +8367,9 @@ function processPlaceholders(statements) {
|
|
|
8008
8367
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
8009
8368
|
}
|
|
8010
8369
|
replaceNode(ancestor, fnExp, parent);
|
|
8011
|
-
let
|
|
8012
|
-
if (
|
|
8013
|
-
const ws =
|
|
8370
|
+
let ref28;
|
|
8371
|
+
if (ref28 = getTrimmingSpace(body)) {
|
|
8372
|
+
const ws = ref28;
|
|
8014
8373
|
inplaceInsertTrimmingSpace(body, "");
|
|
8015
8374
|
inplacePrepend(ws, fnExp);
|
|
8016
8375
|
}
|
|
@@ -8023,8 +8382,7 @@ function reorderBindingRestProperty(props) {
|
|
|
8023
8382
|
let restCount = 0;
|
|
8024
8383
|
props.forEach(({ type }, i) => {
|
|
8025
8384
|
if (type === "BindingRestProperty") {
|
|
8026
|
-
if (restIndex < 0)
|
|
8027
|
-
restIndex = i;
|
|
8385
|
+
if (restIndex < 0) restIndex = i;
|
|
8028
8386
|
return restCount++;
|
|
8029
8387
|
}
|
|
8030
8388
|
;
|
|
@@ -8055,8 +8413,8 @@ function reorderBindingRestProperty(props) {
|
|
|
8055
8413
|
}
|
|
8056
8414
|
];
|
|
8057
8415
|
}
|
|
8058
|
-
let
|
|
8059
|
-
if (Array.isArray(rest.delim) && (
|
|
8416
|
+
let ref29;
|
|
8417
|
+
if (Array.isArray(rest.delim) && (ref29 = rest.delim)[ref29.length - 1]?.token === ",") {
|
|
8060
8418
|
rest.delim = rest.delim.slice(0, -1);
|
|
8061
8419
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
8062
8420
|
}
|
|
@@ -9403,10 +9761,8 @@ function NonPipelineExpression(ctx, state2) {
|
|
|
9403
9761
|
var NestedExpressionizedStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, ExpressionizedStatementWithTrailingCallExpressions)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9404
9762
|
var expression = $3;
|
|
9405
9763
|
var trailing = $5;
|
|
9406
|
-
if (!expression)
|
|
9407
|
-
|
|
9408
|
-
if (!trailing)
|
|
9409
|
-
return expression;
|
|
9764
|
+
if (!expression) return $skip;
|
|
9765
|
+
if (!trailing) return expression;
|
|
9410
9766
|
return {
|
|
9411
9767
|
type: "CallExpression",
|
|
9412
9768
|
children: [expression, ...trailing]
|
|
@@ -9416,8 +9772,7 @@ function NestedExpressionizedStatement(ctx, state2) {
|
|
|
9416
9772
|
return (0, import_lib2.$EVENT)(ctx, state2, "NestedExpressionizedStatement", NestedExpressionizedStatement$0);
|
|
9417
9773
|
}
|
|
9418
9774
|
var ExpressionizedStatementWithTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExpressionizedStatement, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
|
|
9419
|
-
if (!$2)
|
|
9420
|
-
return $1;
|
|
9775
|
+
if (!$2) return $1;
|
|
9421
9776
|
return {
|
|
9422
9777
|
type: "CallExpression",
|
|
9423
9778
|
children: [
|
|
@@ -9442,8 +9797,7 @@ function ExpressionizedStatement(ctx, state2) {
|
|
|
9442
9797
|
}
|
|
9443
9798
|
var StatementExpression$0 = DebuggerStatement;
|
|
9444
9799
|
var StatementExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IfStatement), function($skip, $loc, $0, $1) {
|
|
9445
|
-
if (!$1.else && $1.then.implicit)
|
|
9446
|
-
return $skip;
|
|
9800
|
+
if (!$1.else && $1.then.implicit) return $skip;
|
|
9447
9801
|
return $1;
|
|
9448
9802
|
});
|
|
9449
9803
|
var StatementExpression$2 = IterationExpression;
|
|
@@ -9455,8 +9809,7 @@ function StatementExpression(ctx, state2) {
|
|
|
9455
9809
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "StatementExpression", StatementExpression$$);
|
|
9456
9810
|
}
|
|
9457
9811
|
var CommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentExpression, (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, AssignmentExpression))), function($skip, $loc, $0, $1, $2) {
|
|
9458
|
-
if ($2.length == 0)
|
|
9459
|
-
return $1;
|
|
9812
|
+
if ($2.length == 0) return $1;
|
|
9460
9813
|
return $0;
|
|
9461
9814
|
});
|
|
9462
9815
|
function CommaExpression(ctx, state2) {
|
|
@@ -9465,8 +9818,7 @@ function CommaExpression(ctx, state2) {
|
|
|
9465
9818
|
var Arguments$0 = ExplicitArguments;
|
|
9466
9819
|
var Arguments$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidTrailingMemberProperty, (0, import_lib2.$E)(ImplicitArguments), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
|
|
9467
9820
|
var args = $2;
|
|
9468
|
-
if (args)
|
|
9469
|
-
return args;
|
|
9821
|
+
if (args) return args;
|
|
9470
9822
|
return $skip;
|
|
9471
9823
|
});
|
|
9472
9824
|
var Arguments$$ = [Arguments$0, Arguments$1];
|
|
@@ -9478,10 +9830,8 @@ var ImplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ApplicationSt
|
|
|
9478
9830
|
var ws = $3;
|
|
9479
9831
|
var args = $6;
|
|
9480
9832
|
var close = $9;
|
|
9481
|
-
if (!args)
|
|
9482
|
-
|
|
9483
|
-
if (skipImplicitArguments(args))
|
|
9484
|
-
return $skip;
|
|
9833
|
+
if (!args) return $skip;
|
|
9834
|
+
if (skipImplicitArguments(args)) return $skip;
|
|
9485
9835
|
return {
|
|
9486
9836
|
type: "Call",
|
|
9487
9837
|
args,
|
|
@@ -9527,14 +9877,12 @@ var ForbiddenImplicitCalls$3 = (0, import_lib2.$S)(ClassImplicitCallForbidden, (
|
|
|
9527
9877
|
var ForbiddenImplicitCalls$4 = (0, import_lib2.$S)(Identifier, (0, import_lib2.$EXPECT)($L3, 'ForbiddenImplicitCalls "="'), Whitespace);
|
|
9528
9878
|
var ForbiddenImplicitCalls$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(Identifier, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($L4, 'ForbiddenImplicitCalls "("'))), function($skip, $loc, $0, $1, $2) {
|
|
9529
9879
|
var id = $1;
|
|
9530
|
-
if (state.operators.has(id.name))
|
|
9531
|
-
return $0;
|
|
9880
|
+
if (state.operators.has(id.name)) return $0;
|
|
9532
9881
|
return $skip;
|
|
9533
9882
|
});
|
|
9534
9883
|
var ForbiddenImplicitCalls$6 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, (0, import_lib2.$E)(_), Identifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
9535
9884
|
var id = $3;
|
|
9536
|
-
if (state.operators.has(id.name))
|
|
9537
|
-
return $0;
|
|
9885
|
+
if (state.operators.has(id.name)) return $0;
|
|
9538
9886
|
return $skip;
|
|
9539
9887
|
});
|
|
9540
9888
|
var ForbiddenImplicitCalls$7 = (0, import_lib2.$S)(PostfixStatement, NoBlock);
|
|
@@ -9557,18 +9905,15 @@ function ArgumentsWithTrailingCallExpressions(ctx, state2) {
|
|
|
9557
9905
|
}
|
|
9558
9906
|
var TrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)(ExplicitCallExpressionRest), (0, import_lib2.$E)(IndentedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
|
|
9559
9907
|
$1 = $1.flat();
|
|
9560
|
-
if (!$1.length && !$2)
|
|
9561
|
-
|
|
9562
|
-
if (!$2)
|
|
9563
|
-
return $1;
|
|
9908
|
+
if (!$1.length && !$2) return $skip;
|
|
9909
|
+
if (!$2) return $1;
|
|
9564
9910
|
return [...$1, ...$2];
|
|
9565
9911
|
});
|
|
9566
9912
|
function TrailingCallExpressions(ctx, state2) {
|
|
9567
9913
|
return (0, import_lib2.$EVENT)(ctx, state2, "TrailingCallExpressions", TrailingCallExpressions$0);
|
|
9568
9914
|
}
|
|
9569
9915
|
var IndentedTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedTrailingCallExpression), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
9570
|
-
if (!$2.length)
|
|
9571
|
-
return $skip;
|
|
9916
|
+
if (!$2.length) return $skip;
|
|
9572
9917
|
return $2.flat();
|
|
9573
9918
|
});
|
|
9574
9919
|
var IndentedTrailingCallExpressions$1 = (0, import_lib2.$TV)((0, import_lib2.$P)(NestedTrailingCallExpression), function($skip, $loc, $0, $1) {
|
|
@@ -9616,8 +9961,7 @@ var ArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
|
|
|
9616
9961
|
];
|
|
9617
9962
|
});
|
|
9618
9963
|
var ArgumentList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedArguments, (0, import_lib2.$Q)((0, import_lib2.$S)(OptionalCommaDelimiter, NestedArguments))), function($skip, $loc, $0, $1, $2) {
|
|
9619
|
-
if (!Array.isArray($1))
|
|
9620
|
-
$1 = [$1];
|
|
9964
|
+
if (!Array.isArray($1)) $1 = [$1];
|
|
9621
9965
|
return [
|
|
9622
9966
|
...trimFirstSpace($1),
|
|
9623
9967
|
...$2.flatMap(
|
|
@@ -9644,8 +9988,7 @@ function NestedArguments(ctx, state2) {
|
|
|
9644
9988
|
}
|
|
9645
9989
|
var NestedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, AllowPipeline, AllowTrailingMemberProperty, (0, import_lib2.$Q)(NestedArgument), RestoreTrailingMemberProperty, RestorePipeline, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
9646
9990
|
var args = $4;
|
|
9647
|
-
if (!args.length)
|
|
9648
|
-
return $skip;
|
|
9991
|
+
if (!args.length) return $skip;
|
|
9649
9992
|
return stripTrailingImplicitComma(args.flat());
|
|
9650
9993
|
});
|
|
9651
9994
|
function NestedArgumentList(ctx, state2) {
|
|
@@ -9699,8 +10042,7 @@ function ArgumentPart(ctx, state2) {
|
|
|
9699
10042
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
|
|
9700
10043
|
}
|
|
9701
10044
|
var BinaryOpExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnaryExpression, (0, import_lib2.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
|
|
9702
|
-
if (!$2.length)
|
|
9703
|
-
return $1;
|
|
10045
|
+
if (!$2.length) return $1;
|
|
9704
10046
|
return processBinaryOpExpression($0);
|
|
9705
10047
|
});
|
|
9706
10048
|
function BinaryOpExpression(ctx, state2) {
|
|
@@ -9754,8 +10096,7 @@ function IsLike(ctx, state2) {
|
|
|
9754
10096
|
}
|
|
9755
10097
|
var WRHS$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$S)(Nested, (0, import_lib2.$E)(_)), RHS)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
9756
10098
|
var wrhs = $2;
|
|
9757
|
-
if (!wrhs)
|
|
9758
|
-
return $skip;
|
|
10099
|
+
if (!wrhs) return $skip;
|
|
9759
10100
|
return wrhs;
|
|
9760
10101
|
});
|
|
9761
10102
|
var WRHS$1 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS);
|
|
@@ -9817,8 +10158,7 @@ function UnaryBody(ctx, state2) {
|
|
|
9817
10158
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
|
|
9818
10159
|
}
|
|
9819
10160
|
var MaybeNestedCoffeeDoBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, CoffeeDoBody)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
9820
|
-
if (!$2)
|
|
9821
|
-
return $skip;
|
|
10161
|
+
if (!$2) return $skip;
|
|
9822
10162
|
return $2;
|
|
9823
10163
|
});
|
|
9824
10164
|
var MaybeNestedCoffeeDoBody$1 = (0, import_lib2.$S)((0, import_lib2.$E)(_), CoffeeDoBody);
|
|
@@ -9907,8 +10247,7 @@ var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressi
|
|
|
9907
10247
|
};
|
|
9908
10248
|
});
|
|
9909
10249
|
var UpdateExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(LeftHandSideExpression, (0, import_lib2.$E)((0, import_lib2.$S)(UpdateExpressionSymbol, (0, import_lib2.$EXPECT)($R4, "UpdateExpression /(?!\\p{ID_Start}|[_$0-9(\\[{])/")))), function($skip, $loc, $0, $1, $2) {
|
|
9910
|
-
if (!$2)
|
|
9911
|
-
return $1;
|
|
10250
|
+
if (!$2) return $1;
|
|
9912
10251
|
return {
|
|
9913
10252
|
type: "UpdateExpression",
|
|
9914
10253
|
assigned: $1,
|
|
@@ -10041,14 +10380,14 @@ var ArrowFunction$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
|
10041
10380
|
var returnType = $3;
|
|
10042
10381
|
var arrow = $4;
|
|
10043
10382
|
var expOrBlock = $5;
|
|
10044
|
-
if (!async)
|
|
10045
|
-
async = [];
|
|
10383
|
+
if (!async) async = [];
|
|
10046
10384
|
return {
|
|
10047
10385
|
type: "ArrowFunction",
|
|
10048
10386
|
signature: {
|
|
10049
10387
|
modifier: {
|
|
10050
10388
|
async: !!async.length
|
|
10051
10389
|
},
|
|
10390
|
+
parameters,
|
|
10052
10391
|
returnType
|
|
10053
10392
|
},
|
|
10054
10393
|
parameters,
|
|
@@ -10065,8 +10404,7 @@ function ArrowFunction(ctx, state2) {
|
|
|
10065
10404
|
var FatArrow$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), FatArrowToken), function($skip, $loc, $0, $1, $2) {
|
|
10066
10405
|
var ws = $1;
|
|
10067
10406
|
var arrow = $2;
|
|
10068
|
-
if (!ws)
|
|
10069
|
-
ws = " ";
|
|
10407
|
+
if (!ws) ws = " ";
|
|
10070
10408
|
return [ws, arrow];
|
|
10071
10409
|
});
|
|
10072
10410
|
function FatArrow(ctx, state2) {
|
|
@@ -10133,8 +10471,7 @@ function TernaryRest(ctx, state2) {
|
|
|
10133
10471
|
}
|
|
10134
10472
|
var NestedTernaryRest$0 = (0, import_lib2.$S)(Nested, QuestionMark, MaybeNestedExpression, Nested, Colon, MaybeNestedExpression);
|
|
10135
10473
|
var NestedTernaryRest$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, QuestionMark, MaybeNestedExpression, Nested, Colon, MaybeNestedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
10136
|
-
if ($2)
|
|
10137
|
-
return $2;
|
|
10474
|
+
if ($2) return $2;
|
|
10138
10475
|
return $skip;
|
|
10139
10476
|
});
|
|
10140
10477
|
var NestedTernaryRest$$ = [NestedTernaryRest$0, NestedTernaryRest$1];
|
|
@@ -10173,8 +10510,7 @@ function PipelineExpression(ctx, state2) {
|
|
|
10173
10510
|
var PipelineExpressionBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PipelineExpressionBodySameLine, PushIndent, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)(Nested, Pipe, __, PipelineTailItem), PipelineExpressionBodySameLine)), PopIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10174
10511
|
var first = $1;
|
|
10175
10512
|
var rest = $3;
|
|
10176
|
-
if (!rest.length)
|
|
10177
|
-
return $skip;
|
|
10513
|
+
if (!rest.length) return $skip;
|
|
10178
10514
|
return [
|
|
10179
10515
|
...first,
|
|
10180
10516
|
...rest.map(([nested, line]) => [nested, ...line]).flat()
|
|
@@ -10237,8 +10573,7 @@ var OptimizedParenthesizedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
|
|
|
10237
10573
|
const { expression } = $1;
|
|
10238
10574
|
switch (expression.type) {
|
|
10239
10575
|
case "StatementExpression":
|
|
10240
|
-
if (expression.statement.type !== "IterationExpression")
|
|
10241
|
-
break;
|
|
10576
|
+
if (expression.statement.type !== "IterationExpression") break;
|
|
10242
10577
|
case "IterationExpression":
|
|
10243
10578
|
return expression;
|
|
10244
10579
|
}
|
|
@@ -10249,8 +10584,7 @@ function OptimizedParenthesizedExpression(ctx, state2) {
|
|
|
10249
10584
|
}
|
|
10250
10585
|
var ParenthesizedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedCommaExpression, __, CloseParen)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10251
10586
|
var open = $1;
|
|
10252
|
-
if (!$3)
|
|
10253
|
-
return $skip;
|
|
10587
|
+
if (!$3) return $skip;
|
|
10254
10588
|
const [expression, ws, close] = $3;
|
|
10255
10589
|
if (expression.type === "ParenthesizedExpression" && expression.implicit) {
|
|
10256
10590
|
return {
|
|
@@ -10308,8 +10642,7 @@ function PlaceholderTypeSuffix(ctx, state2) {
|
|
|
10308
10642
|
return (0, import_lib2.$EVENT)(ctx, state2, "PlaceholderTypeSuffix", PlaceholderTypeSuffix$0);
|
|
10309
10643
|
}
|
|
10310
10644
|
var ClassDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ClassExpression), function($skip, $loc, $0, $1) {
|
|
10311
|
-
if ($1.id)
|
|
10312
|
-
return $1;
|
|
10645
|
+
if ($1.id) return $1;
|
|
10313
10646
|
return makeLeftHandSideExpression($1);
|
|
10314
10647
|
});
|
|
10315
10648
|
function ClassDeclaration(ctx, state2) {
|
|
@@ -10354,10 +10687,8 @@ var ClassHeritage$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExtendsClause, (0
|
|
|
10354
10687
|
var ClassHeritage$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(WithClause), (0, import_lib2.$E)(ImplementsClause)), function($skip, $loc, $0, $1, $2) {
|
|
10355
10688
|
var withClause = $1;
|
|
10356
10689
|
var implementsClause = $2;
|
|
10357
|
-
if (withClause)
|
|
10358
|
-
|
|
10359
|
-
if (implementsClause)
|
|
10360
|
-
return implementsClause;
|
|
10690
|
+
if (withClause) return [convertWithClause(withClause), implementsClause];
|
|
10691
|
+
if (implementsClause) return implementsClause;
|
|
10361
10692
|
return $skip;
|
|
10362
10693
|
});
|
|
10363
10694
|
var ClassHeritage$$ = [ClassHeritage$0, ClassHeritage$1];
|
|
@@ -10492,8 +10823,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
|
|
|
10492
10823
|
var expressions = $4;
|
|
10493
10824
|
var ws2 = $6;
|
|
10494
10825
|
var close = $7;
|
|
10495
|
-
if (!expressions)
|
|
10496
|
-
expressions = [];
|
|
10826
|
+
if (!expressions) expressions = [];
|
|
10497
10827
|
return {
|
|
10498
10828
|
type: "BlockStatement",
|
|
10499
10829
|
subtype: "ClassBody",
|
|
@@ -10503,8 +10833,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
|
|
|
10503
10833
|
});
|
|
10504
10834
|
var ClassBody$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, (0, import_lib2.$E)(NestedClassElements), InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
10505
10835
|
var expressions = $2;
|
|
10506
|
-
if (!expressions)
|
|
10507
|
-
expressions = $0[1] = [];
|
|
10836
|
+
if (!expressions) expressions = $0[1] = [];
|
|
10508
10837
|
return {
|
|
10509
10838
|
type: "BlockStatement",
|
|
10510
10839
|
subtype: "ClassBody",
|
|
@@ -10519,8 +10848,7 @@ function ClassBody(ctx, state2) {
|
|
|
10519
10848
|
var ClassBracedContent$0 = NestedClassElements;
|
|
10520
10849
|
var ClassBracedContent$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewlineBinaryOp, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$N)(EOS)), ClassElement, StatementDelimiter)), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3) {
|
|
10521
10850
|
var stmts = $2;
|
|
10522
|
-
if (!stmts)
|
|
10523
|
-
return $skip;
|
|
10851
|
+
if (!stmts) return $skip;
|
|
10524
10852
|
return stmts;
|
|
10525
10853
|
});
|
|
10526
10854
|
var ClassBracedContent$$ = [ClassBracedContent$0, ClassBracedContent$1];
|
|
@@ -10529,8 +10857,7 @@ function ClassBracedContent(ctx, state2) {
|
|
|
10529
10857
|
}
|
|
10530
10858
|
var NestedClassElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedClassElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
10531
10859
|
var elements = $2;
|
|
10532
|
-
if (!elements.length)
|
|
10533
|
-
return $skip;
|
|
10860
|
+
if (!elements.length) return $skip;
|
|
10534
10861
|
return elements;
|
|
10535
10862
|
});
|
|
10536
10863
|
function NestedClassElements(ctx, state2) {
|
|
@@ -10588,8 +10915,7 @@ function ClassSignatureBody(ctx, state2) {
|
|
|
10588
10915
|
}
|
|
10589
10916
|
var NestedClassSignatureElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedClassSignatureElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
10590
10917
|
var elements = $2;
|
|
10591
|
-
if (!elements.length)
|
|
10592
|
-
return $skip;
|
|
10918
|
+
if (!elements.length) return $skip;
|
|
10593
10919
|
return elements;
|
|
10594
10920
|
});
|
|
10595
10921
|
function NestedClassSignatureElements(ctx, state2) {
|
|
@@ -10606,8 +10932,7 @@ function ClassSignatureElement(ctx, state2) {
|
|
|
10606
10932
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ClassSignatureElement", ClassSignatureElement$$);
|
|
10607
10933
|
}
|
|
10608
10934
|
var AccessModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$C)(Public, Private, Protected), NotDedented)), (0, import_lib2.$E)((0, import_lib2.$S)(Readonly, NotDedented))), function($skip, $loc, $0, $1, $2) {
|
|
10609
|
-
if (!($1 || $2))
|
|
10610
|
-
return $skip;
|
|
10935
|
+
if (!($1 || $2)) return $skip;
|
|
10611
10936
|
return {
|
|
10612
10937
|
ts: true,
|
|
10613
10938
|
children: $0
|
|
@@ -10620,7 +10945,7 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
|
|
|
10620
10945
|
var id = $2;
|
|
10621
10946
|
var exp = $6;
|
|
10622
10947
|
switch (exp.type) {
|
|
10623
|
-
case "FunctionExpression":
|
|
10948
|
+
case "FunctionExpression": {
|
|
10624
10949
|
const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
|
|
10625
10950
|
const children = exp.children.slice();
|
|
10626
10951
|
if (exp.generator) {
|
|
@@ -10630,8 +10955,29 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
|
|
|
10630
10955
|
}
|
|
10631
10956
|
return {
|
|
10632
10957
|
...exp,
|
|
10633
|
-
|
|
10958
|
+
type: "MethodDefinition",
|
|
10959
|
+
name: id.name,
|
|
10960
|
+
signature: { ...exp.signature, id, name: id.name },
|
|
10961
|
+
children
|
|
10962
|
+
};
|
|
10963
|
+
}
|
|
10964
|
+
case "ArrowFunction": {
|
|
10965
|
+
const block = { ...exp.block };
|
|
10966
|
+
const children = exp.children.filter((c) => !(Array.isArray(c) && c[c.length - 1]?.token?.includes("=>"))).map((c) => c === exp.block ? block : c);
|
|
10967
|
+
children.unshift(id);
|
|
10968
|
+
exp = {
|
|
10969
|
+
...exp,
|
|
10970
|
+
type: "MethodDefinition",
|
|
10971
|
+
name: id.name,
|
|
10972
|
+
signature: { ...exp.signature, id, name: id.name },
|
|
10973
|
+
block,
|
|
10974
|
+
children,
|
|
10975
|
+
autoBind: true
|
|
10634
10976
|
};
|
|
10977
|
+
block.parent = exp;
|
|
10978
|
+
braceBlock(block);
|
|
10979
|
+
return exp;
|
|
10980
|
+
}
|
|
10635
10981
|
default:
|
|
10636
10982
|
return {
|
|
10637
10983
|
type: "FieldDefinition",
|
|
@@ -10641,11 +10987,11 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
|
|
|
10641
10987
|
}
|
|
10642
10988
|
});
|
|
10643
10989
|
var FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly, ClassElementName, (0, import_lib2.$E)(TypeSuffix), __, ConstAssignment, MaybeNestedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
10644
|
-
var
|
|
10990
|
+
var readonly = $1;
|
|
10645
10991
|
var id = $2;
|
|
10646
10992
|
var typeSuffix = $3;
|
|
10647
10993
|
var ca = $5;
|
|
10648
|
-
|
|
10994
|
+
readonly.children[0].$loc = {
|
|
10649
10995
|
pos: ca.$loc.pos - 1,
|
|
10650
10996
|
length: ca.$loc.length + 1
|
|
10651
10997
|
};
|
|
@@ -10653,21 +10999,36 @@ var FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly,
|
|
|
10653
10999
|
type: "FieldDefinition",
|
|
10654
11000
|
id,
|
|
10655
11001
|
typeSuffix,
|
|
10656
|
-
children: $0
|
|
11002
|
+
children: $0,
|
|
11003
|
+
readonly
|
|
11004
|
+
};
|
|
11005
|
+
});
|
|
11006
|
+
var FieldDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEnabled, ActualAssignment), function($skip, $loc, $0, $1, $2) {
|
|
11007
|
+
var assignment = $2;
|
|
11008
|
+
return {
|
|
11009
|
+
type: "CoffeeClassPrivate",
|
|
11010
|
+
children: [assignment],
|
|
11011
|
+
assignment
|
|
10657
11012
|
};
|
|
10658
11013
|
});
|
|
10659
|
-
var FieldDefinition$
|
|
11014
|
+
var FieldDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Abstract, (0, import_lib2.$E)(_))), (0, import_lib2.$E)((0, import_lib2.$S)(Readonly, (0, import_lib2.$E)(_))), ClassElementName, (0, import_lib2.$E)(TypeSuffix), (0, import_lib2.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
11015
|
+
var abstract = $1;
|
|
11016
|
+
var readonly = $2;
|
|
10660
11017
|
var id = $3;
|
|
10661
11018
|
var typeSuffix = $4;
|
|
11019
|
+
var initializer = $5;
|
|
10662
11020
|
return {
|
|
10663
11021
|
type: "FieldDefinition",
|
|
10664
11022
|
children: $0,
|
|
10665
|
-
ts:
|
|
11023
|
+
ts: abstract ? true : void 0,
|
|
10666
11024
|
id,
|
|
10667
|
-
typeSuffix
|
|
11025
|
+
typeSuffix,
|
|
11026
|
+
abstract,
|
|
11027
|
+
readonly,
|
|
11028
|
+
initializer
|
|
10668
11029
|
};
|
|
10669
11030
|
});
|
|
10670
|
-
var FieldDefinition$$ = [FieldDefinition$0, FieldDefinition$1, FieldDefinition$2];
|
|
11031
|
+
var FieldDefinition$$ = [FieldDefinition$0, FieldDefinition$1, FieldDefinition$2, FieldDefinition$3];
|
|
10671
11032
|
function FieldDefinition(ctx, state2) {
|
|
10672
11033
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "FieldDefinition", FieldDefinition$$);
|
|
10673
11034
|
}
|
|
@@ -10703,8 +11064,7 @@ var HashThis$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(At
|
|
|
10703
11064
|
var at = $1;
|
|
10704
11065
|
var id = $2;
|
|
10705
11066
|
var beforeIn = $3;
|
|
10706
|
-
if (beforeIn != null && at == null)
|
|
10707
|
-
return ['"', id.name, '"'];
|
|
11067
|
+
if (beforeIn != null && at == null) return ['"', id.name, '"'];
|
|
10708
11068
|
return {
|
|
10709
11069
|
type: "MemberExpression",
|
|
10710
11070
|
children: [at ?? "this", {
|
|
@@ -10831,8 +11191,7 @@ var CallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
10831
11191
|
var CallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ArgumentsWithTrailingCallExpressions), function($skip, $loc, $0, $1, $2) {
|
|
10832
11192
|
var optional = $1;
|
|
10833
11193
|
var argsWithTrailing = $2;
|
|
10834
|
-
if (!optional)
|
|
10835
|
-
return argsWithTrailing;
|
|
11194
|
+
if (!optional) return argsWithTrailing;
|
|
10836
11195
|
const call = argsWithTrailing[0];
|
|
10837
11196
|
return [{
|
|
10838
11197
|
...call,
|
|
@@ -10858,8 +11217,7 @@ var ExplicitCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0,
|
|
|
10858
11217
|
var ExplicitCallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
|
|
10859
11218
|
var optional = $1;
|
|
10860
11219
|
var call = $2;
|
|
10861
|
-
if (!optional)
|
|
10862
|
-
return call;
|
|
11220
|
+
if (!optional) return call;
|
|
10863
11221
|
return {
|
|
10864
11222
|
...call,
|
|
10865
11223
|
children: [optional, ...call.children],
|
|
@@ -10927,8 +11285,7 @@ function MemberBase(ctx, state2) {
|
|
|
10927
11285
|
var MemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R10, "MemberExpressionRest /(?=[\\/\\[{?.!@#'\u2019:])/"), (0, import_lib2.$Q)(InlineComment), MemberExpressionRestBody), function($skip, $loc, $0, $1, $2, $3) {
|
|
10928
11286
|
var comments = $2;
|
|
10929
11287
|
var body = $3;
|
|
10930
|
-
if (Array.isArray(body))
|
|
10931
|
-
return [...comments, ...body];
|
|
11288
|
+
if (Array.isArray(body)) return [...comments, ...body];
|
|
10932
11289
|
return {
|
|
10933
11290
|
...body,
|
|
10934
11291
|
children: [...comments, ...body.children]
|
|
@@ -10941,8 +11298,7 @@ var MemberExpressionRestBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, im
|
|
|
10941
11298
|
var dot = $1;
|
|
10942
11299
|
var comments = $2;
|
|
10943
11300
|
var content = $3;
|
|
10944
|
-
if (!dot && !comments.length)
|
|
10945
|
-
return content;
|
|
11301
|
+
if (!dot && !comments.length) return content;
|
|
10946
11302
|
if (dot) {
|
|
10947
11303
|
if (dot.type === "Optional" && content.type === "SliceExpression") {
|
|
10948
11304
|
return [...dot.children.slice(0, -1), ...comments, content];
|
|
@@ -11039,8 +11395,7 @@ var SliceParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import
|
|
|
11039
11395
|
const inc = [];
|
|
11040
11396
|
if (dots.right.inclusive) {
|
|
11041
11397
|
end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
|
|
11042
|
-
if (!reversed)
|
|
11043
|
-
inc.push(" || 1/0");
|
|
11398
|
+
if (!reversed) inc.push(" || 1/0");
|
|
11044
11399
|
}
|
|
11045
11400
|
children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
|
|
11046
11401
|
} else {
|
|
@@ -11291,10 +11646,12 @@ var Parameters$0 = NonEmptyParameters;
|
|
|
11291
11646
|
var Parameters$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
|
|
11292
11647
|
var tp = $1;
|
|
11293
11648
|
var p = $2;
|
|
11649
|
+
const parameters = [];
|
|
11294
11650
|
return {
|
|
11295
11651
|
type: "Parameters",
|
|
11296
|
-
children: [tp, { $loc: p.$loc, token: "(
|
|
11652
|
+
children: [tp, { $loc: p.$loc, token: "(" }, parameters, ")"],
|
|
11297
11653
|
tp,
|
|
11654
|
+
parameters,
|
|
11298
11655
|
names: [],
|
|
11299
11656
|
implicit: true
|
|
11300
11657
|
};
|
|
@@ -11317,10 +11674,11 @@ function ShortArrowParameters(ctx, state2) {
|
|
|
11317
11674
|
return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
|
|
11318
11675
|
}
|
|
11319
11676
|
var ArrowParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ShortArrowParameters), function($skip, $loc, $0, $1) {
|
|
11677
|
+
const parameters = [$1];
|
|
11320
11678
|
return {
|
|
11321
11679
|
type: "Parameters",
|
|
11322
|
-
children: ["(",
|
|
11323
|
-
|
|
11680
|
+
children: ["(", parameters, ")"],
|
|
11681
|
+
parameters
|
|
11324
11682
|
};
|
|
11325
11683
|
});
|
|
11326
11684
|
var ArrowParameters$1 = Parameters;
|
|
@@ -11331,83 +11689,13 @@ function ArrowParameters(ctx, state2) {
|
|
|
11331
11689
|
var NonEmptyParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), OpenParen, ParameterList, (0, import_lib2.$S)(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11332
11690
|
var tp = $1;
|
|
11333
11691
|
var open = $2;
|
|
11334
|
-
var
|
|
11692
|
+
var parameters = $3;
|
|
11335
11693
|
var close = $4;
|
|
11336
|
-
let tt, before = [], rest, after = [], errors = [];
|
|
11337
|
-
function append2(p) {
|
|
11338
|
-
(rest ? after : before).push(p);
|
|
11339
|
-
}
|
|
11340
|
-
for (const param of params) {
|
|
11341
|
-
switch (param.type) {
|
|
11342
|
-
case "ThisType":
|
|
11343
|
-
if (tt) {
|
|
11344
|
-
append2({
|
|
11345
|
-
type: "Error",
|
|
11346
|
-
message: "Only one typed this parameter is allowed"
|
|
11347
|
-
});
|
|
11348
|
-
append2(param);
|
|
11349
|
-
} else {
|
|
11350
|
-
tt = trimFirstSpace(param);
|
|
11351
|
-
if (before.length || rest) {
|
|
11352
|
-
let delim = tt.children.at(-1);
|
|
11353
|
-
if (Array.isArray(delim))
|
|
11354
|
-
delim = delim.at(-1);
|
|
11355
|
-
if (delim?.token !== ",") {
|
|
11356
|
-
tt = {
|
|
11357
|
-
...tt,
|
|
11358
|
-
children: [...tt.children, ", "]
|
|
11359
|
-
};
|
|
11360
|
-
}
|
|
11361
|
-
}
|
|
11362
|
-
}
|
|
11363
|
-
break;
|
|
11364
|
-
case "FunctionRestParameter":
|
|
11365
|
-
if (rest) {
|
|
11366
|
-
append2({
|
|
11367
|
-
type: "Error",
|
|
11368
|
-
message: "Only one rest parameter is allowed"
|
|
11369
|
-
});
|
|
11370
|
-
append2(param);
|
|
11371
|
-
} else {
|
|
11372
|
-
rest = param;
|
|
11373
|
-
}
|
|
11374
|
-
break;
|
|
11375
|
-
default:
|
|
11376
|
-
append2(param);
|
|
11377
|
-
}
|
|
11378
|
-
}
|
|
11379
|
-
const names = before.flatMap((p) => p.names);
|
|
11380
|
-
if (rest) {
|
|
11381
|
-
const restIdentifier = rest.binding.ref || rest.binding;
|
|
11382
|
-
names.push(...rest.names || []);
|
|
11383
|
-
let blockPrefix;
|
|
11384
|
-
if (after.length) {
|
|
11385
|
-
blockPrefix = {
|
|
11386
|
-
children: ["[", trimFirstSpace(after), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
|
|
11387
|
-
names: after.flatMap((p) => p.names)
|
|
11388
|
-
};
|
|
11389
|
-
}
|
|
11390
|
-
return {
|
|
11391
|
-
type: "Parameters",
|
|
11392
|
-
children: [
|
|
11393
|
-
tp,
|
|
11394
|
-
open,
|
|
11395
|
-
tt,
|
|
11396
|
-
...before,
|
|
11397
|
-
// Remove delimiter
|
|
11398
|
-
{ ...rest, children: rest.children.slice(0, -1) },
|
|
11399
|
-
close
|
|
11400
|
-
],
|
|
11401
|
-
tp,
|
|
11402
|
-
names,
|
|
11403
|
-
blockPrefix
|
|
11404
|
-
};
|
|
11405
|
-
}
|
|
11406
11694
|
return {
|
|
11407
11695
|
type: "Parameters",
|
|
11408
|
-
children: [tp, open,
|
|
11409
|
-
|
|
11410
|
-
|
|
11696
|
+
children: [tp, open, parameters, close],
|
|
11697
|
+
tp,
|
|
11698
|
+
parameters
|
|
11411
11699
|
};
|
|
11412
11700
|
});
|
|
11413
11701
|
function NonEmptyParameters(ctx, state2) {
|
|
@@ -11428,8 +11716,7 @@ function ParameterList(ctx, state2) {
|
|
|
11428
11716
|
}
|
|
11429
11717
|
var NestedParameterList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedParameter), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
11430
11718
|
var params = $2;
|
|
11431
|
-
if (!params.length)
|
|
11432
|
-
return $skip;
|
|
11719
|
+
if (!params.length) return $skip;
|
|
11433
11720
|
return params;
|
|
11434
11721
|
});
|
|
11435
11722
|
function NestedParameterList(ctx, state2) {
|
|
@@ -11453,12 +11740,15 @@ function Parameter(ctx, state2) {
|
|
|
11453
11740
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "Parameter", Parameter$$);
|
|
11454
11741
|
}
|
|
11455
11742
|
var FunctionRestParameter$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), BindingRestElement, (0, import_lib2.$E)(TypeSuffix), ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11456
|
-
var
|
|
11743
|
+
var rest = $2;
|
|
11744
|
+
var typeSuffix = $3;
|
|
11457
11745
|
return {
|
|
11458
11746
|
type: "FunctionRestParameter",
|
|
11459
11747
|
children: $0.slice(1),
|
|
11460
|
-
|
|
11461
|
-
|
|
11748
|
+
rest,
|
|
11749
|
+
names: rest.names,
|
|
11750
|
+
binding: rest.binding,
|
|
11751
|
+
typeSuffix
|
|
11462
11752
|
};
|
|
11463
11753
|
});
|
|
11464
11754
|
function FunctionRestParameter(ctx, state2) {
|
|
@@ -11545,7 +11835,7 @@ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExp
|
|
|
11545
11835
|
var expression = $2;
|
|
11546
11836
|
return {
|
|
11547
11837
|
type: "PinPattern",
|
|
11548
|
-
children:
|
|
11838
|
+
children: [expression],
|
|
11549
11839
|
expression
|
|
11550
11840
|
};
|
|
11551
11841
|
});
|
|
@@ -11606,8 +11896,7 @@ function ObjectBindingPattern(ctx, state2) {
|
|
|
11606
11896
|
var ObjectBindingPatternContent$0 = NestedBindingProperties;
|
|
11607
11897
|
var ObjectBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingPropertyList), function($skip, $loc, $0, $1) {
|
|
11608
11898
|
var props = $0;
|
|
11609
|
-
if (!props)
|
|
11610
|
-
return { children: [], names: [] };
|
|
11899
|
+
if (!props) return { children: [], names: [] };
|
|
11611
11900
|
return reorderBindingRestProperty(props);
|
|
11612
11901
|
});
|
|
11613
11902
|
var ObjectBindingPatternContent$$ = [ObjectBindingPatternContent$0, ObjectBindingPatternContent$1];
|
|
@@ -11647,8 +11936,7 @@ function ArrayBindingPattern(ctx, state2) {
|
|
|
11647
11936
|
var ArrayBindingPatternContent$0 = NestedBindingElements;
|
|
11648
11937
|
var ArrayBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingElementList), function($skip, $loc, $0, $1) {
|
|
11649
11938
|
var elements = $0;
|
|
11650
|
-
if (!elements)
|
|
11651
|
-
return { children: [], names: [], length: 0 };
|
|
11939
|
+
if (!elements) return { children: [], names: [], length: 0 };
|
|
11652
11940
|
return adjustBindingElements(elements);
|
|
11653
11941
|
});
|
|
11654
11942
|
var ArrayBindingPatternContent$$ = [ArrayBindingPatternContent$0, ArrayBindingPatternContent$1];
|
|
@@ -11673,8 +11961,7 @@ var NestedBindingElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
|
|
|
11673
11961
|
var indent = $1;
|
|
11674
11962
|
var elements = $2;
|
|
11675
11963
|
return elements.map((element, i) => {
|
|
11676
|
-
if (i > 0)
|
|
11677
|
-
return element;
|
|
11964
|
+
if (i > 0) return element;
|
|
11678
11965
|
return {
|
|
11679
11966
|
...element,
|
|
11680
11967
|
children: [indent, ...element.children.slice(1)]
|
|
@@ -11691,8 +11978,7 @@ function Elision(ctx, state2) {
|
|
|
11691
11978
|
}
|
|
11692
11979
|
var NestedBindingProperties$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedBindingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
11693
11980
|
var props = $2;
|
|
11694
|
-
if (!props.length)
|
|
11695
|
-
return $skip;
|
|
11981
|
+
if (!props.length) return $skip;
|
|
11696
11982
|
return reorderBindingRestProperty(props.flat());
|
|
11697
11983
|
});
|
|
11698
11984
|
function NestedBindingProperties(ctx, state2) {
|
|
@@ -11702,8 +11988,7 @@ var NestedBindingPropertyList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Neste
|
|
|
11702
11988
|
var ws = $1;
|
|
11703
11989
|
var props = $2;
|
|
11704
11990
|
return props.map((prop, i) => {
|
|
11705
|
-
if (i > 0)
|
|
11706
|
-
return prop;
|
|
11991
|
+
if (i > 0) return prop;
|
|
11707
11992
|
return prepend(ws, prop);
|
|
11708
11993
|
});
|
|
11709
11994
|
});
|
|
@@ -11765,6 +12050,7 @@ var BindingProperty$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
11765
12050
|
name: binding,
|
|
11766
12051
|
value: {
|
|
11767
12052
|
type: "PinPattern",
|
|
12053
|
+
children: [binding],
|
|
11768
12054
|
expression: binding
|
|
11769
12055
|
}
|
|
11770
12056
|
};
|
|
@@ -11828,8 +12114,7 @@ function BindingTypeSuffix(ctx, state2) {
|
|
|
11828
12114
|
}
|
|
11829
12115
|
var NestedBindingElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedBindingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
11830
12116
|
var elements = $2;
|
|
11831
|
-
if (!elements.length)
|
|
11832
|
-
return $skip;
|
|
12117
|
+
if (!elements.length) return $skip;
|
|
11833
12118
|
return adjustBindingElements(elements.flat());
|
|
11834
12119
|
});
|
|
11835
12120
|
function NestedBindingElements(ctx, state2) {
|
|
@@ -11868,7 +12153,7 @@ var BindingRestElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
11868
12153
|
var typeSuffix = $4;
|
|
11869
12154
|
return {
|
|
11870
12155
|
type: "BindingRestElement",
|
|
11871
|
-
children: [ws,
|
|
12156
|
+
children: [ws, dots, binding],
|
|
11872
12157
|
dots,
|
|
11873
12158
|
binding,
|
|
11874
12159
|
typeSuffix,
|
|
@@ -11908,10 +12193,8 @@ function EmptyBindingPattern(ctx, state2) {
|
|
|
11908
12193
|
return (0, import_lib2.$EVENT)(ctx, state2, "EmptyBindingPattern", EmptyBindingPattern$0);
|
|
11909
12194
|
}
|
|
11910
12195
|
var FunctionDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionExpression), function($skip, $loc, $0, $1) {
|
|
11911
|
-
if ($1.type !== "FunctionExpression")
|
|
11912
|
-
|
|
11913
|
-
if ($1.id)
|
|
11914
|
-
return $1;
|
|
12196
|
+
if ($1.type !== "FunctionExpression") return $skip;
|
|
12197
|
+
if ($1.id) return $1;
|
|
11915
12198
|
return makeLeftHandSideExpression($1);
|
|
11916
12199
|
});
|
|
11917
12200
|
function FunctionDeclaration(ctx, state2) {
|
|
@@ -11925,10 +12208,8 @@ var FunctionSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
11925
12208
|
var w = $5;
|
|
11926
12209
|
var parameters = $6;
|
|
11927
12210
|
var returnType = $7;
|
|
11928
|
-
if (!async)
|
|
11929
|
-
|
|
11930
|
-
if (!generator)
|
|
11931
|
-
generator = [];
|
|
12211
|
+
if (!async) async = [];
|
|
12212
|
+
if (!generator) generator = [];
|
|
11932
12213
|
const id = wid?.[1];
|
|
11933
12214
|
return {
|
|
11934
12215
|
type: "FunctionSignature",
|
|
@@ -11973,16 +12254,16 @@ var FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
11973
12254
|
var open = $2;
|
|
11974
12255
|
var op = $3;
|
|
11975
12256
|
var close = $4;
|
|
11976
|
-
if (op.special && op.call && !op.negated)
|
|
11977
|
-
return op.call;
|
|
12257
|
+
if (op.special && op.call && !op.negated) return op.call;
|
|
11978
12258
|
const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
|
|
11979
12259
|
[[], op, [], refB]
|
|
11980
12260
|
// BinaryOpRHS
|
|
11981
12261
|
]]);
|
|
12262
|
+
const parameterList = [[refA, ","], refB];
|
|
11982
12263
|
const parameters = {
|
|
11983
12264
|
type: "Parameters",
|
|
11984
|
-
children: ["(",
|
|
11985
|
-
|
|
12265
|
+
children: ["(", parameterList, ")"],
|
|
12266
|
+
parameters: parameterList
|
|
11986
12267
|
};
|
|
11987
12268
|
const block = {
|
|
11988
12269
|
expressions: [body]
|
|
@@ -12143,10 +12424,8 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12143
12424
|
var w2 = $8;
|
|
12144
12425
|
var parameters = $9;
|
|
12145
12426
|
var returnType = $10;
|
|
12146
|
-
if (!async)
|
|
12147
|
-
|
|
12148
|
-
if (!generator)
|
|
12149
|
-
generator = [];
|
|
12427
|
+
if (!async) async = [];
|
|
12428
|
+
if (!generator) generator = [];
|
|
12150
12429
|
if (!func) {
|
|
12151
12430
|
func = { $loc: op.$loc, token: "function" };
|
|
12152
12431
|
} else {
|
|
@@ -12215,8 +12494,7 @@ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12215
12494
|
var returnType = $3;
|
|
12216
12495
|
var arrow = $5;
|
|
12217
12496
|
var block = $6;
|
|
12218
|
-
if (!async)
|
|
12219
|
-
async = [];
|
|
12497
|
+
if (!async) async = [];
|
|
12220
12498
|
const generator = [];
|
|
12221
12499
|
return {
|
|
12222
12500
|
type: "FunctionExpression",
|
|
@@ -12261,8 +12539,7 @@ var ExplicitBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
|
12261
12539
|
var block = $4;
|
|
12262
12540
|
var ws2 = $6;
|
|
12263
12541
|
var close = $7;
|
|
12264
|
-
if (!block)
|
|
12265
|
-
return $skip;
|
|
12542
|
+
if (!block) return $skip;
|
|
12266
12543
|
return {
|
|
12267
12544
|
...block,
|
|
12268
12545
|
children: [ws1, open, ...block.children, ws2, close],
|
|
@@ -12275,8 +12552,7 @@ var ExplicitBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IndentedAtLeast,
|
|
|
12275
12552
|
var block = $4;
|
|
12276
12553
|
var ws2 = $6;
|
|
12277
12554
|
var close = $7;
|
|
12278
|
-
if (!block)
|
|
12279
|
-
return $skip;
|
|
12555
|
+
if (!block) return $skip;
|
|
12280
12556
|
return {
|
|
12281
12557
|
...block,
|
|
12282
12558
|
children: [ws1, open, ...block.children, ws2, close],
|
|
@@ -12301,8 +12577,7 @@ function EmptyBracedContent(ctx, state2) {
|
|
|
12301
12577
|
}
|
|
12302
12578
|
var ImplicitNestedBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), InsertOpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(NestedBlockStatements, InsertNewline, InsertIndent, InsertCloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12303
12579
|
var open = $2;
|
|
12304
|
-
if (!$4)
|
|
12305
|
-
return $skip;
|
|
12580
|
+
if (!$4) return $skip;
|
|
12306
12581
|
const [block, ...tail] = $4;
|
|
12307
12582
|
return {
|
|
12308
12583
|
...block,
|
|
@@ -12332,8 +12607,7 @@ function Block(ctx, state2) {
|
|
|
12332
12607
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "Block", Block$$);
|
|
12333
12608
|
}
|
|
12334
12609
|
var BareNestedBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), AllowAll, (0, import_lib2.$E)(NestedBlockStatements), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12335
|
-
if (!$3)
|
|
12336
|
-
return $skip;
|
|
12610
|
+
if (!$3) return $skip;
|
|
12337
12611
|
return $3;
|
|
12338
12612
|
});
|
|
12339
12613
|
function BareNestedBlock(ctx, state2) {
|
|
@@ -12469,8 +12743,7 @@ var BracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, (0
|
|
|
12469
12743
|
var s = $3;
|
|
12470
12744
|
var ws = $4;
|
|
12471
12745
|
var c = $5;
|
|
12472
|
-
if (!s.children.length)
|
|
12473
|
-
return $skip;
|
|
12746
|
+
if (!s.children.length) return $skip;
|
|
12474
12747
|
return {
|
|
12475
12748
|
type: "BlockStatement",
|
|
12476
12749
|
expressions: s.expressions,
|
|
@@ -12488,8 +12761,7 @@ var NoPostfixBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpen
|
|
|
12488
12761
|
var s = $3;
|
|
12489
12762
|
var ws = $4;
|
|
12490
12763
|
var c = $5;
|
|
12491
|
-
if (!s.expressions.length)
|
|
12492
|
-
return $skip;
|
|
12764
|
+
if (!s.expressions.length) return $skip;
|
|
12493
12765
|
return {
|
|
12494
12766
|
type: "BlockStatement",
|
|
12495
12767
|
expressions: s.expressions,
|
|
@@ -12507,8 +12779,7 @@ var NoCommaBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBr
|
|
|
12507
12779
|
var s = $3;
|
|
12508
12780
|
var ws = $4;
|
|
12509
12781
|
var c = $5;
|
|
12510
|
-
if (!s.children.length)
|
|
12511
|
-
return $skip;
|
|
12782
|
+
if (!s.children.length) return $skip;
|
|
12512
12783
|
return {
|
|
12513
12784
|
type: "BlockStatement",
|
|
12514
12785
|
expressions: s.expressions,
|
|
@@ -12549,11 +12820,9 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
|
|
|
12549
12820
|
var stmts = $2;
|
|
12550
12821
|
var last = $3;
|
|
12551
12822
|
const expressions = [...stmts];
|
|
12552
|
-
if (last)
|
|
12553
|
-
expressions.push(last);
|
|
12823
|
+
if (last) expressions.push(last);
|
|
12554
12824
|
const children = [expressions];
|
|
12555
|
-
if (hasTrailingComment(expressions))
|
|
12556
|
-
children.push(["\n"]);
|
|
12825
|
+
if (hasTrailingComment(expressions)) children.push(["\n"]);
|
|
12557
12826
|
return {
|
|
12558
12827
|
type: "BlockStatement",
|
|
12559
12828
|
expressions,
|
|
@@ -12568,8 +12837,7 @@ var PostfixedSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
|
|
|
12568
12837
|
var stmts = $1;
|
|
12569
12838
|
var last = $2;
|
|
12570
12839
|
const children = [...stmts];
|
|
12571
|
-
if (last)
|
|
12572
|
-
children.push(last);
|
|
12840
|
+
if (last) children.push(last);
|
|
12573
12841
|
return {
|
|
12574
12842
|
type: "BlockStatement",
|
|
12575
12843
|
expressions: children,
|
|
@@ -12584,8 +12852,7 @@ var PostfixedSingleLineNoCommaStatements$0 = (0, import_lib2.$TS)((0, import_lib
|
|
|
12584
12852
|
var stmts = $1;
|
|
12585
12853
|
var last = $2;
|
|
12586
12854
|
const children = [...stmts];
|
|
12587
|
-
if (last)
|
|
12588
|
-
children.push(last);
|
|
12855
|
+
if (last) children.push(last);
|
|
12589
12856
|
return {
|
|
12590
12857
|
type: "BlockStatement",
|
|
12591
12858
|
expressions: children,
|
|
@@ -12598,8 +12865,7 @@ function PostfixedSingleLineNoCommaStatements(ctx, state2) {
|
|
|
12598
12865
|
}
|
|
12599
12866
|
var NestedBlockStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedBlockStatement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
12600
12867
|
var statements = $2;
|
|
12601
|
-
if (!statements.length)
|
|
12602
|
-
return $skip;
|
|
12868
|
+
if (!statements.length) return $skip;
|
|
12603
12869
|
statements = statements.flat();
|
|
12604
12870
|
return {
|
|
12605
12871
|
type: "BlockStatement",
|
|
@@ -12626,8 +12892,7 @@ var BlockStatementPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
12626
12892
|
var ws = $2;
|
|
12627
12893
|
var statement = $3;
|
|
12628
12894
|
var delimiter = $4;
|
|
12629
|
-
if (ws)
|
|
12630
|
-
statement = prepend(ws, statement);
|
|
12895
|
+
if (ws) statement = prepend(ws, statement);
|
|
12631
12896
|
return [statement, delimiter];
|
|
12632
12897
|
});
|
|
12633
12898
|
function BlockStatementPart(ctx, state2) {
|
|
@@ -12654,7 +12919,7 @@ function LiteralContent(ctx, state2) {
|
|
|
12654
12919
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "LiteralContent", LiteralContent$$);
|
|
12655
12920
|
}
|
|
12656
12921
|
var NullLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L38, 'NullLiteral "null"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
12657
|
-
return { $loc, token: $1 };
|
|
12922
|
+
return { type: "NullLiteral", $loc, token: $1 };
|
|
12658
12923
|
});
|
|
12659
12924
|
function NullLiteral(ctx, state2) {
|
|
12660
12925
|
return (0, import_lib2.$EVENT)(ctx, state2, "NullLiteral", NullLiteral$0);
|
|
@@ -12669,17 +12934,17 @@ var _BooleanLiteral$0 = (0, import_lib2.$T)((0, import_lib2.$S)(CoffeeBooleansEn
|
|
|
12669
12934
|
return value[1];
|
|
12670
12935
|
});
|
|
12671
12936
|
var _BooleanLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L39, '_BooleanLiteral "true"'), (0, import_lib2.$EXPECT)($L40, '_BooleanLiteral "false"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
12672
|
-
return { $loc, token: $1 };
|
|
12937
|
+
return { type: "BooleanLiteral", $loc, token: $1 };
|
|
12673
12938
|
});
|
|
12674
12939
|
var _BooleanLiteral$$ = [_BooleanLiteral$0, _BooleanLiteral$1];
|
|
12675
12940
|
function _BooleanLiteral(ctx, state2) {
|
|
12676
12941
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "_BooleanLiteral", _BooleanLiteral$$);
|
|
12677
12942
|
}
|
|
12678
12943
|
var CoffeeScriptBooleanLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L41, 'CoffeeScriptBooleanLiteral "yes"'), (0, import_lib2.$EXPECT)($L42, 'CoffeeScriptBooleanLiteral "on"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
12679
|
-
return { $loc, token: "true" };
|
|
12944
|
+
return { type: "BooleanLiteral", $loc, token: "true" };
|
|
12680
12945
|
});
|
|
12681
12946
|
var CoffeeScriptBooleanLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L43, 'CoffeeScriptBooleanLiteral "no"'), (0, import_lib2.$EXPECT)($L44, 'CoffeeScriptBooleanLiteral "off"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
12682
|
-
return { $loc, token: "false" };
|
|
12947
|
+
return { type: "BooleanLiteral", $loc, token: "false" };
|
|
12683
12948
|
});
|
|
12684
12949
|
var CoffeeScriptBooleanLiteral$$ = [CoffeeScriptBooleanLiteral$0, CoffeeScriptBooleanLiteral$1];
|
|
12685
12950
|
function CoffeeScriptBooleanLiteral(ctx, state2) {
|
|
@@ -12776,8 +13041,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
|
|
|
12776
13041
|
var open = $1;
|
|
12777
13042
|
var close = $2;
|
|
12778
13043
|
var content = $5;
|
|
12779
|
-
if (!content)
|
|
12780
|
-
return $skip;
|
|
13044
|
+
if (!content) return $skip;
|
|
12781
13045
|
let last = content[content.length - 1];
|
|
12782
13046
|
let lastArray = Array.isArray(last) ? last : last.children;
|
|
12783
13047
|
if (isComma(lastArray[lastArray.length - 1])) {
|
|
@@ -12797,8 +13061,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
|
|
|
12797
13061
|
});
|
|
12798
13062
|
var _ArrayLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12799
13063
|
var open = $1;
|
|
12800
|
-
if (!$3)
|
|
12801
|
-
return $skip;
|
|
13064
|
+
if (!$3) return $skip;
|
|
12802
13065
|
const [content, ws, close] = $3;
|
|
12803
13066
|
if (content.type === "RangeExpression") {
|
|
12804
13067
|
return prepend(ws, content);
|
|
@@ -12933,8 +13196,7 @@ var ArrayLiteralContent$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(ElementList
|
|
|
12933
13196
|
var list = $1;
|
|
12934
13197
|
var delimiter = $2;
|
|
12935
13198
|
var nested = $3;
|
|
12936
|
-
if (!nested)
|
|
12937
|
-
return list;
|
|
13199
|
+
if (!nested) return list;
|
|
12938
13200
|
return [...list, delimiter, ...nested];
|
|
12939
13201
|
});
|
|
12940
13202
|
var ArrayLiteralContent$3 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, ElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
|
|
@@ -12958,13 +13220,10 @@ var NestedElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, ElementLi
|
|
|
12958
13220
|
var list = $2;
|
|
12959
13221
|
var delimiter = $3;
|
|
12960
13222
|
const { length } = list;
|
|
12961
|
-
if (!length)
|
|
12962
|
-
return $skip;
|
|
13223
|
+
if (!length) return $skip;
|
|
12963
13224
|
return list.map((e, i) => {
|
|
12964
|
-
if (i === 0)
|
|
12965
|
-
|
|
12966
|
-
if (i === length - 1)
|
|
12967
|
-
e = append(e, delimiter);
|
|
13225
|
+
if (i === 0) e = prepend(indent, e);
|
|
13226
|
+
if (i === length - 1) e = append(e, delimiter);
|
|
12968
13227
|
return e;
|
|
12969
13228
|
});
|
|
12970
13229
|
});
|
|
@@ -12981,8 +13240,7 @@ function ArrayElementDelimiter(ctx, state2) {
|
|
|
12981
13240
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrayElementDelimiter", ArrayElementDelimiter$$);
|
|
12982
13241
|
}
|
|
12983
13242
|
var ElementListWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, (0, import_lib2.$E)(ElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
|
|
12984
|
-
if ($2)
|
|
12985
|
-
return $2;
|
|
13243
|
+
if ($2) return $2;
|
|
12986
13244
|
return $skip;
|
|
12987
13245
|
});
|
|
12988
13246
|
function ElementListWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -12999,8 +13257,7 @@ function ElementList(ctx, state2) {
|
|
|
12999
13257
|
var SingleLineElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), ArrayElementExpression, (0, import_lib2.$Q)(ElementListRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
13000
13258
|
var first = $2;
|
|
13001
13259
|
var rest = $3;
|
|
13002
|
-
if (!rest.length)
|
|
13003
|
-
return [first];
|
|
13260
|
+
if (!rest.length) return [first];
|
|
13004
13261
|
return [
|
|
13005
13262
|
append(first, rest[0][0])
|
|
13006
13263
|
].concat(
|
|
@@ -13065,8 +13322,7 @@ var NestedBulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
|
|
|
13065
13322
|
var open = $1;
|
|
13066
13323
|
var content = $4;
|
|
13067
13324
|
var close = $6;
|
|
13068
|
-
if (!content.length)
|
|
13069
|
-
return $skip;
|
|
13325
|
+
if (!content.length) return $skip;
|
|
13070
13326
|
content = content.flat();
|
|
13071
13327
|
const last = content[content.length - 1];
|
|
13072
13328
|
if (last.children?.at(-1)?.implicit) {
|
|
@@ -13084,8 +13340,7 @@ var BulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket
|
|
|
13084
13340
|
var open = $1;
|
|
13085
13341
|
var content = $2;
|
|
13086
13342
|
var close = $3;
|
|
13087
|
-
if (!content)
|
|
13088
|
-
return $skip;
|
|
13343
|
+
if (!content) return $skip;
|
|
13089
13344
|
content = [
|
|
13090
13345
|
...trimFirstSpace(content[0]),
|
|
13091
13346
|
// replace first space with bracket
|
|
@@ -13114,11 +13369,9 @@ function NestedArrayBullet(ctx, state2) {
|
|
|
13114
13369
|
var ArrayBullet$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BulletIndent, (0, import_lib2.$E)((0, import_lib2.$S)(ElementList, ArrayBulletDelimiter)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
13115
13370
|
var bullet = $1;
|
|
13116
13371
|
var content = $2;
|
|
13117
|
-
if (!content)
|
|
13118
|
-
return $skip;
|
|
13372
|
+
if (!content) return $skip;
|
|
13119
13373
|
let [list, delimiter] = content;
|
|
13120
|
-
if (!list.length)
|
|
13121
|
-
return $skip;
|
|
13374
|
+
if (!list.length) return $skip;
|
|
13122
13375
|
list = list.slice();
|
|
13123
13376
|
list[0] = prepend(bullet, list[0]);
|
|
13124
13377
|
if (delimiter) {
|
|
@@ -13145,8 +13398,7 @@ var BulletIndent$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Bullet), function(
|
|
|
13145
13398
|
$loc,
|
|
13146
13399
|
level: getIndentLevel(" ".repeat(state.currentIndent.level) + bullet + ws, config.tab)
|
|
13147
13400
|
};
|
|
13148
|
-
if (config.verbose)
|
|
13149
|
-
console.log("pushing bullet indent", indent);
|
|
13401
|
+
if (config.verbose) console.log("pushing bullet indent", indent);
|
|
13150
13402
|
state.indentLevels.push(indent);
|
|
13151
13403
|
return indent;
|
|
13152
13404
|
});
|
|
@@ -13191,8 +13443,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
|
|
|
13191
13443
|
var open = $1;
|
|
13192
13444
|
var close = $2;
|
|
13193
13445
|
var properties = $5;
|
|
13194
|
-
if (!properties?.length)
|
|
13195
|
-
return $skip;
|
|
13446
|
+
if (!properties?.length) return $skip;
|
|
13196
13447
|
let last = properties[properties.length - 1];
|
|
13197
13448
|
if (last.delim?.implicit) {
|
|
13198
13449
|
last = {
|
|
@@ -13211,8 +13462,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
|
|
|
13211
13462
|
});
|
|
13212
13463
|
var BracedObjectLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(BracedObjectLiteralContent, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
13213
13464
|
var open = $1;
|
|
13214
|
-
if (!$3)
|
|
13215
|
-
return $skip;
|
|
13465
|
+
if (!$3) return $skip;
|
|
13216
13466
|
const [properties, ...close] = $3;
|
|
13217
13467
|
return {
|
|
13218
13468
|
type: "ObjectExpression",
|
|
@@ -13230,8 +13480,7 @@ var SingleLineObjectProperties$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0,
|
|
|
13230
13480
|
return line.flatMap(([prop, delim]) => {
|
|
13231
13481
|
prop = Array.isArray(prop) ? prop : [prop];
|
|
13232
13482
|
let last = prop[prop.length - 1];
|
|
13233
|
-
if (!last)
|
|
13234
|
-
return [];
|
|
13483
|
+
if (!last) return [];
|
|
13235
13484
|
last = {
|
|
13236
13485
|
...last,
|
|
13237
13486
|
delim,
|
|
@@ -13268,8 +13517,7 @@ function BracedObjectLiteralContent(ctx, state2) {
|
|
|
13268
13517
|
}
|
|
13269
13518
|
var NestedImplicitObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, PushIndent, AllowPipeline, (0, import_lib2.$E)(NestedImplicitPropertyDefinitions), RestorePipeline, PopIndent, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13270
13519
|
var properties = $4;
|
|
13271
|
-
if (!properties)
|
|
13272
|
-
return $skip;
|
|
13520
|
+
if (!properties) return $skip;
|
|
13273
13521
|
return {
|
|
13274
13522
|
type: "ObjectExpression",
|
|
13275
13523
|
properties,
|
|
@@ -13303,8 +13551,7 @@ function NestedImplicitPropertyDefinition(ctx, state2) {
|
|
|
13303
13551
|
}
|
|
13304
13552
|
var NestedPropertyDefinitions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedPropertyDefinition), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
13305
13553
|
var defs = $2;
|
|
13306
|
-
if (!defs.length)
|
|
13307
|
-
return $skip;
|
|
13554
|
+
if (!defs.length) return $skip;
|
|
13308
13555
|
return defs.flat();
|
|
13309
13556
|
});
|
|
13310
13557
|
function NestedPropertyDefinitions(ctx, state2) {
|
|
@@ -13314,8 +13561,7 @@ var NestedPropertyDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
|
|
|
13314
13561
|
var ws = $1;
|
|
13315
13562
|
var inlineProps = $2;
|
|
13316
13563
|
return inlineProps.flatMap(([prop, delim], i) => {
|
|
13317
|
-
if (!Array.isArray(prop))
|
|
13318
|
-
prop = [prop];
|
|
13564
|
+
if (!Array.isArray(prop)) prop = [prop];
|
|
13319
13565
|
if (i === 0) {
|
|
13320
13566
|
const [first, ...rest] = prop;
|
|
13321
13567
|
prop = [prepend(ws, first), ...rest];
|
|
@@ -13448,8 +13694,7 @@ var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13448
13694
|
children: def.children.flatMap((c, i) => i ? [",", c] : [c])
|
|
13449
13695
|
};
|
|
13450
13696
|
}
|
|
13451
|
-
if (!def.block || def.block.empty)
|
|
13452
|
-
return $skip;
|
|
13697
|
+
if (!def.block || def.block.empty) return $skip;
|
|
13453
13698
|
return prepend(ws, def);
|
|
13454
13699
|
});
|
|
13455
13700
|
var PropertyDefinition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), DotDotDot, Expression), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -13471,8 +13716,11 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13471
13716
|
var post = $5;
|
|
13472
13717
|
if (!pre.length && !post) {
|
|
13473
13718
|
switch (value.type) {
|
|
13719
|
+
// `{identifier}` remains `{identifier}`, the one shorthand JS supports
|
|
13474
13720
|
case "Identifier":
|
|
13475
13721
|
return prepend(ws, value);
|
|
13722
|
+
// PropertyGlob like x.{a,b} turns into ObjectExpression {a: x.a, b: x.b}
|
|
13723
|
+
// (via `processCallMemberExpression`)
|
|
13476
13724
|
case "ObjectExpression":
|
|
13477
13725
|
let first = value.properties[0];
|
|
13478
13726
|
if (first) {
|
|
@@ -13486,8 +13734,7 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13486
13734
|
}
|
|
13487
13735
|
}
|
|
13488
13736
|
const last = lastAccessInCallExpression(value);
|
|
13489
|
-
if (!last)
|
|
13490
|
-
return $skip;
|
|
13737
|
+
if (!last) return $skip;
|
|
13491
13738
|
let name, ref, refAssignment;
|
|
13492
13739
|
const { expression, type } = last;
|
|
13493
13740
|
if (type === "Index") {
|
|
@@ -13500,11 +13747,10 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13500
13747
|
value = {
|
|
13501
13748
|
...value,
|
|
13502
13749
|
children: value.children.map((c) => {
|
|
13503
|
-
if (c === last)
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
};
|
|
13750
|
+
if (c === last) return {
|
|
13751
|
+
type: "Index",
|
|
13752
|
+
children: ["[", ref, "]"]
|
|
13753
|
+
};
|
|
13508
13754
|
return c;
|
|
13509
13755
|
})
|
|
13510
13756
|
};
|
|
@@ -13516,11 +13762,9 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13516
13762
|
}
|
|
13517
13763
|
} else {
|
|
13518
13764
|
({ name } = last);
|
|
13519
|
-
if (!name)
|
|
13520
|
-
return $skip;
|
|
13765
|
+
if (!name) return $skip;
|
|
13521
13766
|
}
|
|
13522
|
-
if (name[0] === "#")
|
|
13523
|
-
name = name.slice(1);
|
|
13767
|
+
if (name[0] === "#") name = name.slice(1);
|
|
13524
13768
|
return {
|
|
13525
13769
|
type: "Property",
|
|
13526
13770
|
children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
|
|
@@ -13591,8 +13835,7 @@ var ComputedPropertyName$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracke
|
|
|
13591
13835
|
});
|
|
13592
13836
|
var ComputedPropertyName$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket, TemplateLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3) {
|
|
13593
13837
|
var expression = $2;
|
|
13594
|
-
if ($2.type === "StringLiteral")
|
|
13595
|
-
return $2;
|
|
13838
|
+
if ($2.type === "StringLiteral") return $2;
|
|
13596
13839
|
return {
|
|
13597
13840
|
type: "ComputedPropertyName",
|
|
13598
13841
|
children: $0,
|
|
@@ -13619,8 +13862,7 @@ function Decorator(ctx, state2) {
|
|
|
13619
13862
|
}
|
|
13620
13863
|
var Decorators$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidClassImplicitCall, (0, import_lib2.$Q)((0, import_lib2.$S)(__, Decorator)), __, RestoreClassImplicitCall), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
13621
13864
|
var decorators = $2;
|
|
13622
|
-
if (!decorators.length)
|
|
13623
|
-
return $skip;
|
|
13865
|
+
if (!decorators.length) return $skip;
|
|
13624
13866
|
return $0;
|
|
13625
13867
|
});
|
|
13626
13868
|
function Decorators(ctx, state2) {
|
|
@@ -13659,8 +13901,7 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
|
|
|
13659
13901
|
var ws = $2;
|
|
13660
13902
|
var content = $4;
|
|
13661
13903
|
var block = $6;
|
|
13662
|
-
if (!content)
|
|
13663
|
-
return $skip;
|
|
13904
|
+
if (!content) return $skip;
|
|
13664
13905
|
const [base, rest, returnType] = content;
|
|
13665
13906
|
const value = [base, rest];
|
|
13666
13907
|
if (!rest.length) {
|
|
@@ -13671,12 +13912,9 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
|
|
|
13671
13912
|
({ name: name2 } = lastAccess2);
|
|
13672
13913
|
}
|
|
13673
13914
|
}
|
|
13674
|
-
if (!name2)
|
|
13675
|
-
|
|
13676
|
-
if (
|
|
13677
|
-
return $skip;
|
|
13678
|
-
if (name2[0] === "#")
|
|
13679
|
-
name2 = name2.slice(1);
|
|
13915
|
+
if (!name2) ({ name: name2 } = base);
|
|
13916
|
+
if (!name2) return $skip;
|
|
13917
|
+
if (name2[0] === "#") name2 = name2.slice(1);
|
|
13680
13918
|
const autoReturn = !block || base.type !== "Identifier";
|
|
13681
13919
|
return makeGetterMethod(name2, ws, base, returnType, block, kind, autoReturn);
|
|
13682
13920
|
}
|
|
@@ -13749,10 +13987,8 @@ var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, im
|
|
|
13749
13987
|
var MethodModifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, __)), (0, import_lib2.$E)((0, import_lib2.$S)(Star, __))), function($skip, $loc, $0, $1, $2) {
|
|
13750
13988
|
var async = $1;
|
|
13751
13989
|
var generator = $2;
|
|
13752
|
-
if (!async)
|
|
13753
|
-
|
|
13754
|
-
if (!generator)
|
|
13755
|
-
generator = [];
|
|
13990
|
+
if (!async) async = [];
|
|
13991
|
+
if (!generator) generator = [];
|
|
13756
13992
|
return {
|
|
13757
13993
|
async,
|
|
13758
13994
|
generator,
|
|
@@ -13793,8 +14029,7 @@ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(MethodModifier,
|
|
|
13793
14029
|
} else if (name.token) {
|
|
13794
14030
|
name = name.token.match(/^(?:"|')/) ? name.token.slice(1, -1) : name.token;
|
|
13795
14031
|
}
|
|
13796
|
-
if (optional)
|
|
13797
|
-
optional = { ...optional, ts: true };
|
|
14032
|
+
if (optional) optional = { ...optional, ts: true };
|
|
13798
14033
|
return {
|
|
13799
14034
|
type: "MethodSignature",
|
|
13800
14035
|
children: [...modifier.children, name, ws1, optional, ws2, parameters, returnType],
|
|
@@ -13851,8 +14086,7 @@ var AssignmentOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentOpSymbol
|
|
|
13851
14086
|
children: [$1, ...$2]
|
|
13852
14087
|
};
|
|
13853
14088
|
}
|
|
13854
|
-
if (typeof $1 !== "string")
|
|
13855
|
-
return $1;
|
|
14089
|
+
if (typeof $1 !== "string") return $1;
|
|
13856
14090
|
return { $loc, token: $1 };
|
|
13857
14091
|
});
|
|
13858
14092
|
function AssignmentOp(ctx, state2) {
|
|
@@ -13970,10 +14204,8 @@ var NotDedentedBinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
|
|
|
13970
14204
|
var ws2 = $2;
|
|
13971
14205
|
var op = $3;
|
|
13972
14206
|
const ws = [];
|
|
13973
|
-
if (ws1)
|
|
13974
|
-
|
|
13975
|
-
if (ws2)
|
|
13976
|
-
ws.push(...ws2);
|
|
14207
|
+
if (ws1) ws.push(...ws1);
|
|
14208
|
+
if (ws2) ws.push(...ws2);
|
|
13977
14209
|
return [ws, op];
|
|
13978
14210
|
});
|
|
13979
14211
|
var NotDedentedBinaryOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedBinaryOpAllowed, Nested, (0, import_lib2.$E)(_), (0, import_lib2.$N)(Identifier), (0, import_lib2.$C)((0, import_lib2.$N)((0, import_lib2.$EXPECT)($L75, 'NotDedentedBinaryOp "*"')), (0, import_lib2.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
@@ -13981,8 +14213,7 @@ var NotDedentedBinaryOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedBinar
|
|
|
13981
14213
|
var ws2 = $3;
|
|
13982
14214
|
var op = $6;
|
|
13983
14215
|
const ws = [...ws1];
|
|
13984
|
-
if (ws2)
|
|
13985
|
-
ws.push(...ws2);
|
|
14216
|
+
if (ws2) ws.push(...ws2);
|
|
13986
14217
|
return [ws, op];
|
|
13987
14218
|
});
|
|
13988
14219
|
var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
|
|
@@ -13991,8 +14222,7 @@ function NotDedentedBinaryOp(ctx, state2) {
|
|
|
13991
14222
|
}
|
|
13992
14223
|
var IdentifierBinaryOp$0 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
|
|
13993
14224
|
var id = $0;
|
|
13994
|
-
if (state.operators.has(id.name))
|
|
13995
|
-
return id;
|
|
14225
|
+
if (state.operators.has(id.name)) return id;
|
|
13996
14226
|
return $skip;
|
|
13997
14227
|
});
|
|
13998
14228
|
function IdentifierBinaryOp(ctx, state2) {
|
|
@@ -14006,14 +14236,12 @@ function BinaryOp(ctx, state2) {
|
|
|
14006
14236
|
return (0, import_lib2.$EVENT)(ctx, state2, "BinaryOp", BinaryOp$0);
|
|
14007
14237
|
}
|
|
14008
14238
|
var _BinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BinaryOpSymbol), function($skip, $loc, $0, $1) {
|
|
14009
|
-
if (typeof $1 === "string")
|
|
14010
|
-
return { $loc, token: $1 };
|
|
14239
|
+
if (typeof $1 === "string") return { $loc, token: $1 };
|
|
14011
14240
|
return $1;
|
|
14012
14241
|
});
|
|
14013
14242
|
var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
|
|
14014
14243
|
var id = $0;
|
|
14015
|
-
if (!state.operators.has(id.name))
|
|
14016
|
-
return $skip;
|
|
14244
|
+
if (!state.operators.has(id.name)) return $skip;
|
|
14017
14245
|
return {
|
|
14018
14246
|
token: id.name,
|
|
14019
14247
|
call: id,
|
|
@@ -14023,8 +14251,7 @@ var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1)
|
|
|
14023
14251
|
});
|
|
14024
14252
|
var _BinaryOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __, Identifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
14025
14253
|
var id = $3;
|
|
14026
|
-
if (!state.operators.has(id.name))
|
|
14027
|
-
return $skip;
|
|
14254
|
+
if (!state.operators.has(id.name)) return $skip;
|
|
14028
14255
|
return {
|
|
14029
14256
|
token: id.name,
|
|
14030
14257
|
call: id,
|
|
@@ -14107,13 +14334,11 @@ var BinaryOpSymbol$24 = (0, import_lib2.$T)((0, import_lib2.$EXPECT)($L92, 'Bina
|
|
|
14107
14334
|
return "!==";
|
|
14108
14335
|
});
|
|
14109
14336
|
var BinaryOpSymbol$25 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L93, 'BinaryOpSymbol "!="'), (0, import_lib2.$EXPECT)($L94, 'BinaryOpSymbol "\u2260"')), function($skip, $loc, $0, $1) {
|
|
14110
|
-
if (config.coffeeEq)
|
|
14111
|
-
return "!==";
|
|
14337
|
+
if (config.coffeeEq) return "!==";
|
|
14112
14338
|
return "!=";
|
|
14113
14339
|
});
|
|
14114
14340
|
var BinaryOpSymbol$26 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L95, 'BinaryOpSymbol "isnt"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
14115
|
-
if (config.coffeeIsnt)
|
|
14116
|
-
return "!==";
|
|
14341
|
+
if (config.coffeeIsnt) return "!==";
|
|
14117
14342
|
return $skip;
|
|
14118
14343
|
});
|
|
14119
14344
|
var BinaryOpSymbol$27 = (0, import_lib2.$EXPECT)($L96, 'BinaryOpSymbol "==="');
|
|
@@ -14121,8 +14346,7 @@ var BinaryOpSymbol$28 = (0, import_lib2.$T)((0, import_lib2.$C)((0, import_lib2.
|
|
|
14121
14346
|
return "===";
|
|
14122
14347
|
});
|
|
14123
14348
|
var BinaryOpSymbol$29 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L99, 'BinaryOpSymbol "=="'), (0, import_lib2.$EXPECT)($L100, 'BinaryOpSymbol "\u2261"'), (0, import_lib2.$EXPECT)($L101, 'BinaryOpSymbol "\u2A75"')), function($skip, $loc, $0, $1) {
|
|
14124
|
-
if (config.coffeeEq)
|
|
14125
|
-
return "===";
|
|
14349
|
+
if (config.coffeeEq) return "===";
|
|
14126
14350
|
return "==";
|
|
14127
14351
|
});
|
|
14128
14352
|
var BinaryOpSymbol$30 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L102, 'BinaryOpSymbol "and"'), NonIdContinue), function(value) {
|
|
@@ -14320,8 +14544,7 @@ var UnaryOp$1 = AwaitOp;
|
|
|
14320
14544
|
var UnaryOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)(Delete, Void, Typeof), (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R30, "UnaryOp /[:.]/")), (0, import_lib2.$E)(_)), function($skip, $loc, $0, $1, $2, $3) {
|
|
14321
14545
|
var op = $1;
|
|
14322
14546
|
var ws = $3;
|
|
14323
|
-
if (!ws)
|
|
14324
|
-
return [op, [" "]];
|
|
14547
|
+
if (!ws) return [op, [" "]];
|
|
14325
14548
|
return [op, ws];
|
|
14326
14549
|
});
|
|
14327
14550
|
var UnaryOp$3 = (0, import_lib2.$T)((0, import_lib2.$S)(Not, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R30, "UnaryOp /[:.]/")), (0, import_lib2.$E)((0, import_lib2.$EXPECT)($L18, 'UnaryOp " "')), (0, import_lib2.$E)(_)), function(value) {
|
|
@@ -14365,8 +14588,7 @@ function StatementListItem(ctx, state2) {
|
|
|
14365
14588
|
var PostfixedStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Statement, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
14366
14589
|
var statement = $1;
|
|
14367
14590
|
var post = $2;
|
|
14368
|
-
if (post)
|
|
14369
|
-
return addPostfixStatement(statement, ...post);
|
|
14591
|
+
if (post) return addPostfixStatement(statement, ...post);
|
|
14370
14592
|
return statement;
|
|
14371
14593
|
});
|
|
14372
14594
|
function PostfixedStatement(ctx, state2) {
|
|
@@ -14381,8 +14603,7 @@ function NoCommaStatementListItem(ctx, state2) {
|
|
|
14381
14603
|
var PostfixedNoCommaStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(NoCommaStatement, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
14382
14604
|
var statement = $1;
|
|
14383
14605
|
var post = $2;
|
|
14384
|
-
if (post)
|
|
14385
|
-
return addPostfixStatement(statement, ...post);
|
|
14606
|
+
if (post) return addPostfixStatement(statement, ...post);
|
|
14386
14607
|
return statement;
|
|
14387
14608
|
});
|
|
14388
14609
|
function PostfixedNoCommaStatement(ctx, state2) {
|
|
@@ -14391,8 +14612,7 @@ function PostfixedNoCommaStatement(ctx, state2) {
|
|
|
14391
14612
|
var PostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
14392
14613
|
var expression = $1;
|
|
14393
14614
|
var post = $2;
|
|
14394
|
-
if (post)
|
|
14395
|
-
return attachPostfixStatementAsExpression(expression, post);
|
|
14615
|
+
if (post) return attachPostfixStatementAsExpression(expression, post);
|
|
14396
14616
|
return expression;
|
|
14397
14617
|
});
|
|
14398
14618
|
function PostfixedExpression(ctx, state2) {
|
|
@@ -14401,8 +14621,7 @@ function PostfixedExpression(ctx, state2) {
|
|
|
14401
14621
|
var PostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PostfixedExpression, (0, import_lib2.$C)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement), (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, AssignmentExpression)))), function($skip, $loc, $0, $1, $2) {
|
|
14402
14622
|
var expression = $1;
|
|
14403
14623
|
var post = $2;
|
|
14404
|
-
if (!post.length)
|
|
14405
|
-
return $1;
|
|
14624
|
+
if (!post.length) return $1;
|
|
14406
14625
|
if (post.length === 2 && !Array.isArray(post[1])) {
|
|
14407
14626
|
return attachPostfixStatementAsExpression(expression, post);
|
|
14408
14627
|
}
|
|
@@ -14431,10 +14650,8 @@ var Statement$2 = (0, import_lib2.$T)((0, import_lib2.$S)(IfStatement, (0, impor
|
|
|
14431
14650
|
return value[0];
|
|
14432
14651
|
});
|
|
14433
14652
|
var Statement$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(IterationStatement, (0, import_lib2.$N)(ShouldExpressionize)), function($skip, $loc, $0, $1, $2) {
|
|
14434
|
-
if ($1.generator)
|
|
14435
|
-
|
|
14436
|
-
if ($1.reduction)
|
|
14437
|
-
return $skip;
|
|
14653
|
+
if ($1.generator) return $skip;
|
|
14654
|
+
if ($1.reduction) return $skip;
|
|
14438
14655
|
return $1;
|
|
14439
14656
|
});
|
|
14440
14657
|
var Statement$4 = (0, import_lib2.$T)((0, import_lib2.$S)(SwitchStatement, (0, import_lib2.$N)(ShouldExpressionize)), function(value) {
|
|
@@ -14509,8 +14726,7 @@ var Label$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Colon, IdentifierName, Wh
|
|
|
14509
14726
|
var colon = $1;
|
|
14510
14727
|
var id = $2;
|
|
14511
14728
|
var w = $3;
|
|
14512
|
-
if (id.name === "void")
|
|
14513
|
-
return $skip;
|
|
14729
|
+
if (id.name === "void") return $skip;
|
|
14514
14730
|
return {
|
|
14515
14731
|
type: "Label",
|
|
14516
14732
|
name: id.name,
|
|
@@ -14822,8 +15038,7 @@ function ForClause(ctx, state2) {
|
|
|
14822
15038
|
var ForStatementControlWithWhen$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForStatementControlWithReduction, (0, import_lib2.$E)(WhenCondition)), function($skip, $loc, $0, $1, $2) {
|
|
14823
15039
|
var control = $1;
|
|
14824
15040
|
var condition = $2;
|
|
14825
|
-
if (!condition)
|
|
14826
|
-
return control;
|
|
15041
|
+
if (!condition) return control;
|
|
14827
15042
|
const expressions = [["", {
|
|
14828
15043
|
type: "ContinueStatement",
|
|
14829
15044
|
children: ["continue"]
|
|
@@ -15113,8 +15328,7 @@ var SwitchStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Switch, ForbidN
|
|
|
15113
15328
|
var s = $1;
|
|
15114
15329
|
var condition = $3;
|
|
15115
15330
|
var caseBlock = $5;
|
|
15116
|
-
if (!condition)
|
|
15117
|
-
return $skip;
|
|
15331
|
+
if (!condition) return $skip;
|
|
15118
15332
|
if (condition.type === "EmptyCondition") {
|
|
15119
15333
|
caseBlock.clauses.forEach(({ cases }) => {
|
|
15120
15334
|
if (cases) {
|
|
@@ -15177,8 +15391,7 @@ function CaseBlock(ctx, state2) {
|
|
|
15177
15391
|
}
|
|
15178
15392
|
var NestedCaseClauses$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedCaseClause), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
15179
15393
|
var clauses = $2;
|
|
15180
|
-
if (clauses.length)
|
|
15181
|
-
return clauses;
|
|
15394
|
+
if (clauses.length) return clauses;
|
|
15182
15395
|
return $skip;
|
|
15183
15396
|
});
|
|
15184
15397
|
function NestedCaseClauses(ctx, state2) {
|
|
@@ -15257,8 +15470,7 @@ function PatternExpressionList(ctx, state2) {
|
|
|
15257
15470
|
var PatternExpression$0 = BindingPattern;
|
|
15258
15471
|
var PatternExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, (0, import_lib2.$E)((0, import_lib2.$P)(SingleLineBinaryOpRHS)), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
|
|
15259
15472
|
var pattern = $2;
|
|
15260
|
-
if (!pattern)
|
|
15261
|
-
return $skip;
|
|
15473
|
+
if (!pattern) return $skip;
|
|
15262
15474
|
return {
|
|
15263
15475
|
type: "ConditionFragment",
|
|
15264
15476
|
children: pattern
|
|
@@ -15273,8 +15485,7 @@ var CaseExpressionList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
15273
15485
|
var rest = $2;
|
|
15274
15486
|
const result = rest.map(([ws, _comma, exp, col]) => {
|
|
15275
15487
|
exp = trimFirstSpace(exp);
|
|
15276
|
-
if (ws.length)
|
|
15277
|
-
return [insertTrimmingSpace("case ", ws), exp, col];
|
|
15488
|
+
if (ws.length) return [insertTrimmingSpace("case ", ws), exp, col];
|
|
15278
15489
|
return ["case ", exp, col];
|
|
15279
15490
|
});
|
|
15280
15491
|
result.unshift(first);
|
|
@@ -15286,8 +15497,7 @@ function CaseExpressionList(ctx, state2) {
|
|
|
15286
15497
|
var CaseExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$E)(_), Colon))), function($skip, $loc, $0, $1, $2) {
|
|
15287
15498
|
var value = $1;
|
|
15288
15499
|
if (value.type === "ComputedPropertyName") {
|
|
15289
|
-
if (value.implicit)
|
|
15290
|
-
return value.expression;
|
|
15500
|
+
if (value.implicit) return value.expression;
|
|
15291
15501
|
return { ...value, type: "ArrayExpression" };
|
|
15292
15502
|
}
|
|
15293
15503
|
return value;
|
|
@@ -15304,8 +15514,7 @@ function ImpliedColon(ctx, state2) {
|
|
|
15304
15514
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ImpliedColon", ImpliedColon$$);
|
|
15305
15515
|
}
|
|
15306
15516
|
var IgnoreColon$0 = (0, import_lib2.$TV)((0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), Colon)), function($skip, $loc, $0, $1) {
|
|
15307
|
-
if ($1)
|
|
15308
|
-
return $1[0];
|
|
15517
|
+
if ($1) return $1[0];
|
|
15309
15518
|
});
|
|
15310
15519
|
function IgnoreColon(ctx, state2) {
|
|
15311
15520
|
return (0, import_lib2.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
|
|
@@ -15336,8 +15545,7 @@ var CatchBinding$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E
|
|
|
15336
15545
|
var parameter = $5;
|
|
15337
15546
|
var ws3 = $7;
|
|
15338
15547
|
var close = $8;
|
|
15339
|
-
if (!parameter)
|
|
15340
|
-
return $skip;
|
|
15548
|
+
if (!parameter) return $skip;
|
|
15341
15549
|
return {
|
|
15342
15550
|
type: "CatchBinding",
|
|
15343
15551
|
parameter,
|
|
@@ -15349,8 +15557,7 @@ var CatchBinding$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(_, InsertOpenParen
|
|
|
15349
15557
|
var open = $2;
|
|
15350
15558
|
var parameter = $5;
|
|
15351
15559
|
var close = $7;
|
|
15352
|
-
if (!parameter)
|
|
15353
|
-
return $skip;
|
|
15560
|
+
if (!parameter) return $skip;
|
|
15354
15561
|
return {
|
|
15355
15562
|
type: "CatchBinding",
|
|
15356
15563
|
parameter,
|
|
@@ -15437,8 +15644,7 @@ var Condition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, InsertOpe
|
|
|
15437
15644
|
var open = $2;
|
|
15438
15645
|
var expression = $3;
|
|
15439
15646
|
var close = $4;
|
|
15440
|
-
if (!expression)
|
|
15441
|
-
return $skip;
|
|
15647
|
+
if (!expression) return $skip;
|
|
15442
15648
|
return {
|
|
15443
15649
|
type: "ParenthesizedExpression",
|
|
15444
15650
|
children: [open, expression, close],
|
|
@@ -15449,8 +15655,7 @@ var Condition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenParen, Expr
|
|
|
15449
15655
|
var open = $1;
|
|
15450
15656
|
var expression = $2;
|
|
15451
15657
|
var close = $3;
|
|
15452
|
-
if (expression.type === "ParenthesizedExpression")
|
|
15453
|
-
return expression;
|
|
15658
|
+
if (expression.type === "ParenthesizedExpression") return expression;
|
|
15454
15659
|
expression = trimFirstSpace(expression);
|
|
15455
15660
|
return {
|
|
15456
15661
|
type: "ParenthesizedExpression",
|
|
@@ -15466,8 +15671,7 @@ var BoundedCondition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenPare
|
|
|
15466
15671
|
var open = $1;
|
|
15467
15672
|
var expression = $2;
|
|
15468
15673
|
var close = $3;
|
|
15469
|
-
if (expression.type === "ParenthesizedExpression")
|
|
15470
|
-
return expression;
|
|
15674
|
+
if (expression.type === "ParenthesizedExpression") return expression;
|
|
15471
15675
|
expression = trimFirstSpace(expression);
|
|
15472
15676
|
return {
|
|
15473
15677
|
type: "ParenthesizedExpression",
|
|
@@ -15480,8 +15684,7 @@ function BoundedCondition(ctx, state2) {
|
|
|
15480
15684
|
}
|
|
15481
15685
|
var DeclarationCondition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(LexicalDeclaration), RestoreNewlineBinaryOp, RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
15482
15686
|
var declaration = $4;
|
|
15483
|
-
if (!declaration)
|
|
15484
|
-
return $skip;
|
|
15687
|
+
if (!declaration) return $skip;
|
|
15485
15688
|
return {
|
|
15486
15689
|
type: "DeclarationCondition",
|
|
15487
15690
|
declaration,
|
|
@@ -15493,8 +15696,7 @@ function DeclarationCondition(ctx, state2) {
|
|
|
15493
15696
|
}
|
|
15494
15697
|
var ExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(Expression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15495
15698
|
var exp = $3;
|
|
15496
|
-
if (exp)
|
|
15497
|
-
return exp;
|
|
15699
|
+
if (exp) return exp;
|
|
15498
15700
|
return $skip;
|
|
15499
15701
|
});
|
|
15500
15702
|
function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -15502,8 +15704,7 @@ function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
|
15502
15704
|
}
|
|
15503
15705
|
var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(SingleLineAssignmentExpression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15504
15706
|
var exp = $3;
|
|
15505
|
-
if (exp)
|
|
15506
|
-
return exp;
|
|
15707
|
+
if (exp) return exp;
|
|
15507
15708
|
return $skip;
|
|
15508
15709
|
});
|
|
15509
15710
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -15511,8 +15712,7 @@ function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
|
15511
15712
|
}
|
|
15512
15713
|
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib2.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15513
15714
|
var exp = $3;
|
|
15514
|
-
if (exp)
|
|
15515
|
-
return exp;
|
|
15715
|
+
if (exp) return exp;
|
|
15516
15716
|
return $skip;
|
|
15517
15717
|
});
|
|
15518
15718
|
function ExpressionWithObjectApplicationForbidden(ctx, state2) {
|
|
@@ -15520,8 +15720,7 @@ function ExpressionWithObjectApplicationForbidden(ctx, state2) {
|
|
|
15520
15720
|
}
|
|
15521
15721
|
var LeftHandSideExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(LeftHandSideExpression), RestoreNewlineBinaryOp, RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
15522
15722
|
var exp = $4;
|
|
15523
|
-
if (exp)
|
|
15524
|
-
return exp;
|
|
15723
|
+
if (exp) return exp;
|
|
15525
15724
|
return $skip;
|
|
15526
15725
|
});
|
|
15527
15726
|
function LeftHandSideExpressionWithObjectApplicationForbidden(ctx, state2) {
|
|
@@ -15546,8 +15745,7 @@ function RestoreClassImplicitCall(ctx, state2) {
|
|
|
15546
15745
|
return (0, import_lib2.$EVENT)(ctx, state2, "RestoreClassImplicitCall", RestoreClassImplicitCall$0);
|
|
15547
15746
|
}
|
|
15548
15747
|
var ClassImplicitCallForbidden$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
|
|
15549
|
-
if (!state.classImplicitCallForbidden)
|
|
15550
|
-
return $skip;
|
|
15748
|
+
if (!state.classImplicitCallForbidden) return $skip;
|
|
15551
15749
|
return;
|
|
15552
15750
|
});
|
|
15553
15751
|
function ClassImplicitCallForbidden(ctx, state2) {
|
|
@@ -15575,8 +15773,7 @@ var BracedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($
|
|
|
15575
15773
|
if (config.verbose) {
|
|
15576
15774
|
console.log("forbidBracedApplication:", state.forbidBracedApplication);
|
|
15577
15775
|
}
|
|
15578
|
-
if (state.bracedApplicationForbidden)
|
|
15579
|
-
return $skip;
|
|
15776
|
+
if (state.bracedApplicationForbidden) return $skip;
|
|
15580
15777
|
return;
|
|
15581
15778
|
});
|
|
15582
15779
|
function BracedApplicationAllowed(ctx, state2) {
|
|
@@ -15604,8 +15801,7 @@ var IndentedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)
|
|
|
15604
15801
|
if (config.verbose) {
|
|
15605
15802
|
console.log("forbidIndentedApplication:", state.forbidIndentedApplication);
|
|
15606
15803
|
}
|
|
15607
|
-
if (state.indentedApplicationForbidden)
|
|
15608
|
-
return $skip;
|
|
15804
|
+
if (state.indentedApplicationForbidden) return $skip;
|
|
15609
15805
|
return;
|
|
15610
15806
|
});
|
|
15611
15807
|
function IndentedApplicationAllowed(ctx, state2) {
|
|
@@ -15633,8 +15829,7 @@ var TrailingMemberPropertyAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPE
|
|
|
15633
15829
|
if (config.verbose) {
|
|
15634
15830
|
console.log("forbidTrailingMemberProperty:", state.forbidTrailingMemberProperty);
|
|
15635
15831
|
}
|
|
15636
|
-
if (state.trailingMemberPropertyForbidden)
|
|
15637
|
-
return $skip;
|
|
15832
|
+
if (state.trailingMemberPropertyForbidden) return $skip;
|
|
15638
15833
|
});
|
|
15639
15834
|
function TrailingMemberPropertyAllowed(ctx, state2) {
|
|
15640
15835
|
return (0, import_lib2.$EVENT)(ctx, state2, "TrailingMemberPropertyAllowed", TrailingMemberPropertyAllowed$0);
|
|
@@ -15661,8 +15856,7 @@ var NestedBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0,
|
|
|
15661
15856
|
if (config.verbose) {
|
|
15662
15857
|
console.log("forbidNestedBinaryOp:", state.forbidNestedBinaryOp);
|
|
15663
15858
|
}
|
|
15664
|
-
if (state.nestedBinaryOpForbidden)
|
|
15665
|
-
return $skip;
|
|
15859
|
+
if (state.nestedBinaryOpForbidden) return $skip;
|
|
15666
15860
|
});
|
|
15667
15861
|
function NestedBinaryOpAllowed(ctx, state2) {
|
|
15668
15862
|
return (0, import_lib2.$EVENT)(ctx, state2, "NestedBinaryOpAllowed", NestedBinaryOpAllowed$0);
|
|
@@ -15689,8 +15883,7 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
|
|
|
15689
15883
|
if (config.verbose) {
|
|
15690
15884
|
console.log("forbidNewlineBinaryOp:", state.forbidNewlineBinaryOp);
|
|
15691
15885
|
}
|
|
15692
|
-
if (state.newlineBinaryOpForbidden)
|
|
15693
|
-
return $skip;
|
|
15886
|
+
if (state.newlineBinaryOpForbidden) return $skip;
|
|
15694
15887
|
});
|
|
15695
15888
|
function NewlineBinaryOpAllowed(ctx, state2) {
|
|
15696
15889
|
return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
|
|
@@ -15717,8 +15910,7 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
|
|
|
15717
15910
|
if (config.verbose) {
|
|
15718
15911
|
console.log("forbidPipeline:", state.forbidPipeline);
|
|
15719
15912
|
}
|
|
15720
|
-
if (state.pipelineForbidden)
|
|
15721
|
-
return $skip;
|
|
15913
|
+
if (state.pipelineForbidden) return $skip;
|
|
15722
15914
|
});
|
|
15723
15915
|
function PipelineAllowed(ctx, state2) {
|
|
15724
15916
|
return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
|
|
@@ -15747,14 +15939,12 @@ function ExpressionStatement(ctx, state2) {
|
|
|
15747
15939
|
}
|
|
15748
15940
|
var KeywordStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Break, (0, import_lib2.$E)((0, import_lib2.$S)(_, LabelIdentifier)), (0, import_lib2.$E)((0, import_lib2.$S)(_, With, MaybeNestedExpression))), function($skip, $loc, $0, $1, $2, $3) {
|
|
15749
15941
|
const children = [$1];
|
|
15750
|
-
if ($2)
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
message: "'break with' outside of loop that returns a value"
|
|
15757
|
-
});
|
|
15942
|
+
if ($2) children.push($2);
|
|
15943
|
+
if ($3) children.push({
|
|
15944
|
+
type: "Error",
|
|
15945
|
+
subtype: "Warning",
|
|
15946
|
+
message: "'break with' outside of loop that returns a value"
|
|
15947
|
+
});
|
|
15758
15948
|
return {
|
|
15759
15949
|
type: "BreakStatement",
|
|
15760
15950
|
label: $2?.[1],
|
|
@@ -15771,14 +15961,12 @@ var KeywordStatement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Continue, _, S
|
|
|
15771
15961
|
});
|
|
15772
15962
|
var KeywordStatement$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Continue, (0, import_lib2.$E)((0, import_lib2.$S)(_, LabelIdentifier)), (0, import_lib2.$E)((0, import_lib2.$S)(_, With, MaybeNestedExpression))), function($skip, $loc, $0, $1, $2, $3) {
|
|
15773
15963
|
const children = [$1];
|
|
15774
|
-
if ($2)
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
message: "'continue with' outside of loop that returns a value"
|
|
15781
|
-
});
|
|
15964
|
+
if ($2) children.push($2);
|
|
15965
|
+
if ($3) children.push({
|
|
15966
|
+
type: "Error",
|
|
15967
|
+
subtype: "Warning",
|
|
15968
|
+
message: "'continue with' outside of loop that returns a value"
|
|
15969
|
+
});
|
|
15782
15970
|
return {
|
|
15783
15971
|
type: "ContinueStatement",
|
|
15784
15972
|
label: $2?.[1],
|
|
@@ -15832,10 +16020,8 @@ var MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral;
|
|
|
15832
16020
|
var MaybeNestedNonPipelineExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, NonPipelineExpression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
15833
16021
|
var expression = $2;
|
|
15834
16022
|
var trailing = $4;
|
|
15835
|
-
if (!expression)
|
|
15836
|
-
|
|
15837
|
-
if (!trailing)
|
|
15838
|
-
return expression;
|
|
16023
|
+
if (!expression) return $skip;
|
|
16024
|
+
if (!trailing) return expression;
|
|
15839
16025
|
return [expression, trailing];
|
|
15840
16026
|
});
|
|
15841
16027
|
var MaybeNestedNonPipelineExpression$3 = NonPipelineExpression;
|
|
@@ -15848,10 +16034,8 @@ var MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral;
|
|
|
15848
16034
|
var MaybeNestedPostfixedExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, PostfixedExpression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
15849
16035
|
var expression = $2;
|
|
15850
16036
|
var trailing = $4;
|
|
15851
|
-
if (!expression)
|
|
15852
|
-
|
|
15853
|
-
if (!trailing)
|
|
15854
|
-
return expression;
|
|
16037
|
+
if (!expression) return $skip;
|
|
16038
|
+
if (!trailing) return expression;
|
|
15855
16039
|
return [expression, trailing];
|
|
15856
16040
|
});
|
|
15857
16041
|
var MaybeNestedPostfixedExpression$3 = PostfixedExpression;
|
|
@@ -15863,8 +16047,7 @@ var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
|
|
|
15863
16047
|
var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
|
|
15864
16048
|
var NestedPostfixedExpressionNoTrailing$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, PostfixedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
15865
16049
|
var expression = $2;
|
|
15866
|
-
if (!expression)
|
|
15867
|
-
return $skip;
|
|
16050
|
+
if (!expression) return $skip;
|
|
15868
16051
|
return expression;
|
|
15869
16052
|
});
|
|
15870
16053
|
var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing$0, NestedPostfixedExpressionNoTrailing$1, NestedPostfixedExpressionNoTrailing$2];
|
|
@@ -15876,10 +16059,8 @@ var MaybeNestedExpression$1 = NestedImplicitObjectLiteral;
|
|
|
15876
16059
|
var MaybeNestedExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Expression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
15877
16060
|
var expression = $2;
|
|
15878
16061
|
var trailing = $4;
|
|
15879
|
-
if (!expression)
|
|
15880
|
-
|
|
15881
|
-
if (!trailing)
|
|
15882
|
-
return expression;
|
|
16062
|
+
if (!expression) return $skip;
|
|
16063
|
+
if (!trailing) return expression;
|
|
15883
16064
|
return [expression, trailing];
|
|
15884
16065
|
});
|
|
15885
16066
|
var MaybeNestedExpression$3 = Expression;
|
|
@@ -15898,8 +16079,7 @@ var MaybeParenNestedExpression$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, i
|
|
|
15898
16079
|
});
|
|
15899
16080
|
var MaybeParenNestedExpression$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), InsertSpace, InsertOpenParen, PushIndent, (0, import_lib2.$S)(Nested, Expression), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions), InsertNewline, InsertIndent, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10) {
|
|
15900
16081
|
var exp = $5;
|
|
15901
|
-
if (!exp)
|
|
15902
|
-
return $skip;
|
|
16082
|
+
if (!exp) return $skip;
|
|
15903
16083
|
return $0.slice(1);
|
|
15904
16084
|
});
|
|
15905
16085
|
var MaybeParenNestedExpression$$ = [MaybeParenNestedExpression$0, MaybeParenNestedExpression$1, MaybeParenNestedExpression$2, MaybeParenNestedExpression$3];
|
|
@@ -16074,8 +16254,7 @@ function OperatorNamedImports(ctx, state2) {
|
|
|
16074
16254
|
}
|
|
16075
16255
|
var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
16076
16256
|
var module = $3;
|
|
16077
|
-
if (!Array.isArray(module))
|
|
16078
|
-
return $0;
|
|
16257
|
+
if (!Array.isArray(module)) return $0;
|
|
16079
16258
|
return [$1, $2, ...module];
|
|
16080
16259
|
});
|
|
16081
16260
|
function FromClause(ctx, state2) {
|
|
@@ -16083,8 +16262,7 @@ function FromClause(ctx, state2) {
|
|
|
16083
16262
|
}
|
|
16084
16263
|
var ImpliedFromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(From, __), ImpliedFrom), ModuleSpecifier), function($skip, $loc, $0, $1, $2) {
|
|
16085
16264
|
var module = $2;
|
|
16086
|
-
if (!Array.isArray(module))
|
|
16087
|
-
return $0;
|
|
16265
|
+
if (!Array.isArray(module)) return $0;
|
|
16088
16266
|
return [$1, ...module];
|
|
16089
16267
|
});
|
|
16090
16268
|
function ImpliedFromClause(ctx, state2) {
|
|
@@ -16110,8 +16288,7 @@ function ImportAssertion(ctx, state2) {
|
|
|
16110
16288
|
return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
|
|
16111
16289
|
}
|
|
16112
16290
|
var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(__, TypeKeyword)), ImportSpecifier), function($skip, $loc, $0, $1, $2) {
|
|
16113
|
-
if (!$1)
|
|
16114
|
-
return $2;
|
|
16291
|
+
if (!$1) return $2;
|
|
16115
16292
|
return { ts: true, children: $0, binding: $2.binding };
|
|
16116
16293
|
});
|
|
16117
16294
|
var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -16327,8 +16504,7 @@ function ExportFromClause(ctx, state2) {
|
|
|
16327
16504
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ExportFromClause", ExportFromClause$$);
|
|
16328
16505
|
}
|
|
16329
16506
|
var TypeAndNamedExports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(TypeKeyword, __)), NamedExports), function($skip, $loc, $0, $1, $2) {
|
|
16330
|
-
if (!$1)
|
|
16331
|
-
return $2;
|
|
16507
|
+
if (!$1) return $2;
|
|
16332
16508
|
return { ts: true, children: $0 };
|
|
16333
16509
|
});
|
|
16334
16510
|
function TypeAndNamedExports(ctx, state2) {
|
|
@@ -16347,8 +16523,7 @@ function NamedExports(ctx, state2) {
|
|
|
16347
16523
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedExports", NamedExports$$);
|
|
16348
16524
|
}
|
|
16349
16525
|
var ExportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, (0, import_lib2.$E)((0, import_lib2.$S)(TypeKeyword, __)), ModuleExportName, (0, import_lib2.$E)((0, import_lib2.$S)(__, As, __, ModuleExportName)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
16350
|
-
if (!$2)
|
|
16351
|
-
return $0;
|
|
16526
|
+
if (!$2) return $0;
|
|
16352
16527
|
return { ts: true, children: $0 };
|
|
16353
16528
|
});
|
|
16354
16529
|
function ExportSpecifier(ctx, state2) {
|
|
@@ -16360,11 +16535,9 @@ function ImplicitExportSpecifier(ctx, state2) {
|
|
|
16360
16535
|
}
|
|
16361
16536
|
var Declaration$0 = (0, import_lib2.$TV)(ImportDeclaration, function($skip, $loc, $0, $1) {
|
|
16362
16537
|
var decl = $0;
|
|
16363
|
-
if (decl.ts || decl.module || !decl.imports || !decl.from)
|
|
16364
|
-
return $skip;
|
|
16538
|
+
if (decl.ts || decl.module || !decl.imports || !decl.from) return $skip;
|
|
16365
16539
|
const { imports } = decl;
|
|
16366
|
-
if (!imports.binding && !imports.specifiers)
|
|
16367
|
-
return $skip;
|
|
16540
|
+
if (!imports.binding && !imports.specifiers) return $skip;
|
|
16368
16541
|
return dynamizeImportDeclaration(decl);
|
|
16369
16542
|
});
|
|
16370
16543
|
var Declaration$1 = HoistableDeclaration;
|
|
@@ -16634,8 +16807,7 @@ function TripleSingleStringCharacters(ctx, state2) {
|
|
|
16634
16807
|
return (0, import_lib2.$EVENT)(ctx, state2, "TripleSingleStringCharacters", TripleSingleStringCharacters$0);
|
|
16635
16808
|
}
|
|
16636
16809
|
var CoffeeStringSubstitution$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeSubstitutionStart, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedExpression, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
16637
|
-
if (!$3)
|
|
16638
|
-
return $skip;
|
|
16810
|
+
if (!$3) return $skip;
|
|
16639
16811
|
return [$1, ...$3];
|
|
16640
16812
|
});
|
|
16641
16813
|
function CoffeeStringSubstitution(ctx, state2) {
|
|
@@ -16658,7 +16830,12 @@ function CoffeeDoubleQuotedStringCharacters(ctx, state2) {
|
|
|
16658
16830
|
}
|
|
16659
16831
|
var RegularExpressionLiteral$0 = HeregexLiteral;
|
|
16660
16832
|
var RegularExpressionLiteral$1 = (0, import_lib2.$TV)((0, import_lib2.$TEXT)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L77, 'RegularExpressionLiteral "/"'), RegularExpressionBody, (0, import_lib2.$EXPECT)($L77, 'RegularExpressionLiteral "/"'), RegularExpressionFlags)), function($skip, $loc, $0, $1) {
|
|
16661
|
-
|
|
16833
|
+
var raw = $0;
|
|
16834
|
+
return {
|
|
16835
|
+
type: "RegularExpressionLiteral",
|
|
16836
|
+
raw,
|
|
16837
|
+
children: [{ $loc, token: raw }]
|
|
16838
|
+
};
|
|
16662
16839
|
});
|
|
16663
16840
|
var RegularExpressionLiteral$$ = [RegularExpressionLiteral$0, RegularExpressionLiteral$1];
|
|
16664
16841
|
function RegularExpressionLiteral(ctx, state2) {
|
|
@@ -16817,8 +16994,7 @@ function _TemplateLiteral(ctx, state2) {
|
|
|
16817
16994
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "_TemplateLiteral", _TemplateLiteral$$);
|
|
16818
16995
|
}
|
|
16819
16996
|
var TemplateSubstitution$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(SubstitutionStart, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedExpression, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
16820
|
-
if (!$3)
|
|
16821
|
-
return $skip;
|
|
16997
|
+
if (!$3) return $skip;
|
|
16822
16998
|
return [$1, ...$3];
|
|
16823
16999
|
});
|
|
16824
17000
|
function TemplateSubstitution(ctx, state2) {
|
|
@@ -17663,8 +17839,7 @@ var JSXElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(
|
|
|
17663
17839
|
var open = $2;
|
|
17664
17840
|
var children = $3;
|
|
17665
17841
|
var close = $4;
|
|
17666
|
-
if (!children)
|
|
17667
|
-
return $skip;
|
|
17842
|
+
if (!children) return $skip;
|
|
17668
17843
|
let parts;
|
|
17669
17844
|
$0 = $0.slice(1);
|
|
17670
17845
|
if (close) {
|
|
@@ -17687,8 +17862,7 @@ var JSXElement$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeJSXEnabled, JS
|
|
|
17687
17862
|
var open = $2;
|
|
17688
17863
|
var close = $5;
|
|
17689
17864
|
$0 = $0.slice(1);
|
|
17690
|
-
if (open[1] !== close[2])
|
|
17691
|
-
return $skip;
|
|
17865
|
+
if (open[1] !== close[2]) return $skip;
|
|
17692
17866
|
return { type: "JSXElement", children: $0, tag: open[1] };
|
|
17693
17867
|
});
|
|
17694
17868
|
var JSXElement$$ = [JSXElement$0, JSXElement$1, JSXElement$2];
|
|
@@ -17720,8 +17894,7 @@ function JSXOpeningElement(ctx, state2) {
|
|
|
17720
17894
|
}
|
|
17721
17895
|
var JSXOptionalClosingElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingElement), function($skip, $loc, $0, $1, $2) {
|
|
17722
17896
|
var close = $2;
|
|
17723
|
-
if (state.currentJSXTag !== close[2])
|
|
17724
|
-
return $skip;
|
|
17897
|
+
if (state.currentJSXTag !== close[2]) return $skip;
|
|
17725
17898
|
return $0;
|
|
17726
17899
|
});
|
|
17727
17900
|
var JSXOptionalClosingElement$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingElement ""');
|
|
@@ -17737,8 +17910,7 @@ var JSXFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)
|
|
|
17737
17910
|
var open = $2;
|
|
17738
17911
|
var children = $3;
|
|
17739
17912
|
var close = $4;
|
|
17740
|
-
if (!children)
|
|
17741
|
-
return $skip;
|
|
17913
|
+
if (!children) return $skip;
|
|
17742
17914
|
$0 = $0.slice(1);
|
|
17743
17915
|
const parts = close ? $0 : [
|
|
17744
17916
|
...$0,
|
|
@@ -17771,8 +17943,7 @@ function PushJSXOpeningFragment(ctx, state2) {
|
|
|
17771
17943
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushJSXOpeningFragment", PushJSXOpeningFragment$0);
|
|
17772
17944
|
}
|
|
17773
17945
|
var JSXOptionalClosingFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2) {
|
|
17774
|
-
if (state.currentJSXTag !== "")
|
|
17775
|
-
return $skip;
|
|
17946
|
+
if (state.currentJSXTag !== "") return $skip;
|
|
17776
17947
|
return $0;
|
|
17777
17948
|
});
|
|
17778
17949
|
var JSXOptionalClosingFragment$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingFragment ""');
|
|
@@ -17850,10 +18021,8 @@ var JSXAttributes$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$
|
|
|
17850
18021
|
while (root.length && isWhitespaceOrEmpty(root[root.length - 1])) {
|
|
17851
18022
|
root = root.slice(0, -1);
|
|
17852
18023
|
}
|
|
17853
|
-
while (root?.length === 1)
|
|
17854
|
-
|
|
17855
|
-
if (root?.children)
|
|
17856
|
-
root = root.children;
|
|
18024
|
+
while (root?.length === 1) root = root[0];
|
|
18025
|
+
if (root?.children) root = root.children;
|
|
17857
18026
|
if (root?.[0]?.token === "`") {
|
|
17858
18027
|
classValue = ["{", ...exprs, "}"];
|
|
17859
18028
|
} else {
|
|
@@ -17922,8 +18091,7 @@ var JSXAttribute$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(AtThis, (0, import
|
|
|
17922
18091
|
children
|
|
17923
18092
|
});
|
|
17924
18093
|
const last = lastAccessInCallExpression(expr);
|
|
17925
|
-
if (!last)
|
|
17926
|
-
return $skip;
|
|
18094
|
+
if (!last) return $skip;
|
|
17927
18095
|
let name;
|
|
17928
18096
|
if (last.type === "Index") {
|
|
17929
18097
|
return [
|
|
@@ -17949,8 +18117,7 @@ var JSXAttribute$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(Identifier, (0, im
|
|
|
17949
18117
|
return convertObjectToJSXAttributes(expr);
|
|
17950
18118
|
}
|
|
17951
18119
|
const last = lastAccessInCallExpression(expr);
|
|
17952
|
-
if (!last)
|
|
17953
|
-
return $skip;
|
|
18120
|
+
if (!last) return $skip;
|
|
17954
18121
|
let name;
|
|
17955
18122
|
if (last.type === "Index") {
|
|
17956
18123
|
return [
|
|
@@ -18037,8 +18204,7 @@ function JSXAttributeValue(ctx, state2) {
|
|
|
18037
18204
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXAttributeValue", JSXAttributeValue$$);
|
|
18038
18205
|
}
|
|
18039
18206
|
var InlineJSXAttributeValue$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXUnaryExpression, (0, import_lib2.$Q)(InlineJSXBinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
|
|
18040
|
-
if ($2.length)
|
|
18041
|
-
return processBinaryOpExpression($0);
|
|
18207
|
+
if ($2.length) return processBinaryOpExpression($0);
|
|
18042
18208
|
return $1;
|
|
18043
18209
|
});
|
|
18044
18210
|
function InlineJSXAttributeValue(ctx, state2) {
|
|
@@ -18073,8 +18239,7 @@ function InlineJSXUnaryPostfix(ctx, state2) {
|
|
|
18073
18239
|
}
|
|
18074
18240
|
var InlineJSXUpdateExpression$0 = (0, import_lib2.$S)(UpdateExpressionSymbol, UnaryExpression);
|
|
18075
18241
|
var InlineJSXUpdateExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXCallExpression, (0, import_lib2.$E)(UpdateExpressionSymbol)), function($skip, $loc, $0, $1, $2) {
|
|
18076
|
-
if ($2)
|
|
18077
|
-
return $0;
|
|
18242
|
+
if ($2) return $0;
|
|
18078
18243
|
return $1;
|
|
18079
18244
|
});
|
|
18080
18245
|
var InlineJSXUpdateExpression$$ = [InlineJSXUpdateExpression$0, InlineJSXUpdateExpression$1];
|
|
@@ -18130,8 +18295,7 @@ var InlineJSXCallExpressionRest$1 = (0, import_lib2.$TV)((0, import_lib2.$C)(Tem
|
|
|
18130
18295
|
});
|
|
18131
18296
|
var InlineJSXCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
|
|
18132
18297
|
var args = $2;
|
|
18133
|
-
if (!$1)
|
|
18134
|
-
return args;
|
|
18298
|
+
if (!$1) return args;
|
|
18135
18299
|
return [$1, args];
|
|
18136
18300
|
});
|
|
18137
18301
|
var InlineJSXCallExpressionRest$$ = [InlineJSXCallExpressionRest$0, InlineJSXCallExpressionRest$1, InlineJSXCallExpressionRest$2];
|
|
@@ -18155,8 +18319,7 @@ var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
|
|
|
18155
18319
|
var dot = $1;
|
|
18156
18320
|
var comments = $2;
|
|
18157
18321
|
var content = $3;
|
|
18158
|
-
if (!dot && !comments.length)
|
|
18159
|
-
return content;
|
|
18322
|
+
if (!dot && !comments.length) return content;
|
|
18160
18323
|
if (dot) {
|
|
18161
18324
|
if (dot.type === "Optional" && content.type === "SliceExpression") {
|
|
18162
18325
|
return [...dot.children.slice(0, -1), ...comments, content];
|
|
@@ -18244,8 +18407,7 @@ var JSXNested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXEOS, Indent), func
|
|
|
18244
18407
|
var indent = $2;
|
|
18245
18408
|
const { level } = indent;
|
|
18246
18409
|
const currentIndent = state.currentIndent;
|
|
18247
|
-
if (level !== currentIndent.level)
|
|
18248
|
-
return $skip;
|
|
18410
|
+
if (level !== currentIndent.level) return $skip;
|
|
18249
18411
|
return $0;
|
|
18250
18412
|
});
|
|
18251
18413
|
function JSXNested(ctx, state2) {
|
|
@@ -18366,8 +18528,7 @@ function JSXChildExpression(ctx, state2) {
|
|
|
18366
18528
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXChildExpression", JSXChildExpression$$);
|
|
18367
18529
|
}
|
|
18368
18530
|
var IndentedJSXChildExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)(NestedJSXChildExpression), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18369
|
-
if (!$2)
|
|
18370
|
-
return $skip;
|
|
18531
|
+
if (!$2) return $skip;
|
|
18371
18532
|
return $2;
|
|
18372
18533
|
});
|
|
18373
18534
|
function IndentedJSXChildExpression(ctx, state2) {
|
|
@@ -18387,8 +18548,7 @@ var JSXCodeChild$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertInlineOpenBr
|
|
|
18387
18548
|
var open = $1;
|
|
18388
18549
|
var expression = $2;
|
|
18389
18550
|
var close = $3;
|
|
18390
|
-
if (!expression)
|
|
18391
|
-
return $skip;
|
|
18551
|
+
if (!expression) return $skip;
|
|
18392
18552
|
return [open, expression, close];
|
|
18393
18553
|
});
|
|
18394
18554
|
function JSXCodeChild(ctx, state2) {
|
|
@@ -18396,14 +18556,12 @@ function JSXCodeChild(ctx, state2) {
|
|
|
18396
18556
|
}
|
|
18397
18557
|
var JSXCodeChildExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib2.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
18398
18558
|
var expression = $3;
|
|
18399
|
-
if (!expression)
|
|
18400
|
-
return $skip;
|
|
18559
|
+
if (!expression) return $skip;
|
|
18401
18560
|
return expression;
|
|
18402
18561
|
});
|
|
18403
18562
|
var JSXCodeChildExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
|
|
18404
18563
|
var block = $2;
|
|
18405
|
-
if (!block)
|
|
18406
|
-
return $skip;
|
|
18564
|
+
if (!block) return $skip;
|
|
18407
18565
|
const statement = {
|
|
18408
18566
|
type: "DoStatement",
|
|
18409
18567
|
children: [block],
|
|
@@ -18649,8 +18807,7 @@ function NestedInterfaceBlock(ctx, state2) {
|
|
|
18649
18807
|
}
|
|
18650
18808
|
var NestedInterfaceProperties$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedInterfaceProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18651
18809
|
var props = $2;
|
|
18652
|
-
if (props.length)
|
|
18653
|
-
return props;
|
|
18810
|
+
if (props.length) return props;
|
|
18654
18811
|
return $skip;
|
|
18655
18812
|
});
|
|
18656
18813
|
function NestedInterfaceProperties(ctx, state2) {
|
|
@@ -18687,8 +18844,7 @@ function ModuleOrEmptyBlock(ctx, state2) {
|
|
|
18687
18844
|
}
|
|
18688
18845
|
var NestedModuleItems$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedModuleItem), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18689
18846
|
var items = $2;
|
|
18690
|
-
if (items.length)
|
|
18691
|
-
return items;
|
|
18847
|
+
if (items.length) return items;
|
|
18692
18848
|
return $skip;
|
|
18693
18849
|
});
|
|
18694
18850
|
function NestedModuleItems(ctx, state2) {
|
|
@@ -18707,8 +18863,7 @@ function DeclareBlock(ctx, state2) {
|
|
|
18707
18863
|
}
|
|
18708
18864
|
var NestedDeclareElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedDeclareElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18709
18865
|
var decs = $2;
|
|
18710
|
-
if (decs.length)
|
|
18711
|
-
return decs;
|
|
18866
|
+
if (decs.length) return decs;
|
|
18712
18867
|
return $skip;
|
|
18713
18868
|
});
|
|
18714
18869
|
function NestedDeclareElements(ctx, state2) {
|
|
@@ -18816,8 +18971,7 @@ function EnumBlock(ctx, state2) {
|
|
|
18816
18971
|
}
|
|
18817
18972
|
var NestedEnumProperties$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedEnumPropertyLine), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18818
18973
|
var props = $2;
|
|
18819
|
-
if (!props.length)
|
|
18820
|
-
return $skip;
|
|
18974
|
+
if (!props.length) return $skip;
|
|
18821
18975
|
return {
|
|
18822
18976
|
properties: props.flat().map((p) => p.property),
|
|
18823
18977
|
children: $0
|
|
@@ -18864,12 +19018,13 @@ function TypeIndex(ctx, state2) {
|
|
|
18864
19018
|
}
|
|
18865
19019
|
var TypeSuffix$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$E)(QuestionMark), (0, import_lib2.$E)(_), Colon, MaybeNestedType), function(value) {
|
|
18866
19020
|
var optional = value[1];
|
|
19021
|
+
var colon = value[3];
|
|
18867
19022
|
var t = value[4];
|
|
18868
|
-
return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "children": value };
|
|
19023
|
+
return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "colon": colon, "children": value };
|
|
18869
19024
|
});
|
|
18870
19025
|
var TypeSuffix$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$E)(_), QuestionMark, (0, import_lib2.$E)(_)), function(value) {
|
|
18871
19026
|
var optional = value[1];
|
|
18872
|
-
return { "type": "TypeSuffix", "ts": true, "optional": optional, "children": value };
|
|
19027
|
+
return { "type": "TypeSuffix", "ts": true, "optional": optional, "colon": void 0, "children": value };
|
|
18873
19028
|
});
|
|
18874
19029
|
var TypeSuffix$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NonNullAssertion, (0, import_lib2.$E)(_), (0, import_lib2.$E)((0, import_lib2.$S)(Colon, MaybeNestedType))), function($skip, $loc, $0, $1, $2, $3) {
|
|
18875
19030
|
var nonnull = $1;
|
|
@@ -18880,6 +19035,7 @@ var TypeSuffix$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NonNullAssertion, (0
|
|
|
18880
19035
|
ts: true,
|
|
18881
19036
|
nonnull,
|
|
18882
19037
|
t,
|
|
19038
|
+
colon,
|
|
18883
19039
|
children: [$1, $2, colon, t]
|
|
18884
19040
|
};
|
|
18885
19041
|
});
|
|
@@ -18891,8 +19047,7 @@ var MaybeNestedType$0 = NestedTypeBulletedTuple;
|
|
|
18891
19047
|
var MaybeNestedType$1 = NestedInterfaceBlock;
|
|
18892
19048
|
var MaybeNestedType$2 = NestedTypeBinaryChain;
|
|
18893
19049
|
var MaybeNestedType$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18894
|
-
if (!$2)
|
|
18895
|
-
return $skip;
|
|
19050
|
+
if (!$2) return $skip;
|
|
18896
19051
|
return $2;
|
|
18897
19052
|
});
|
|
18898
19053
|
var MaybeNestedType$4 = Type;
|
|
@@ -18904,8 +19059,7 @@ var MaybeNestedTypePrimary$0 = NestedTypeBulletedTuple;
|
|
|
18904
19059
|
var MaybeNestedTypePrimary$1 = NestedInterfaceBlock;
|
|
18905
19060
|
var MaybeNestedTypePrimary$2 = NestedTypeBinaryChain;
|
|
18906
19061
|
var MaybeNestedTypePrimary$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18907
|
-
if (!$2)
|
|
18908
|
-
return $skip;
|
|
19062
|
+
if (!$2) return $skip;
|
|
18909
19063
|
return $2;
|
|
18910
19064
|
});
|
|
18911
19065
|
var MaybeNestedTypePrimary$4 = TypePrimary;
|
|
@@ -18917,8 +19071,7 @@ var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
|
|
|
18917
19071
|
var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
|
|
18918
19072
|
var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
|
|
18919
19073
|
var MaybeNestedTypeUnary$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18920
|
-
if (!$2)
|
|
18921
|
-
return $skip;
|
|
19074
|
+
if (!$2) return $skip;
|
|
18922
19075
|
return $2;
|
|
18923
19076
|
});
|
|
18924
19077
|
var MaybeNestedTypeUnary$4 = (0, import_lib2.$S)(NotDedented, TypeUnary);
|
|
@@ -18941,8 +19094,7 @@ function ReturnTypeSuffix(ctx, state2) {
|
|
|
18941
19094
|
var ReturnType$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(__, (0, import_lib2.$EXPECT)($L240, 'ReturnType "asserts"'), NonIdContinue)), ForbidIndentedApplication, (0, import_lib2.$E)(TypePredicate), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
18942
19095
|
var asserts = $1;
|
|
18943
19096
|
var t = $3;
|
|
18944
|
-
if (!t)
|
|
18945
|
-
return $skip;
|
|
19097
|
+
if (!t) return $skip;
|
|
18946
19098
|
if (asserts) {
|
|
18947
19099
|
t = {
|
|
18948
19100
|
type: "TypeAsserts",
|
|
@@ -18964,8 +19116,7 @@ function ReturnType(ctx, state2) {
|
|
|
18964
19116
|
var TypePredicate$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(MaybeNestedType, (0, import_lib2.$E)((0, import_lib2.$S)(__, Is, Type))), function($skip, $loc, $0, $1, $2) {
|
|
18965
19117
|
var lhs = $1;
|
|
18966
19118
|
var rhs = $2;
|
|
18967
|
-
if (!rhs)
|
|
18968
|
-
return lhs;
|
|
19119
|
+
if (!rhs) return lhs;
|
|
18969
19120
|
return {
|
|
18970
19121
|
type: "TypePredicate",
|
|
18971
19122
|
lhs,
|
|
@@ -18984,20 +19135,16 @@ var TypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(
|
|
|
18984
19135
|
var optionalPrefix = $1;
|
|
18985
19136
|
var t = $2;
|
|
18986
19137
|
var ops = $3;
|
|
18987
|
-
if (!ops.length && !optionalPrefix)
|
|
18988
|
-
|
|
18989
|
-
if (!ops
|
|
18990
|
-
return [optionalPrefix, t];
|
|
18991
|
-
if (!optionalPrefix)
|
|
18992
|
-
return [t, ...ops];
|
|
19138
|
+
if (!ops.length && !optionalPrefix) return t;
|
|
19139
|
+
if (!ops.length) return [optionalPrefix, t];
|
|
19140
|
+
if (!optionalPrefix) return [t, ...ops];
|
|
18993
19141
|
return [optionalPrefix, t, ops];
|
|
18994
19142
|
});
|
|
18995
19143
|
function TypeBinary(ctx, state2) {
|
|
18996
19144
|
return (0, import_lib2.$EVENT)(ctx, state2, "TypeBinary", TypeBinary$0);
|
|
18997
19145
|
}
|
|
18998
19146
|
var NestedTypeBinaryChain$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedTypeBinary), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
18999
|
-
if (!$2.length)
|
|
19000
|
-
return $skip;
|
|
19147
|
+
if (!$2.length) return $skip;
|
|
19001
19148
|
return $2;
|
|
19002
19149
|
});
|
|
19003
19150
|
function NestedTypeBinaryChain(ctx, state2) {
|
|
@@ -19007,8 +19154,7 @@ var NestedTypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeBi
|
|
|
19007
19154
|
var indent = $1;
|
|
19008
19155
|
var op = $2;
|
|
19009
19156
|
var t = $4;
|
|
19010
|
-
if (!t)
|
|
19011
|
-
return $skip;
|
|
19157
|
+
if (!t) return $skip;
|
|
19012
19158
|
return [indent, op, t];
|
|
19013
19159
|
});
|
|
19014
19160
|
function NestedTypeBinary(ctx, state2) {
|
|
@@ -19018,8 +19164,7 @@ var TypeUnary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((
|
|
|
19018
19164
|
var prefix = $1;
|
|
19019
19165
|
var t = $2;
|
|
19020
19166
|
var suffix = $3;
|
|
19021
|
-
if (!prefix.length && !suffix.length)
|
|
19022
|
-
return t;
|
|
19167
|
+
if (!prefix.length && !suffix.length) return t;
|
|
19023
19168
|
return {
|
|
19024
19169
|
type: "TypeUnary",
|
|
19025
19170
|
prefix,
|
|
@@ -19078,9 +19223,11 @@ function UnknownAlias(ctx, state2) {
|
|
|
19078
19223
|
}
|
|
19079
19224
|
var TypePrimary$0 = (0, import_lib2.$S)((0, import_lib2.$E)(_), Infer, (0, import_lib2.$E)(_), IdentifierName, (0, import_lib2.$E)((0, import_lib2.$S)(NotDedented, ExtendsToken, Type)));
|
|
19080
19225
|
var TypePrimary$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), Typeof, (0, import_lib2.$E)(_), UnaryExpression), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
19226
|
+
var expression = $4;
|
|
19081
19227
|
return {
|
|
19082
|
-
type: "
|
|
19083
|
-
children: $0
|
|
19228
|
+
type: "TypeTypeof",
|
|
19229
|
+
children: $0,
|
|
19230
|
+
expression
|
|
19084
19231
|
};
|
|
19085
19232
|
});
|
|
19086
19233
|
var TypePrimary$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), TypeTuple), function($skip, $loc, $0, $1, $2) {
|
|
@@ -19123,8 +19270,7 @@ var TypePrimary$9 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)
|
|
|
19123
19270
|
};
|
|
19124
19271
|
});
|
|
19125
19272
|
var TypePrimary$10 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$C)(Type, (0, import_lib2.$S)(EOS, Type))), RestoreAll, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
19126
|
-
if (!$4)
|
|
19127
|
-
return $skip;
|
|
19273
|
+
if (!$4) return $skip;
|
|
19128
19274
|
return {
|
|
19129
19275
|
type: "TypeParenthesized",
|
|
19130
19276
|
children: [$1, $2, $4, $6, $7]
|
|
@@ -19146,8 +19292,7 @@ var TypeTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll
|
|
|
19146
19292
|
var elements = $3;
|
|
19147
19293
|
var ws = $5;
|
|
19148
19294
|
var close = $6;
|
|
19149
|
-
if (!elements)
|
|
19150
|
-
return $skip;
|
|
19295
|
+
if (!elements) return $skip;
|
|
19151
19296
|
return {
|
|
19152
19297
|
type: "TypeTuple",
|
|
19153
19298
|
elements,
|
|
@@ -19162,8 +19307,7 @@ var TypeTupleContent$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeElementLis
|
|
|
19162
19307
|
var list = $1;
|
|
19163
19308
|
var delimiter = $2;
|
|
19164
19309
|
var nested = $3;
|
|
19165
|
-
if (!nested)
|
|
19166
|
-
return list;
|
|
19310
|
+
if (!nested) return list;
|
|
19167
19311
|
return [...list, delimiter, ...nested];
|
|
19168
19312
|
});
|
|
19169
19313
|
var TypeTupleContent$2 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, TypeElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
|
|
@@ -19174,8 +19318,7 @@ function TypeTupleContent(ctx, state2) {
|
|
|
19174
19318
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeTupleContent", TypeTupleContent$$);
|
|
19175
19319
|
}
|
|
19176
19320
|
var TypeElementListWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, (0, import_lib2.$E)(TypeElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
|
|
19177
|
-
if ($2)
|
|
19178
|
-
return $2;
|
|
19321
|
+
if ($2) return $2;
|
|
19179
19322
|
return $skip;
|
|
19180
19323
|
});
|
|
19181
19324
|
function TypeElementListWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -19187,8 +19330,7 @@ var TypeElementList$0 = (0, import_lib2.$T)((0, import_lib2.$S)(TypeBulletedTupl
|
|
|
19187
19330
|
var TypeElementList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), TypeElement, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), Comma, (0, import_lib2.$N)(EOS)), TypeElement))), function($skip, $loc, $0, $1, $2, $3) {
|
|
19188
19331
|
var first = $2;
|
|
19189
19332
|
var rest = $3;
|
|
19190
|
-
if (!rest.length)
|
|
19191
|
-
return [first];
|
|
19333
|
+
if (!rest.length) return [first];
|
|
19192
19334
|
return [
|
|
19193
19335
|
append(first, rest[0][0])
|
|
19194
19336
|
].concat(
|
|
@@ -19254,13 +19396,10 @@ var NestedTypeElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeE
|
|
|
19254
19396
|
var list = $2;
|
|
19255
19397
|
var delimiter = $3;
|
|
19256
19398
|
const { length } = list;
|
|
19257
|
-
if (!length)
|
|
19258
|
-
return $skip;
|
|
19399
|
+
if (!length) return $skip;
|
|
19259
19400
|
return list.map((e, i) => {
|
|
19260
|
-
if (i === 0)
|
|
19261
|
-
|
|
19262
|
-
if (i === length - 1)
|
|
19263
|
-
e = append(e, delimiter);
|
|
19401
|
+
if (i === 0) e = prepend(indent, e);
|
|
19402
|
+
if (i === length - 1) e = append(e, delimiter);
|
|
19264
19403
|
return e;
|
|
19265
19404
|
});
|
|
19266
19405
|
});
|
|
@@ -19271,8 +19410,7 @@ var NestedTypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, imp
|
|
|
19271
19410
|
var open = $1;
|
|
19272
19411
|
var content = $3;
|
|
19273
19412
|
var close = $4;
|
|
19274
|
-
if (!content.length)
|
|
19275
|
-
return $skip;
|
|
19413
|
+
if (!content.length) return $skip;
|
|
19276
19414
|
content = content.flat();
|
|
19277
19415
|
const last = content[content.length - 1];
|
|
19278
19416
|
let children = Array.isArray(last) ? last : last?.children;
|
|
@@ -19296,8 +19434,7 @@ var TypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBra
|
|
|
19296
19434
|
var open = $1;
|
|
19297
19435
|
var content = $2;
|
|
19298
19436
|
var close = $3;
|
|
19299
|
-
if (!content)
|
|
19300
|
-
return $skip;
|
|
19437
|
+
if (!content) return $skip;
|
|
19301
19438
|
content = [
|
|
19302
19439
|
...trimFirstSpace(content[0]),
|
|
19303
19440
|
// replace first space with bracket
|
|
@@ -19332,11 +19469,9 @@ function NestedTypeBullet(ctx, state2) {
|
|
|
19332
19469
|
var TypeBullet$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BulletIndent, (0, import_lib2.$E)((0, import_lib2.$S)(TypeElementList, ArrayBulletDelimiter)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
19333
19470
|
var bullet = $1;
|
|
19334
19471
|
var content = $2;
|
|
19335
|
-
if (!content)
|
|
19336
|
-
return $skip;
|
|
19472
|
+
if (!content) return $skip;
|
|
19337
19473
|
let [list, delimiter] = content;
|
|
19338
|
-
if (!list.length)
|
|
19339
|
-
return $skip;
|
|
19474
|
+
if (!list.length) return $skip;
|
|
19340
19475
|
list = list.slice();
|
|
19341
19476
|
list[0] = prepend(bullet, list[0]);
|
|
19342
19477
|
if (delimiter) {
|
|
@@ -19351,8 +19486,7 @@ function TypeBullet(ctx, state2) {
|
|
|
19351
19486
|
var TypeWithPostfix$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeConditional, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), TypeIfClause))), function($skip, $loc, $0, $1, $2) {
|
|
19352
19487
|
var t = $1;
|
|
19353
19488
|
var postfix = $2;
|
|
19354
|
-
if (!postfix)
|
|
19355
|
-
return t;
|
|
19489
|
+
if (!postfix) return t;
|
|
19356
19490
|
return prepend(
|
|
19357
19491
|
postfix[0],
|
|
19358
19492
|
expressionizeTypeIf([...postfix[1], $1, void 0])
|
|
@@ -19365,8 +19499,7 @@ var TypeConditional$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
19365
19499
|
return prepend($1, expressionizeTypeIf($3));
|
|
19366
19500
|
});
|
|
19367
19501
|
var TypeConditional$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeCondition, NotDedented, QuestionMark, __, Type, __, Colon, __, Type), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
19368
|
-
if ($1.negated)
|
|
19369
|
-
return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
|
|
19502
|
+
if ($1.negated) return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
|
|
19370
19503
|
return $0;
|
|
19371
19504
|
});
|
|
19372
19505
|
var TypeConditional$2 = TypeBinary;
|
|
@@ -19392,14 +19525,12 @@ function TypeIfThenElse(ctx, state2) {
|
|
|
19392
19525
|
}
|
|
19393
19526
|
var TypeIfClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)(If, Unless), OpenParen, AllowAll, (0, import_lib2.$E)(TypeCondition), RestoreAll, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
19394
19527
|
var condition = $4;
|
|
19395
|
-
if (!condition)
|
|
19396
|
-
return $skip;
|
|
19528
|
+
if (!condition) return $skip;
|
|
19397
19529
|
return [$1, condition];
|
|
19398
19530
|
});
|
|
19399
19531
|
var TypeIfClause$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)(If, Unless), ForbidIndentedApplication, (0, import_lib2.$E)(TypeCondition), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
19400
19532
|
var condition = $3;
|
|
19401
|
-
if (!condition)
|
|
19402
|
-
return $skip;
|
|
19533
|
+
if (!condition) return $skip;
|
|
19403
19534
|
return [$1, condition];
|
|
19404
19535
|
});
|
|
19405
19536
|
var TypeIfClause$$ = [TypeIfClause$0, TypeIfClause$1];
|
|
@@ -19418,8 +19549,7 @@ var TypeBlock$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$N)(EO
|
|
|
19418
19549
|
});
|
|
19419
19550
|
var TypeBlock$2 = NestedInterfaceBlock;
|
|
19420
19551
|
var TypeBlock$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
19421
|
-
if (!$2)
|
|
19422
|
-
return $skip;
|
|
19552
|
+
if (!$2) return $skip;
|
|
19423
19553
|
return $2;
|
|
19424
19554
|
});
|
|
19425
19555
|
var TypeBlock$$ = [TypeBlock$0, TypeBlock$1, TypeBlock$2, TypeBlock$3];
|
|
@@ -19459,8 +19589,7 @@ var TypeLiteral$1 = Literal;
|
|
|
19459
19589
|
var TypeLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "TypeLiteral /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1, $2) {
|
|
19460
19590
|
var sign = $1;
|
|
19461
19591
|
var num = $2;
|
|
19462
|
-
if (sign[0] === "+")
|
|
19463
|
-
return num;
|
|
19592
|
+
if (sign[0] === "+") return num;
|
|
19464
19593
|
return $0;
|
|
19465
19594
|
});
|
|
19466
19595
|
var TypeLiteral$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L224, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
@@ -19576,8 +19705,7 @@ var ImplicitTypeArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeAppli
|
|
|
19576
19705
|
var args = $4;
|
|
19577
19706
|
var close = $5;
|
|
19578
19707
|
const last = args[args.length - 1];
|
|
19579
|
-
if (isComma(last))
|
|
19580
|
-
args = args.slice(0, -1);
|
|
19708
|
+
if (isComma(last)) args = args.slice(0, -1);
|
|
19581
19709
|
return {
|
|
19582
19710
|
type: "TypeArguments",
|
|
19583
19711
|
ts: true,
|
|
@@ -19631,8 +19759,7 @@ function TypeArgumentList(ctx, state2) {
|
|
|
19631
19759
|
}
|
|
19632
19760
|
var NestedTypeArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedTypeArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
19633
19761
|
var args = $2;
|
|
19634
|
-
if (!args.length)
|
|
19635
|
-
return $skip;
|
|
19762
|
+
if (!args.length) return $skip;
|
|
19636
19763
|
return args.flat();
|
|
19637
19764
|
});
|
|
19638
19765
|
function NestedTypeArgumentList(ctx, state2) {
|
|
@@ -19743,16 +19870,14 @@ function CivetPrologueContent(ctx, state2) {
|
|
|
19743
19870
|
}
|
|
19744
19871
|
var CivetOption$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R99, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
19745
19872
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
19746
|
-
if (l)
|
|
19747
|
-
return l.toUpperCase();
|
|
19873
|
+
if (l) return l.toUpperCase();
|
|
19748
19874
|
return "";
|
|
19749
19875
|
});
|
|
19750
19876
|
let value = $3 ? $4 : $1 === "-" ? false : true;
|
|
19751
19877
|
switch (optionName) {
|
|
19752
19878
|
case "tab":
|
|
19753
19879
|
value = parseFloat(value);
|
|
19754
|
-
if (isNaN(value))
|
|
19755
|
-
value = 0;
|
|
19880
|
+
if (isNaN(value)) value = 0;
|
|
19756
19881
|
break;
|
|
19757
19882
|
case "globals":
|
|
19758
19883
|
case "symbols":
|
|
@@ -19941,144 +20066,126 @@ function InsertType(ctx, state2) {
|
|
|
19941
20066
|
return (0, import_lib2.$EVENT)(ctx, state2, "InsertType", InsertType$0);
|
|
19942
20067
|
}
|
|
19943
20068
|
var CoffeeBinaryExistentialEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBinaryExistentialEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19944
|
-
if (config.coffeeBinaryExistential)
|
|
19945
|
-
return;
|
|
20069
|
+
if (config.coffeeBinaryExistential) return;
|
|
19946
20070
|
return $skip;
|
|
19947
20071
|
});
|
|
19948
20072
|
function CoffeeBinaryExistentialEnabled(ctx, state2) {
|
|
19949
20073
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBinaryExistentialEnabled", CoffeeBinaryExistentialEnabled$0);
|
|
19950
20074
|
}
|
|
19951
20075
|
var CoffeeBooleansEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBooleansEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19952
|
-
if (config.coffeeBooleans)
|
|
19953
|
-
return;
|
|
20076
|
+
if (config.coffeeBooleans) return;
|
|
19954
20077
|
return $skip;
|
|
19955
20078
|
});
|
|
19956
20079
|
function CoffeeBooleansEnabled(ctx, state2) {
|
|
19957
20080
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBooleansEnabled", CoffeeBooleansEnabled$0);
|
|
19958
20081
|
}
|
|
19959
20082
|
var CoffeeClassesEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeClassesEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19960
|
-
if (config.coffeeClasses)
|
|
19961
|
-
return;
|
|
20083
|
+
if (config.coffeeClasses) return;
|
|
19962
20084
|
return $skip;
|
|
19963
20085
|
});
|
|
19964
20086
|
function CoffeeClassesEnabled(ctx, state2) {
|
|
19965
20087
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeClassesEnabled", CoffeeClassesEnabled$0);
|
|
19966
20088
|
}
|
|
19967
20089
|
var CoffeeCommentEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeCommentEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19968
|
-
if (config.coffeeComment)
|
|
19969
|
-
return;
|
|
20090
|
+
if (config.coffeeComment) return;
|
|
19970
20091
|
return $skip;
|
|
19971
20092
|
});
|
|
19972
20093
|
function CoffeeCommentEnabled(ctx, state2) {
|
|
19973
20094
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeCommentEnabled", CoffeeCommentEnabled$0);
|
|
19974
20095
|
}
|
|
19975
20096
|
var CoffeeDivEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDivEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19976
|
-
if (config.coffeeDiv)
|
|
19977
|
-
return;
|
|
20097
|
+
if (config.coffeeDiv) return;
|
|
19978
20098
|
return $skip;
|
|
19979
20099
|
});
|
|
19980
20100
|
function CoffeeDivEnabled(ctx, state2) {
|
|
19981
20101
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDivEnabled", CoffeeDivEnabled$0);
|
|
19982
20102
|
}
|
|
19983
20103
|
var CoffeeDoEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDoEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19984
|
-
if (config.coffeeDo)
|
|
19985
|
-
return;
|
|
20104
|
+
if (config.coffeeDo) return;
|
|
19986
20105
|
return $skip;
|
|
19987
20106
|
});
|
|
19988
20107
|
function CoffeeDoEnabled(ctx, state2) {
|
|
19989
20108
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDoEnabled", CoffeeDoEnabled$0);
|
|
19990
20109
|
}
|
|
19991
20110
|
var CoffeeForLoopsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeForLoopsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19992
|
-
if (config.coffeeForLoops)
|
|
19993
|
-
return;
|
|
20111
|
+
if (config.coffeeForLoops) return;
|
|
19994
20112
|
return $skip;
|
|
19995
20113
|
});
|
|
19996
20114
|
function CoffeeForLoopsEnabled(ctx, state2) {
|
|
19997
20115
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeForLoopsEnabled", CoffeeForLoopsEnabled$0);
|
|
19998
20116
|
}
|
|
19999
20117
|
var CoffeeInterpolationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeInterpolationEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20000
|
-
if (config.coffeeInterpolation)
|
|
20001
|
-
return;
|
|
20118
|
+
if (config.coffeeInterpolation) return;
|
|
20002
20119
|
return $skip;
|
|
20003
20120
|
});
|
|
20004
20121
|
function CoffeeInterpolationEnabled(ctx, state2) {
|
|
20005
20122
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeInterpolationEnabled", CoffeeInterpolationEnabled$0);
|
|
20006
20123
|
}
|
|
20007
20124
|
var CoffeeIsntEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeIsntEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20008
|
-
if (config.coffeeIsnt)
|
|
20009
|
-
return;
|
|
20125
|
+
if (config.coffeeIsnt) return;
|
|
20010
20126
|
return $skip;
|
|
20011
20127
|
});
|
|
20012
20128
|
function CoffeeIsntEnabled(ctx, state2) {
|
|
20013
20129
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeIsntEnabled", CoffeeIsntEnabled$0);
|
|
20014
20130
|
}
|
|
20015
20131
|
var CoffeeJSXEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeJSXEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20016
|
-
if (config.coffeeJSX)
|
|
20017
|
-
return;
|
|
20132
|
+
if (config.coffeeJSX) return;
|
|
20018
20133
|
return $skip;
|
|
20019
20134
|
});
|
|
20020
20135
|
function CoffeeJSXEnabled(ctx, state2) {
|
|
20021
20136
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeJSXEnabled", CoffeeJSXEnabled$0);
|
|
20022
20137
|
}
|
|
20023
20138
|
var CoffeeLineContinuationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeLineContinuationEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20024
|
-
if (config.coffeeLineContinuation)
|
|
20025
|
-
return;
|
|
20139
|
+
if (config.coffeeLineContinuation) return;
|
|
20026
20140
|
return $skip;
|
|
20027
20141
|
});
|
|
20028
20142
|
function CoffeeLineContinuationEnabled(ctx, state2) {
|
|
20029
20143
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeLineContinuationEnabled", CoffeeLineContinuationEnabled$0);
|
|
20030
20144
|
}
|
|
20031
20145
|
var CoffeeNotEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeNotEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20032
|
-
if (config.coffeeNot)
|
|
20033
|
-
return;
|
|
20146
|
+
if (config.coffeeNot) return;
|
|
20034
20147
|
return $skip;
|
|
20035
20148
|
});
|
|
20036
20149
|
function CoffeeNotEnabled(ctx, state2) {
|
|
20037
20150
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeNotEnabled", CoffeeNotEnabled$0);
|
|
20038
20151
|
}
|
|
20039
20152
|
var CoffeeOfEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeOfEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20040
|
-
if (config.coffeeOf)
|
|
20041
|
-
return;
|
|
20153
|
+
if (config.coffeeOf) return;
|
|
20042
20154
|
return $skip;
|
|
20043
20155
|
});
|
|
20044
20156
|
function CoffeeOfEnabled(ctx, state2) {
|
|
20045
20157
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeOfEnabled", CoffeeOfEnabled$0);
|
|
20046
20158
|
}
|
|
20047
20159
|
var CoffeePrototypeEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeePrototypeEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20048
|
-
if (config.coffeePrototype)
|
|
20049
|
-
return;
|
|
20160
|
+
if (config.coffeePrototype) return;
|
|
20050
20161
|
return $skip;
|
|
20051
20162
|
});
|
|
20052
20163
|
function CoffeePrototypeEnabled(ctx, state2) {
|
|
20053
20164
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
|
|
20054
20165
|
}
|
|
20055
20166
|
var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20056
|
-
if (config.jsxCodeNested)
|
|
20057
|
-
return;
|
|
20167
|
+
if (config.jsxCodeNested) return;
|
|
20058
20168
|
return $skip;
|
|
20059
20169
|
});
|
|
20060
20170
|
function JSXCodeNestedEnabled(ctx, state2) {
|
|
20061
20171
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
|
|
20062
20172
|
}
|
|
20063
20173
|
var JSXCodeSameLineEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20064
|
-
if (config.jsxCodeSameLine)
|
|
20065
|
-
return;
|
|
20174
|
+
if (config.jsxCodeSameLine) return;
|
|
20066
20175
|
return $skip;
|
|
20067
20176
|
});
|
|
20068
20177
|
function JSXCodeSameLineEnabled(ctx, state2) {
|
|
20069
20178
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
|
|
20070
20179
|
}
|
|
20071
20180
|
var ObjectIsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20072
|
-
if (config.objectIs)
|
|
20073
|
-
return;
|
|
20181
|
+
if (config.objectIs) return;
|
|
20074
20182
|
return $skip;
|
|
20075
20183
|
});
|
|
20076
20184
|
function ObjectIsEnabled(ctx, state2) {
|
|
20077
20185
|
return (0, import_lib2.$EVENT)(ctx, state2, "ObjectIsEnabled", ObjectIsEnabled$0);
|
|
20078
20186
|
}
|
|
20079
20187
|
var IsBare$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'IsBare ""'), function($skip, $loc, $0, $1) {
|
|
20080
|
-
if (config.iife || config.repl)
|
|
20081
|
-
return $skip;
|
|
20188
|
+
if (config.iife || config.repl) return $skip;
|
|
20082
20189
|
});
|
|
20083
20190
|
function IsBare(ctx, state2) {
|
|
20084
20191
|
return (0, import_lib2.$EVENT)(ctx, state2, "IsBare", IsBare$0);
|
|
@@ -20251,8 +20358,7 @@ function PopIndent(ctx, state2) {
|
|
|
20251
20358
|
}
|
|
20252
20359
|
var Nested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
|
|
20253
20360
|
var indent = $2;
|
|
20254
|
-
if (indent.level === state.currentIndent.level)
|
|
20255
|
-
return $0;
|
|
20361
|
+
if (indent.level === state.currentIndent.level) return $0;
|
|
20256
20362
|
if (config.verbose) {
|
|
20257
20363
|
console.log(`failing Nested: ${indent.level} does not match current indent level ${state.currentIndent.level}`);
|
|
20258
20364
|
}
|
|
@@ -20263,8 +20369,7 @@ function Nested(ctx, state2) {
|
|
|
20263
20369
|
}
|
|
20264
20370
|
var IndentedFurther$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
|
|
20265
20371
|
var indent = $2;
|
|
20266
|
-
if (indent.level > state.currentIndent.level)
|
|
20267
|
-
return $0;
|
|
20372
|
+
if (indent.level > state.currentIndent.level) return $0;
|
|
20268
20373
|
return $skip;
|
|
20269
20374
|
});
|
|
20270
20375
|
function IndentedFurther(ctx, state2) {
|
|
@@ -20272,8 +20377,7 @@ function IndentedFurther(ctx, state2) {
|
|
|
20272
20377
|
}
|
|
20273
20378
|
var IndentedAtLeast$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
|
|
20274
20379
|
var indent = $2;
|
|
20275
|
-
if (indent.level >= state.currentIndent.level)
|
|
20276
|
-
return $0;
|
|
20380
|
+
if (indent.level >= state.currentIndent.level) return $0;
|
|
20277
20381
|
return $skip;
|
|
20278
20382
|
});
|
|
20279
20383
|
function IndentedAtLeast(ctx, state2) {
|
|
@@ -20281,10 +20385,8 @@ function IndentedAtLeast(ctx, state2) {
|
|
|
20281
20385
|
}
|
|
20282
20386
|
var NotDedented$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(IndentedAtLeast), (0, import_lib2.$E)(_)), function($skip, $loc, $0, $1, $2) {
|
|
20283
20387
|
const ws = [];
|
|
20284
|
-
if ($1)
|
|
20285
|
-
|
|
20286
|
-
if ($2)
|
|
20287
|
-
ws.push(...$2);
|
|
20388
|
+
if ($1) ws.push(...$1);
|
|
20389
|
+
if ($2) ws.push(...$2);
|
|
20288
20390
|
return ws.flat(Infinity).filter(Boolean);
|
|
20289
20391
|
});
|
|
20290
20392
|
function NotDedented(ctx, state2) {
|
|
@@ -20292,10 +20394,8 @@ function NotDedented(ctx, state2) {
|
|
|
20292
20394
|
}
|
|
20293
20395
|
var SameLineOrIndentedFurther$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(IndentedFurther), (0, import_lib2.$E)(_)), function($skip, $loc, $0, $1, $2) {
|
|
20294
20396
|
const ws = [];
|
|
20295
|
-
if ($1)
|
|
20296
|
-
|
|
20297
|
-
if ($2)
|
|
20298
|
-
ws.push(...$2);
|
|
20397
|
+
if ($1) ws.push(...$1);
|
|
20398
|
+
if ($2) ws.push(...$2);
|
|
20299
20399
|
return ws.flat(Infinity).filter(Boolean);
|
|
20300
20400
|
});
|
|
20301
20401
|
function SameLineOrIndentedFurther(ctx, state2) {
|
|
@@ -20313,8 +20413,7 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
|
|
|
20313
20413
|
$loc,
|
|
20314
20414
|
level: state.currentIndent.level + 1
|
|
20315
20415
|
};
|
|
20316
|
-
if (config.verbose)
|
|
20317
|
-
console.log("pushing bonus indent", indent);
|
|
20416
|
+
if (config.verbose) console.log("pushing bonus indent", indent);
|
|
20318
20417
|
state.indentLevels.push(indent);
|
|
20319
20418
|
return indent;
|
|
20320
20419
|
});
|
|
@@ -20326,11 +20425,9 @@ var parser = function() {
|
|
|
20326
20425
|
let ctx = { expectation: "", fail };
|
|
20327
20426
|
return {
|
|
20328
20427
|
parse: (input, options = {}) => {
|
|
20329
|
-
if (typeof input !== "string")
|
|
20330
|
-
throw new Error("Input must be a string");
|
|
20428
|
+
if (typeof input !== "string") throw new Error("Input must be a string");
|
|
20331
20429
|
const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
20332
|
-
if (!parser2)
|
|
20333
|
-
throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
20430
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
20334
20431
|
const filename2 = options.filename || "<anonymous>";
|
|
20335
20432
|
reset();
|
|
20336
20433
|
Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
|
|
@@ -20461,9 +20558,9 @@ var wellKnownSymbols = [
|
|
|
20461
20558
|
"unscopables"
|
|
20462
20559
|
];
|
|
20463
20560
|
|
|
20464
|
-
// source
|
|
20465
|
-
var
|
|
20466
|
-
__export(
|
|
20561
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
|
|
20562
|
+
var sourcemap_civet_exports = {};
|
|
20563
|
+
__export(sourcemap_civet_exports, {
|
|
20467
20564
|
SourceMap: () => SourceMap,
|
|
20468
20565
|
base64Encode: () => base64Encode,
|
|
20469
20566
|
locationTable: () => locationTable,
|
|
@@ -20648,10 +20745,8 @@ var VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
|
|
|
20648
20745
|
var encodeVlq = function(value) {
|
|
20649
20746
|
let answer = "";
|
|
20650
20747
|
let ref1;
|
|
20651
|
-
if (value < 0)
|
|
20652
|
-
|
|
20653
|
-
else
|
|
20654
|
-
ref1 = 0;
|
|
20748
|
+
if (value < 0) ref1 = 1;
|
|
20749
|
+
else ref1 = 0;
|
|
20655
20750
|
const signBit = ref1;
|
|
20656
20751
|
let valueToEncode = (Math.abs(value) << 1) + signBit;
|
|
20657
20752
|
while (valueToEncode || !answer) {
|
|
@@ -20765,7 +20860,7 @@ var remapPosition = function(position, sourcemapLines) {
|
|
|
20765
20860
|
}
|
|
20766
20861
|
};
|
|
20767
20862
|
|
|
20768
|
-
// source
|
|
20863
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
|
|
20769
20864
|
var StateCache = class {
|
|
20770
20865
|
cache = /* @__PURE__ */ new Map();
|
|
20771
20866
|
get(key) {
|
|
@@ -20805,8 +20900,86 @@ var StateCache = class {
|
|
|
20805
20900
|
}
|
|
20806
20901
|
};
|
|
20807
20902
|
|
|
20808
|
-
// source
|
|
20809
|
-
var
|
|
20903
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\worker-pool.civet.jsx
|
|
20904
|
+
var WorkerPool = class {
|
|
20905
|
+
idle;
|
|
20906
|
+
spawned;
|
|
20907
|
+
jobId;
|
|
20908
|
+
callbacks;
|
|
20909
|
+
todo;
|
|
20910
|
+
threads;
|
|
20911
|
+
constructor(threads) {
|
|
20912
|
+
this.threads = threads;
|
|
20913
|
+
this.idle = [];
|
|
20914
|
+
this.spawned = 0;
|
|
20915
|
+
this.jobId = 0;
|
|
20916
|
+
this.callbacks = /* @__PURE__ */ new Map();
|
|
20917
|
+
this.todo = [];
|
|
20918
|
+
}
|
|
20919
|
+
async run(op, ...args) {
|
|
20920
|
+
const id = this.jobId++;
|
|
20921
|
+
return await new Promise(async (resolve2, reject) => {
|
|
20922
|
+
this.callbacks.set(id, { resolve: resolve2, reject });
|
|
20923
|
+
const job = { id, op, args };
|
|
20924
|
+
if (this.idle.length) {
|
|
20925
|
+
const worker = this.idle.shift();
|
|
20926
|
+
worker.ref();
|
|
20927
|
+
worker.postMessage(job);
|
|
20928
|
+
} else if (this.spawned < this.threads) {
|
|
20929
|
+
(await this.startWorker()).postMessage(job);
|
|
20930
|
+
} else {
|
|
20931
|
+
this.todo.push(job);
|
|
20932
|
+
}
|
|
20933
|
+
});
|
|
20934
|
+
}
|
|
20935
|
+
async startWorker() {
|
|
20936
|
+
this.spawned++;
|
|
20937
|
+
const { Worker } = await import("node:worker_threads");
|
|
20938
|
+
const path = (await import("node:path")).default;
|
|
20939
|
+
ESM_ONLY: globalThis.__dirname = await (async () => {
|
|
20940
|
+
{
|
|
20941
|
+
const { fileURLToPath } = await import("node:url");
|
|
20942
|
+
return path.dirname(fileURLToPath(import.meta.url));
|
|
20943
|
+
}
|
|
20944
|
+
})();
|
|
20945
|
+
const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
|
|
20946
|
+
worker.on("message", (response) => {
|
|
20947
|
+
const callback = this.callbacks.get(response.id);
|
|
20948
|
+
this.callbacks.delete(response.id);
|
|
20949
|
+
if (response.error) {
|
|
20950
|
+
callback.reject(response.error);
|
|
20951
|
+
} else {
|
|
20952
|
+
callback.resolve(response.result);
|
|
20953
|
+
}
|
|
20954
|
+
if (this.spawned > this.threads) {
|
|
20955
|
+
this.spawned--;
|
|
20956
|
+
return worker.terminate();
|
|
20957
|
+
} else if (this.todo.length) {
|
|
20958
|
+
return worker.postMessage(this.todo.shift());
|
|
20959
|
+
} else {
|
|
20960
|
+
this.idle.push(worker);
|
|
20961
|
+
return worker.unref();
|
|
20962
|
+
}
|
|
20963
|
+
});
|
|
20964
|
+
worker.on("error", (error) => {
|
|
20965
|
+
return console.error("Civet worker failed:", error);
|
|
20966
|
+
});
|
|
20967
|
+
return worker;
|
|
20968
|
+
}
|
|
20969
|
+
setThreads(threads1) {
|
|
20970
|
+
this.threads = threads1;
|
|
20971
|
+
while (this.spawned > this.threads) {
|
|
20972
|
+
if (!this.idle.length) {
|
|
20973
|
+
return;
|
|
20974
|
+
}
|
|
20975
|
+
this.spawned--;
|
|
20976
|
+
this.idle.pop().terminate();
|
|
20977
|
+
}
|
|
20978
|
+
}
|
|
20979
|
+
};
|
|
20980
|
+
|
|
20981
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
|
|
20982
|
+
var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
|
|
20810
20983
|
var ParseErrors = class extends Error {
|
|
20811
20984
|
name = "ParseErrors";
|
|
20812
20985
|
errors;
|
|
@@ -20864,7 +21037,21 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
20864
21037
|
"RestoreNewlineBinaryOp",
|
|
20865
21038
|
"RestorePipeline"
|
|
20866
21039
|
]);
|
|
21040
|
+
var workerPool;
|
|
20867
21041
|
function compile(src, options) {
|
|
21042
|
+
if (!(process.env.CIVET_THREADS == 0)) {
|
|
21043
|
+
const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
|
|
21044
|
+
if (threads === 0) {
|
|
21045
|
+
workerPool?.setThreads(0);
|
|
21046
|
+
} else if (!isNaN(threads) && threads > 0 && !options.sync) {
|
|
21047
|
+
if (workerPool != null) {
|
|
21048
|
+
workerPool.setThreads(threads);
|
|
21049
|
+
} else {
|
|
21050
|
+
workerPool = new WorkerPool(threads);
|
|
21051
|
+
}
|
|
21052
|
+
return workerPool.run("compile", src, { ...options, threads: 0 });
|
|
21053
|
+
}
|
|
21054
|
+
}
|
|
20868
21055
|
if (!options) {
|
|
20869
21056
|
options = {};
|
|
20870
21057
|
} else {
|
|
@@ -20946,7 +21133,7 @@ ${counts}`;
|
|
|
20946
21133
|
}
|
|
20947
21134
|
if (options.sourceMap || options.inlineMap) {
|
|
20948
21135
|
options.sourceMap = SourceMap2(src);
|
|
20949
|
-
const code =
|
|
21136
|
+
const code = generate_civet_default(ast2, options);
|
|
20950
21137
|
checkErrors();
|
|
20951
21138
|
if (options.inlineMap) {
|
|
20952
21139
|
return SourceMap2.remap(code, options.sourceMap, filename2, filename2 + ".tsx");
|
|
@@ -20957,11 +21144,11 @@ ${counts}`;
|
|
|
20957
21144
|
};
|
|
20958
21145
|
}
|
|
20959
21146
|
}
|
|
20960
|
-
const result =
|
|
21147
|
+
const result = generate_civet_default(ast2, options);
|
|
20961
21148
|
if (options.errors?.length) {
|
|
20962
21149
|
delete options.errors;
|
|
20963
21150
|
options.sourceMap = SourceMap2(src);
|
|
20964
|
-
|
|
21151
|
+
generate_civet_default(ast2, options);
|
|
20965
21152
|
checkErrors();
|
|
20966
21153
|
}
|
|
20967
21154
|
return result;
|
|
@@ -21040,19 +21227,19 @@ var makeCache = function({ hits, trace } = {}) {
|
|
|
21040
21227
|
var isCompileError = function(err) {
|
|
21041
21228
|
return err instanceof import_lib2.ParseError || err instanceof ParseErrors;
|
|
21042
21229
|
};
|
|
21043
|
-
var
|
|
21230
|
+
var main_civet_default = { parse, parseProgram, ParseError: import_lib2.ParseError, ParseErrors, generate: generate_civet_default, sourcemap: sourcemap_civet_exports, SourceMap: SourceMap2, compile, isCompileError };
|
|
21044
21231
|
var export_ParseError = import_lib2.ParseError;
|
|
21045
21232
|
export {
|
|
21046
21233
|
export_ParseError as ParseError,
|
|
21047
21234
|
ParseErrors,
|
|
21048
21235
|
SourceMap2 as SourceMap,
|
|
21049
21236
|
compile,
|
|
21050
|
-
|
|
21051
|
-
|
|
21237
|
+
main_civet_default as default,
|
|
21238
|
+
generate_civet_default as generate,
|
|
21052
21239
|
isCompileError,
|
|
21053
|
-
|
|
21240
|
+
lib_civet_exports as lib,
|
|
21054
21241
|
parse,
|
|
21055
21242
|
parseProgram,
|
|
21056
21243
|
prune,
|
|
21057
|
-
|
|
21244
|
+
sourcemap_civet_exports as sourcemap
|
|
21058
21245
|
};
|