@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.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -484,36 +483,37 @@ ${body}`;
|
|
|
484
483
|
}
|
|
485
484
|
});
|
|
486
485
|
|
|
487
|
-
// source
|
|
488
|
-
var
|
|
489
|
-
__export(
|
|
486
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
|
|
487
|
+
var main_civet_exports = {};
|
|
488
|
+
__export(main_civet_exports, {
|
|
490
489
|
ParseError: () => import_lib2.ParseError,
|
|
491
490
|
ParseErrors: () => ParseErrors,
|
|
492
491
|
SourceMap: () => SourceMap2,
|
|
493
492
|
compile: () => compile,
|
|
494
|
-
default: () =>
|
|
495
|
-
generate: () =>
|
|
493
|
+
default: () => main_civet_default,
|
|
494
|
+
generate: () => generate_civet_default,
|
|
496
495
|
isCompileError: () => isCompileError,
|
|
497
|
-
lib: () =>
|
|
496
|
+
lib: () => lib_civet_exports,
|
|
498
497
|
parse: () => parse,
|
|
499
498
|
parseProgram: () => parseProgram,
|
|
500
499
|
prune: () => prune,
|
|
501
|
-
sourcemap: () =>
|
|
500
|
+
sourcemap: () => sourcemap_civet_exports
|
|
502
501
|
});
|
|
503
|
-
module.exports = __toCommonJS(
|
|
502
|
+
module.exports = __toCommonJS(main_civet_exports);
|
|
504
503
|
|
|
505
504
|
// source/parser.hera
|
|
506
505
|
var import_lib2 = __toESM(require_machine());
|
|
507
506
|
|
|
508
|
-
// source
|
|
509
|
-
var
|
|
510
|
-
__export(
|
|
507
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
|
|
508
|
+
var lib_civet_exports = {};
|
|
509
|
+
__export(lib_civet_exports, {
|
|
511
510
|
addPostfixStatement: () => addPostfixStatement,
|
|
512
511
|
adjustBindingElements: () => adjustBindingElements,
|
|
513
512
|
adjustIndexAccess: () => adjustIndexAccess,
|
|
514
513
|
append: () => append,
|
|
515
514
|
attachPostfixStatementAsExpression: () => attachPostfixStatementAsExpression,
|
|
516
515
|
blockWithPrefix: () => blockWithPrefix,
|
|
516
|
+
braceBlock: () => braceBlock,
|
|
517
517
|
convertNamedImportsToObject: () => convertNamedImportsToObject,
|
|
518
518
|
convertObjectToJSXAttributes: () => convertObjectToJSXAttributes,
|
|
519
519
|
convertWithClause: () => convertWithClause,
|
|
@@ -581,7 +581,7 @@ __export(lib_exports, {
|
|
|
581
581
|
wrapTypeInPromise: () => wrapTypeInPromise
|
|
582
582
|
});
|
|
583
583
|
|
|
584
|
-
// source
|
|
584
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
|
|
585
585
|
function len(arr, length) {
|
|
586
586
|
return arr.length === length;
|
|
587
587
|
}
|
|
@@ -605,10 +605,8 @@ var assert = {
|
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
607
|
function addParentPointers(node, parent) {
|
|
608
|
-
if (node == null)
|
|
609
|
-
|
|
610
|
-
if (typeof node !== "object")
|
|
611
|
-
return;
|
|
608
|
+
if (node == null) return;
|
|
609
|
+
if (typeof node !== "object") return;
|
|
612
610
|
if (Array.isArray(node)) {
|
|
613
611
|
for (const child of node) {
|
|
614
612
|
addParentPointers(child, parent);
|
|
@@ -674,8 +672,7 @@ function isToken(node) {
|
|
|
674
672
|
return node != null && node.token != null;
|
|
675
673
|
}
|
|
676
674
|
function isEmptyBareBlock(node) {
|
|
677
|
-
if (node?.type !== "BlockStatement")
|
|
678
|
-
return false;
|
|
675
|
+
if (node?.type !== "BlockStatement") return false;
|
|
679
676
|
const { bare, expressions } = node;
|
|
680
677
|
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");
|
|
681
678
|
}
|
|
@@ -708,20 +705,13 @@ function isStatement(node) {
|
|
|
708
705
|
statementTypes.has(node.type);
|
|
709
706
|
}
|
|
710
707
|
function isWhitespaceOrEmpty(node) {
|
|
711
|
-
if (!node)
|
|
712
|
-
|
|
713
|
-
if (node.
|
|
714
|
-
|
|
715
|
-
if (node.
|
|
716
|
-
|
|
717
|
-
if (node.
|
|
718
|
-
node = node.children;
|
|
719
|
-
if (!node.length)
|
|
720
|
-
return true;
|
|
721
|
-
if (typeof node === "string")
|
|
722
|
-
return /^\s*$/.test(node);
|
|
723
|
-
if (Array.isArray(node))
|
|
724
|
-
return node.every(isWhitespaceOrEmpty);
|
|
708
|
+
if (!node) return true;
|
|
709
|
+
if (node.type === "Ref") return false;
|
|
710
|
+
if (node.token) return /^\s*$/.test(node.token);
|
|
711
|
+
if (node.children) node = node.children;
|
|
712
|
+
if (!node.length) return true;
|
|
713
|
+
if (typeof node === "string") return /^\s*$/.test(node);
|
|
714
|
+
if (Array.isArray(node)) return node.every(isWhitespaceOrEmpty);
|
|
725
715
|
return false;
|
|
726
716
|
}
|
|
727
717
|
function firstNonSpace(node) {
|
|
@@ -765,12 +755,14 @@ function isExit(node) {
|
|
|
765
755
|
let ref3;
|
|
766
756
|
let ref4;
|
|
767
757
|
switch (node.type) {
|
|
758
|
+
// Exit from normal flow
|
|
768
759
|
case "ReturnStatement":
|
|
769
760
|
case "ThrowStatement":
|
|
770
761
|
case "BreakStatement":
|
|
771
762
|
case "ContinueStatement": {
|
|
772
763
|
return true;
|
|
773
764
|
}
|
|
765
|
+
// if checks then and else clause
|
|
774
766
|
case "IfStatement": {
|
|
775
767
|
return (
|
|
776
768
|
// `insertReturn` for IfStatement adds a return to children
|
|
@@ -794,9 +786,11 @@ function isExit(node) {
|
|
|
794
786
|
case "BlockStatement": {
|
|
795
787
|
return node.expressions.some((s) => isExit(s[1]));
|
|
796
788
|
}
|
|
789
|
+
// Infinite loops
|
|
797
790
|
case "IterationStatement": {
|
|
798
791
|
return isLoopStatement(node) && gatherRecursiveWithinFunction(node.block, ($1) => $1.type === "BreakStatement").length === 0;
|
|
799
792
|
}
|
|
793
|
+
// TODO: Distinguish between break of this loop vs. break of inner loops
|
|
800
794
|
default: {
|
|
801
795
|
return false;
|
|
802
796
|
}
|
|
@@ -1000,6 +994,57 @@ function literalValue(literal) {
|
|
|
1000
994
|
}
|
|
1001
995
|
}
|
|
1002
996
|
}
|
|
997
|
+
function literalType(literal) {
|
|
998
|
+
let t;
|
|
999
|
+
switch (literal.type) {
|
|
1000
|
+
case "RegularExpressionLiteral": {
|
|
1001
|
+
t = "RegExp";
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
case "TemplateLiteral": {
|
|
1005
|
+
t = "string";
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
case "Literal": {
|
|
1009
|
+
switch (literal.subtype) {
|
|
1010
|
+
case "NullLiteral": {
|
|
1011
|
+
t = "null";
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
case "BooleanLiteral": {
|
|
1015
|
+
t = "boolean";
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
case "NumericLiteral": {
|
|
1019
|
+
if (literal.raw.endsWith("n")) {
|
|
1020
|
+
t = "bigint";
|
|
1021
|
+
} else {
|
|
1022
|
+
t = "number";
|
|
1023
|
+
}
|
|
1024
|
+
;
|
|
1025
|
+
break;
|
|
1026
|
+
}
|
|
1027
|
+
case "StringLiteral": {
|
|
1028
|
+
t = "string";
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
default: {
|
|
1032
|
+
throw new Error(`unknown literal subtype ${literal.subtype}`);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
;
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
default: {
|
|
1039
|
+
throw new Error(`unknown literal type ${literal.type}`);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
return {
|
|
1043
|
+
type: "TypeLiteral",
|
|
1044
|
+
t,
|
|
1045
|
+
children: [t]
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1003
1048
|
function makeNumericLiteral(n) {
|
|
1004
1049
|
const s = n.toString();
|
|
1005
1050
|
return {
|
|
@@ -1016,8 +1061,7 @@ function makeNumericLiteral(n) {
|
|
|
1016
1061
|
};
|
|
1017
1062
|
}
|
|
1018
1063
|
function startsWith(target, value) {
|
|
1019
|
-
if (!target)
|
|
1020
|
-
return;
|
|
1064
|
+
if (!target) return;
|
|
1021
1065
|
if (Array.isArray(target)) {
|
|
1022
1066
|
let i = 0;
|
|
1023
1067
|
let l = target.length;
|
|
@@ -1032,12 +1076,9 @@ function startsWith(target, value) {
|
|
|
1032
1076
|
return startsWith(target[i], value);
|
|
1033
1077
|
}
|
|
1034
1078
|
}
|
|
1035
|
-
if (typeof target === "string")
|
|
1036
|
-
|
|
1037
|
-
if (target.
|
|
1038
|
-
return startsWith(target.children, value);
|
|
1039
|
-
if (target.token)
|
|
1040
|
-
return value.test(target.token);
|
|
1079
|
+
if (typeof target === "string") return value.test(target);
|
|
1080
|
+
if (target.children) return startsWith(target.children, value);
|
|
1081
|
+
if (target.token) return value.test(target.token);
|
|
1041
1082
|
return;
|
|
1042
1083
|
}
|
|
1043
1084
|
function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
|
|
@@ -1168,10 +1209,8 @@ function replaceNodes(root, predicate, replacer) {
|
|
|
1168
1209
|
return root;
|
|
1169
1210
|
}
|
|
1170
1211
|
function removeHoistDecs(node) {
|
|
1171
|
-
if (node == null)
|
|
1172
|
-
|
|
1173
|
-
if (typeof node !== "object")
|
|
1174
|
-
return;
|
|
1212
|
+
if (node == null) return;
|
|
1213
|
+
if (typeof node !== "object") return;
|
|
1175
1214
|
if ("hoistDec" in node) {
|
|
1176
1215
|
node.hoistDec = void 0;
|
|
1177
1216
|
}
|
|
@@ -1303,8 +1342,7 @@ function makeNode(node) {
|
|
|
1303
1342
|
return node;
|
|
1304
1343
|
}
|
|
1305
1344
|
function skipIfOnlyWS(target) {
|
|
1306
|
-
if (!target)
|
|
1307
|
-
return target;
|
|
1345
|
+
if (!target) return target;
|
|
1308
1346
|
if (Array.isArray(target)) {
|
|
1309
1347
|
if (target.length === 1) {
|
|
1310
1348
|
return skipIfOnlyWS(target[0]);
|
|
@@ -1319,7 +1357,7 @@ function skipIfOnlyWS(target) {
|
|
|
1319
1357
|
return target;
|
|
1320
1358
|
}
|
|
1321
1359
|
function spliceChild(node, child, del, ...replacements) {
|
|
1322
|
-
const children = node
|
|
1360
|
+
const children = Array.isArray(node) ? node : node.children;
|
|
1323
1361
|
if (!Array.isArray(children)) {
|
|
1324
1362
|
throw new Error("spliceChild: non-array node has no children field");
|
|
1325
1363
|
}
|
|
@@ -1365,8 +1403,9 @@ function parenthesizeType(type) {
|
|
|
1365
1403
|
children: ["(", type, ")"]
|
|
1366
1404
|
});
|
|
1367
1405
|
}
|
|
1368
|
-
function wrapIIFE(expressions, asyncFlag,
|
|
1406
|
+
function wrapIIFE(expressions, asyncFlag, generatorStar) {
|
|
1369
1407
|
let awaitPrefix;
|
|
1408
|
+
const generator = generatorStar ? [generatorStar] : [];
|
|
1370
1409
|
const async = [];
|
|
1371
1410
|
if (asyncFlag) {
|
|
1372
1411
|
async.push("async ");
|
|
@@ -1378,9 +1417,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1378
1417
|
};
|
|
1379
1418
|
}
|
|
1380
1419
|
let yieldWrap = false;
|
|
1381
|
-
if (!generator) {
|
|
1420
|
+
if (!generator.length) {
|
|
1382
1421
|
if (hasYield(expressions)) {
|
|
1383
|
-
generator
|
|
1422
|
+
generator.push("*");
|
|
1384
1423
|
yieldWrap = true;
|
|
1385
1424
|
}
|
|
1386
1425
|
}
|
|
@@ -1391,30 +1430,34 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1391
1430
|
bare: false,
|
|
1392
1431
|
root: false
|
|
1393
1432
|
});
|
|
1433
|
+
const parameterList = [];
|
|
1394
1434
|
const parameters = {
|
|
1395
1435
|
type: "Parameters",
|
|
1396
|
-
children: ["()"],
|
|
1436
|
+
children: ["(", parameterList, ")"],
|
|
1437
|
+
parameters: parameterList,
|
|
1397
1438
|
names: []
|
|
1398
1439
|
};
|
|
1399
1440
|
const signature = {
|
|
1441
|
+
type: "FunctionSignature",
|
|
1400
1442
|
modifier: {
|
|
1401
1443
|
async: !!async.length,
|
|
1402
|
-
generator: !!generator
|
|
1444
|
+
generator: !!generator.length
|
|
1403
1445
|
},
|
|
1404
|
-
|
|
1446
|
+
parameters,
|
|
1447
|
+
returnType: void 0,
|
|
1448
|
+
children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
|
|
1405
1449
|
};
|
|
1406
1450
|
let fn;
|
|
1407
|
-
if (generator) {
|
|
1451
|
+
if (generator.length) {
|
|
1408
1452
|
fn = makeNode({
|
|
1409
1453
|
type: "FunctionExpression",
|
|
1410
1454
|
signature,
|
|
1411
1455
|
parameters,
|
|
1412
1456
|
returnType: void 0,
|
|
1413
|
-
ts: false,
|
|
1414
1457
|
async,
|
|
1415
1458
|
block,
|
|
1416
1459
|
generator,
|
|
1417
|
-
children: [
|
|
1460
|
+
children: [...signature.children, block]
|
|
1418
1461
|
});
|
|
1419
1462
|
} else {
|
|
1420
1463
|
fn = makeNode({
|
|
@@ -1422,10 +1465,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1422
1465
|
signature,
|
|
1423
1466
|
parameters,
|
|
1424
1467
|
returnType: void 0,
|
|
1425
|
-
ts: false,
|
|
1426
1468
|
async,
|
|
1427
1469
|
block,
|
|
1428
|
-
children: [
|
|
1470
|
+
children: [...signature.children, "=>", block]
|
|
1429
1471
|
});
|
|
1430
1472
|
}
|
|
1431
1473
|
const children = [makeLeftHandSideExpression(fn), "()"];
|
|
@@ -1434,8 +1476,19 @@ function wrapIIFE(expressions, asyncFlag, generator) {
|
|
|
1434
1476
|
children.splice(1, 0, ".bind(this)");
|
|
1435
1477
|
}
|
|
1436
1478
|
if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
|
|
1437
|
-
|
|
1438
|
-
|
|
1479
|
+
const binding = {
|
|
1480
|
+
type: "Identifier",
|
|
1481
|
+
name: "arguments",
|
|
1482
|
+
names: ["arguments"],
|
|
1483
|
+
children: ["arguments"]
|
|
1484
|
+
};
|
|
1485
|
+
parameterList.push({
|
|
1486
|
+
type: "Parameter",
|
|
1487
|
+
children: [binding],
|
|
1488
|
+
names: ["arguments"],
|
|
1489
|
+
binding
|
|
1490
|
+
});
|
|
1491
|
+
children[children.length - 1] = "(arguments)";
|
|
1439
1492
|
}
|
|
1440
1493
|
}
|
|
1441
1494
|
let exp = makeNode({
|
|
@@ -1487,7 +1540,7 @@ function flatJoin(array, separator) {
|
|
|
1487
1540
|
return result;
|
|
1488
1541
|
}
|
|
1489
1542
|
|
|
1490
|
-
// source
|
|
1543
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
|
|
1491
1544
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
1492
1545
|
return gatherRecursive(node, predicate, isFunction);
|
|
1493
1546
|
}
|
|
@@ -1554,7 +1607,6 @@ function gatherNodes(node, predicate) {
|
|
|
1554
1607
|
}
|
|
1555
1608
|
default: {
|
|
1556
1609
|
return gatherNodes(
|
|
1557
|
-
//@ts-ignore
|
|
1558
1610
|
node.children,
|
|
1559
1611
|
predicate
|
|
1560
1612
|
);
|
|
@@ -1575,7 +1627,6 @@ function gatherRecursive(node, predicate, skipPredicate) {
|
|
|
1575
1627
|
return [node];
|
|
1576
1628
|
}
|
|
1577
1629
|
return gatherRecursive(
|
|
1578
|
-
//@ts-ignore
|
|
1579
1630
|
node.children,
|
|
1580
1631
|
predicate,
|
|
1581
1632
|
skipPredicate
|
|
@@ -1589,7 +1640,6 @@ function gatherRecursiveAll(node, predicate) {
|
|
|
1589
1640
|
return node.flatMap((n) => gatherRecursiveAll(n, predicate));
|
|
1590
1641
|
}
|
|
1591
1642
|
const nodes = gatherRecursiveAll(
|
|
1592
|
-
//@ts-ignore
|
|
1593
1643
|
node.children,
|
|
1594
1644
|
predicate
|
|
1595
1645
|
);
|
|
@@ -1599,7 +1649,7 @@ function gatherRecursiveAll(node, predicate) {
|
|
|
1599
1649
|
return nodes;
|
|
1600
1650
|
}
|
|
1601
1651
|
|
|
1602
|
-
// source
|
|
1652
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
|
|
1603
1653
|
function makeRef(base = "ref", id = base) {
|
|
1604
1654
|
return {
|
|
1605
1655
|
type: "Ref",
|
|
@@ -1660,9 +1710,10 @@ function maybeRefAssignment(exp, base = "ref") {
|
|
|
1660
1710
|
}
|
|
1661
1711
|
}
|
|
1662
1712
|
|
|
1663
|
-
// source
|
|
1713
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
|
|
1664
1714
|
function adjustAtBindings(statements, asThis = false) {
|
|
1665
|
-
gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty").
|
|
1715
|
+
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
|
|
1716
|
+
const binding = ref1[i1];
|
|
1666
1717
|
const { ref } = binding;
|
|
1667
1718
|
if (asThis) {
|
|
1668
1719
|
const atBinding = binding.binding;
|
|
@@ -1673,20 +1724,18 @@ function adjustAtBindings(statements, asThis = false) {
|
|
|
1673
1724
|
binding.ref = void 0;
|
|
1674
1725
|
return;
|
|
1675
1726
|
}
|
|
1676
|
-
if (ref.names[0]
|
|
1677
|
-
|
|
1727
|
+
if (!(ref.names[0] === ref.base)) {
|
|
1728
|
+
binding.children.unshift(ref.base, ": ");
|
|
1678
1729
|
}
|
|
1679
|
-
|
|
1680
|
-
return;
|
|
1681
|
-
});
|
|
1730
|
+
}
|
|
1682
1731
|
}
|
|
1683
1732
|
function adjustBindingElements(elements) {
|
|
1684
1733
|
const names = elements.flatMap(($1) => $1.names || []);
|
|
1685
1734
|
const { length } = elements;
|
|
1686
1735
|
let blockPrefix, restIndex = -1, restCount = 0;
|
|
1687
|
-
for (let
|
|
1688
|
-
const i =
|
|
1689
|
-
const { type } = elements[
|
|
1736
|
+
for (let i2 = 0, len1 = elements.length; i2 < len1; i2++) {
|
|
1737
|
+
const i = i2;
|
|
1738
|
+
const { type } = elements[i2];
|
|
1690
1739
|
if (type === "BindingRestElement") {
|
|
1691
1740
|
if (restIndex < 0) {
|
|
1692
1741
|
restIndex = i;
|
|
@@ -1708,8 +1757,7 @@ function adjustBindingElements(elements) {
|
|
|
1708
1757
|
names.push(...rest.names || []);
|
|
1709
1758
|
let l = after.length;
|
|
1710
1759
|
if (l) {
|
|
1711
|
-
if (arrayElementHasTrailingComma(after[l - 1]))
|
|
1712
|
-
l++;
|
|
1760
|
+
if (arrayElementHasTrailingComma(after[l - 1])) l++;
|
|
1713
1761
|
const elements2 = trimFirstSpace(after);
|
|
1714
1762
|
blockPrefix = {
|
|
1715
1763
|
type: "PostRestBindingElements",
|
|
@@ -1744,35 +1792,63 @@ function gatherBindingCode(statements, opts) {
|
|
|
1744
1792
|
const thisAssignments = [];
|
|
1745
1793
|
const splices = [];
|
|
1746
1794
|
function insertRestSplices(s, p, thisAssignments2) {
|
|
1747
|
-
|
|
1795
|
+
let m;
|
|
1796
|
+
for (let ref2 = gatherRecursiveAll(
|
|
1797
|
+
s,
|
|
1798
|
+
(n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding" || opts?.assignPins && (m = n.type, m === "PinPattern" || m === "PinProperty")
|
|
1799
|
+
), i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
|
|
1800
|
+
let n = ref2[i3];
|
|
1748
1801
|
if (n.type === "AtBinding") {
|
|
1749
1802
|
const { ref } = n;
|
|
1750
1803
|
const { id } = ref;
|
|
1751
1804
|
thisAssignments2.push([`this.${id} = `, ref]);
|
|
1752
|
-
|
|
1805
|
+
continue;
|
|
1806
|
+
}
|
|
1807
|
+
if (opts?.assignPins) {
|
|
1808
|
+
if (n.type === "PinProperty") {
|
|
1809
|
+
n.children = n.children.flatMap(($2) => $2 === n.name ? [n.name, ": ", n.value] : $2);
|
|
1810
|
+
updateParentPointers(n);
|
|
1811
|
+
n = n.value;
|
|
1812
|
+
}
|
|
1813
|
+
if (n.type === "PinPattern") {
|
|
1814
|
+
n.ref = makeRef(
|
|
1815
|
+
n.expression.type === "Identifier" ? n.expression.name : "pin"
|
|
1816
|
+
);
|
|
1817
|
+
n.children = [n.ref];
|
|
1818
|
+
updateParentPointers(n);
|
|
1819
|
+
thisAssignments2.push({
|
|
1820
|
+
type: "AssignmentExpression",
|
|
1821
|
+
children: [n.expression, " = ", n.ref],
|
|
1822
|
+
names: [],
|
|
1823
|
+
lhs: n.expression,
|
|
1824
|
+
assigned: n.expression,
|
|
1825
|
+
expression: n.ref
|
|
1826
|
+
});
|
|
1827
|
+
continue;
|
|
1828
|
+
}
|
|
1753
1829
|
}
|
|
1754
1830
|
if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
|
|
1755
|
-
for (let
|
|
1756
|
-
const id =
|
|
1831
|
+
for (let ref3 = n.names, i4 = 0, len3 = ref3.length; i4 < len3; i4++) {
|
|
1832
|
+
const id = ref3[i4];
|
|
1757
1833
|
thisAssignments2.push({
|
|
1758
1834
|
type: "AssignmentExpression",
|
|
1759
1835
|
children: [`this.${id} = `, id],
|
|
1760
1836
|
js: true
|
|
1761
1837
|
});
|
|
1762
1838
|
}
|
|
1763
|
-
|
|
1839
|
+
continue;
|
|
1764
1840
|
}
|
|
1765
1841
|
const { blockPrefix } = n;
|
|
1766
1842
|
p.push(blockPrefix);
|
|
1767
|
-
|
|
1768
|
-
}
|
|
1843
|
+
insertRestSplices(blockPrefix, p, thisAssignments2);
|
|
1844
|
+
}
|
|
1769
1845
|
}
|
|
1770
1846
|
insertRestSplices(statements, splices, thisAssignments);
|
|
1771
1847
|
return [splices, thisAssignments];
|
|
1772
1848
|
}
|
|
1773
1849
|
function arrayElementHasTrailingComma(elementNode) {
|
|
1774
|
-
let
|
|
1775
|
-
const lastChild = (
|
|
1850
|
+
let ref4;
|
|
1851
|
+
const lastChild = (ref4 = elementNode.children)[ref4.length - 1];
|
|
1776
1852
|
return lastChild && lastChild[lastChild.length - 1]?.token === ",";
|
|
1777
1853
|
}
|
|
1778
1854
|
function gatherBindingPatternTypeSuffix(pattern) {
|
|
@@ -1784,8 +1860,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1784
1860
|
case "ArrayBindingPattern": {
|
|
1785
1861
|
{
|
|
1786
1862
|
const results = [];
|
|
1787
|
-
for (let
|
|
1788
|
-
const elem =
|
|
1863
|
+
for (let ref5 = pattern.elements, i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
|
|
1864
|
+
const elem = ref5[i5];
|
|
1789
1865
|
let { typeSuffix } = elem;
|
|
1790
1866
|
typeSuffix ??= elem.binding?.typeSuffix;
|
|
1791
1867
|
if (typeSuffix) {
|
|
@@ -1823,8 +1899,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1823
1899
|
{
|
|
1824
1900
|
let restType;
|
|
1825
1901
|
const results1 = [];
|
|
1826
|
-
for (let
|
|
1827
|
-
const prop =
|
|
1902
|
+
for (let ref6 = pattern.properties, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
|
|
1903
|
+
const prop = ref6[i6];
|
|
1828
1904
|
let { typeSuffix } = prop;
|
|
1829
1905
|
typeSuffix ??= prop.value?.typeSuffix;
|
|
1830
1906
|
if (typeSuffix) {
|
|
@@ -1874,12 +1950,12 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1874
1950
|
return pattern;
|
|
1875
1951
|
}
|
|
1876
1952
|
|
|
1877
|
-
// source
|
|
1953
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
|
|
1878
1954
|
var import_node_path = require("node:path");
|
|
1879
1955
|
var import_node_module = require("node:module");
|
|
1880
1956
|
var import_node_vm = __toESM(require("node:vm"));
|
|
1881
1957
|
|
|
1882
|
-
// source
|
|
1958
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
|
|
1883
1959
|
var preludeVar = "var ";
|
|
1884
1960
|
function ts(children) {
|
|
1885
1961
|
return {
|
|
@@ -2109,7 +2185,7 @@ function extractPreludeFor(node) {
|
|
|
2109
2185
|
return state.prelude.filter((s) => gatherRecursive(s, helpers.has.bind(helpers)).length);
|
|
2110
2186
|
}
|
|
2111
2187
|
|
|
2112
|
-
// source
|
|
2188
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
|
|
2113
2189
|
function stringify(node) {
|
|
2114
2190
|
try {
|
|
2115
2191
|
return JSON.stringify(removeParentPointers(node));
|
|
@@ -2190,7 +2266,7 @@ function gen(root, options) {
|
|
|
2190
2266
|
throw new Error(`Unknown node ${stringify(node)}`);
|
|
2191
2267
|
}
|
|
2192
2268
|
}
|
|
2193
|
-
var
|
|
2269
|
+
var generate_civet_default = gen;
|
|
2194
2270
|
function prune(node) {
|
|
2195
2271
|
if (!(node != null)) {
|
|
2196
2272
|
return;
|
|
@@ -2218,7 +2294,7 @@ function prune(node) {
|
|
|
2218
2294
|
return node;
|
|
2219
2295
|
}
|
|
2220
2296
|
|
|
2221
|
-
// source
|
|
2297
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
|
|
2222
2298
|
function expressionizeComptime(statement) {
|
|
2223
2299
|
const { expressions } = statement.block;
|
|
2224
2300
|
const expression = wrapIIFE(expressions, hasAwait(expressions));
|
|
@@ -2257,7 +2333,7 @@ function runComptime(statements) {
|
|
|
2257
2333
|
content
|
|
2258
2334
|
];
|
|
2259
2335
|
const options = { js: true };
|
|
2260
|
-
let js =
|
|
2336
|
+
let js = generate_civet_default(prune(content), options);
|
|
2261
2337
|
js = `"use strict";${js}`;
|
|
2262
2338
|
if (options.errors != null) {
|
|
2263
2339
|
return;
|
|
@@ -2341,10 +2417,8 @@ function serialize(value, context) {
|
|
|
2341
2417
|
if (typeof val === "string") {
|
|
2342
2418
|
return JSON.stringify(val);
|
|
2343
2419
|
} else if (typeof val === "number") {
|
|
2344
|
-
if (Object.is(-0, val))
|
|
2345
|
-
|
|
2346
|
-
else
|
|
2347
|
-
return val.toString();
|
|
2420
|
+
if (Object.is(-0, val)) return "-0";
|
|
2421
|
+
else return val.toString();
|
|
2348
2422
|
} else if (typeof val === "boolean" || val == null) {
|
|
2349
2423
|
return String(val);
|
|
2350
2424
|
} else if (typeof val === "bigint") {
|
|
@@ -2516,6 +2590,7 @@ function serialize(value, context) {
|
|
|
2516
2590
|
ref1 = `new ${val.constructor.name}([${Array.from(val, ($1) => `${$1}n`).join(",")}])`;
|
|
2517
2591
|
break;
|
|
2518
2592
|
}
|
|
2593
|
+
// Spelled differently for browsers, where `Buffer` doesn't exist
|
|
2519
2594
|
case globalThis.Buffer?.prototype:
|
|
2520
2595
|
case context?.Buffer?.prototype: {
|
|
2521
2596
|
ref1 = `Buffer.from([${val.join(",")}])`;
|
|
@@ -2540,7 +2615,8 @@ function serialize(value, context) {
|
|
|
2540
2615
|
return recurse(value);
|
|
2541
2616
|
}
|
|
2542
2617
|
|
|
2543
|
-
// source
|
|
2618
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
|
|
2619
|
+
var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
|
|
2544
2620
|
function getTypeArguments(args) {
|
|
2545
2621
|
while (typeof args === "object" && args != null && "args" in args) {
|
|
2546
2622
|
args = args.args;
|
|
@@ -2598,8 +2674,7 @@ function wrapTypeInApplication(t, id, raw) {
|
|
|
2598
2674
|
};
|
|
2599
2675
|
}
|
|
2600
2676
|
function implicitFunctionBlock(f) {
|
|
2601
|
-
if (f.abstract || f.block || f.signature?.optional)
|
|
2602
|
-
return;
|
|
2677
|
+
if (f.abstract || f.block || f.signature?.optional) return;
|
|
2603
2678
|
const { name, parent } = f;
|
|
2604
2679
|
let ancestor = parent;
|
|
2605
2680
|
let child = f;
|
|
@@ -2738,16 +2813,14 @@ function patternAsValue(pattern) {
|
|
|
2738
2813
|
case "ArrayBindingPattern": {
|
|
2739
2814
|
const children = [...pattern.children];
|
|
2740
2815
|
const index = children.indexOf(pattern.elements);
|
|
2741
|
-
if (index < 0)
|
|
2742
|
-
throw new Error("failed to find elements in ArrayBindingPattern");
|
|
2816
|
+
if (index < 0) throw new Error("failed to find elements in ArrayBindingPattern");
|
|
2743
2817
|
const elements = children[index] = pattern.elements.map(patternAsValue);
|
|
2744
2818
|
return { ...pattern, elements, children };
|
|
2745
2819
|
}
|
|
2746
2820
|
case "ObjectBindingPattern": {
|
|
2747
2821
|
const children = [...pattern.children];
|
|
2748
2822
|
const index = children.indexOf(pattern.properties);
|
|
2749
|
-
if (index < 0)
|
|
2750
|
-
throw new Error("failed to find properties in ArrayBindingPattern");
|
|
2823
|
+
if (index < 0) throw new Error("failed to find properties in ArrayBindingPattern");
|
|
2751
2824
|
const properties = children[index] = pattern.properties.map(patternAsValue);
|
|
2752
2825
|
return { ...pattern, properties, children };
|
|
2753
2826
|
}
|
|
@@ -2840,8 +2913,7 @@ function patternBindings(pattern) {
|
|
|
2840
2913
|
}
|
|
2841
2914
|
}
|
|
2842
2915
|
function assignResults(node, collect) {
|
|
2843
|
-
if (!node)
|
|
2844
|
-
return;
|
|
2916
|
+
if (!node) return;
|
|
2845
2917
|
switch (node.type) {
|
|
2846
2918
|
case "BlockStatement":
|
|
2847
2919
|
if (node.expressions.length) {
|
|
@@ -2976,8 +3048,7 @@ function assignResults(node, collect) {
|
|
|
2976
3048
|
node[1] = collect(node[1]);
|
|
2977
3049
|
}
|
|
2978
3050
|
function insertReturn(node) {
|
|
2979
|
-
if (!node)
|
|
2980
|
-
return;
|
|
3051
|
+
if (!node) return;
|
|
2981
3052
|
switch (node.type) {
|
|
2982
3053
|
case "BlockStatement": {
|
|
2983
3054
|
if (node.expressions.length) {
|
|
@@ -2994,6 +3065,7 @@ function insertReturn(node) {
|
|
|
2994
3065
|
}
|
|
2995
3066
|
return;
|
|
2996
3067
|
}
|
|
3068
|
+
// NOTE: "CaseClause"s don't get a return statement inserted
|
|
2997
3069
|
case "WhenClause": {
|
|
2998
3070
|
if (node.break) {
|
|
2999
3071
|
const breakIndex = node.children.indexOf(node.break);
|
|
@@ -3017,8 +3089,7 @@ function insertReturn(node) {
|
|
|
3017
3089
|
return;
|
|
3018
3090
|
}
|
|
3019
3091
|
}
|
|
3020
|
-
if (!Array.isArray(node))
|
|
3021
|
-
return;
|
|
3092
|
+
if (!Array.isArray(node)) return;
|
|
3022
3093
|
let [, exp, semi] = node;
|
|
3023
3094
|
if (semi?.type === "SemicolonDelimiter") {
|
|
3024
3095
|
return;
|
|
@@ -3098,14 +3169,12 @@ function insertReturn(node) {
|
|
|
3098
3169
|
}
|
|
3099
3170
|
case "IfStatement": {
|
|
3100
3171
|
insertReturn(exp.then);
|
|
3101
|
-
if (exp.else)
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
wrapWithReturn(void 0, exp, true)
|
|
3108
|
-
]);
|
|
3172
|
+
if (exp.else) insertReturn(exp.else.block);
|
|
3173
|
+
else exp.children.push([
|
|
3174
|
+
"",
|
|
3175
|
+
// NOTE: add a prefixed semicolon because the if block may not be braced
|
|
3176
|
+
wrapWithReturn(void 0, exp, true)
|
|
3177
|
+
]);
|
|
3109
3178
|
return;
|
|
3110
3179
|
}
|
|
3111
3180
|
case "PatternMatchingStatement": {
|
|
@@ -3402,6 +3471,183 @@ function processParams(f) {
|
|
|
3402
3471
|
if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
|
|
3403
3472
|
parameters.tp.parameters.push(",");
|
|
3404
3473
|
}
|
|
3474
|
+
let tt, before = [], rest, after = [];
|
|
3475
|
+
function append2(p) {
|
|
3476
|
+
(rest ? after : before).push(p);
|
|
3477
|
+
}
|
|
3478
|
+
for (let ref16 = parameters.parameters, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
|
|
3479
|
+
const param = ref16[i8];
|
|
3480
|
+
switch (param.type) {
|
|
3481
|
+
case "ThisType": {
|
|
3482
|
+
if (tt) {
|
|
3483
|
+
append2({
|
|
3484
|
+
type: "Error",
|
|
3485
|
+
message: "Only one typed this parameter is allowed"
|
|
3486
|
+
});
|
|
3487
|
+
append2(param);
|
|
3488
|
+
} else {
|
|
3489
|
+
tt = trimFirstSpace(param);
|
|
3490
|
+
if (before.length || rest) {
|
|
3491
|
+
let ref17;
|
|
3492
|
+
let delim = (ref17 = tt.children)[ref17.length - 1];
|
|
3493
|
+
if (Array.isArray(delim)) {
|
|
3494
|
+
delim = delim[delim.length - 1];
|
|
3495
|
+
}
|
|
3496
|
+
if (!(typeof delim === "object" && delim != null && "token" in delim && delim.token === ",")) {
|
|
3497
|
+
tt = {
|
|
3498
|
+
...tt,
|
|
3499
|
+
children: [...tt.children, ", "]
|
|
3500
|
+
};
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
;
|
|
3505
|
+
break;
|
|
3506
|
+
}
|
|
3507
|
+
case "FunctionRestParameter": {
|
|
3508
|
+
if (rest) {
|
|
3509
|
+
append2({
|
|
3510
|
+
type: "Error",
|
|
3511
|
+
message: "Only one rest parameter is allowed"
|
|
3512
|
+
});
|
|
3513
|
+
append2(param);
|
|
3514
|
+
} else {
|
|
3515
|
+
rest = param;
|
|
3516
|
+
}
|
|
3517
|
+
;
|
|
3518
|
+
break;
|
|
3519
|
+
}
|
|
3520
|
+
default: {
|
|
3521
|
+
append2(param);
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
parameters.names = before.flatMap(($6) => $6.names);
|
|
3526
|
+
parameters.parameters.splice(0, 1 / 0, ...[]);
|
|
3527
|
+
if (tt) {
|
|
3528
|
+
parameters.parameters.push(tt);
|
|
3529
|
+
}
|
|
3530
|
+
parameters.parameters.push(...before);
|
|
3531
|
+
if (rest) {
|
|
3532
|
+
const restIdentifier = rest.binding.ref || rest.binding;
|
|
3533
|
+
parameters.names.push(...rest.names || []);
|
|
3534
|
+
rest.children.pop();
|
|
3535
|
+
if (after.length) {
|
|
3536
|
+
if (rest.binding.type === "ArrayBindingPattern" || rest.binding.type === "ObjectBindingPattern") {
|
|
3537
|
+
parameters.parameters.push({
|
|
3538
|
+
type: "Error",
|
|
3539
|
+
message: "Non-end rest parameter cannot be binding pattern"
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3542
|
+
after = trimFirstSpace(after);
|
|
3543
|
+
const names = after.flatMap(($7) => $7.names);
|
|
3544
|
+
const elements = after.map((p) => {
|
|
3545
|
+
if (p.type === "Error") {
|
|
3546
|
+
return p;
|
|
3547
|
+
}
|
|
3548
|
+
return {
|
|
3549
|
+
...p,
|
|
3550
|
+
// omit individual argument types from output
|
|
3551
|
+
children: p.children.filter((a2) => a2 !== p.typeSuffix),
|
|
3552
|
+
type: "BindingElement"
|
|
3553
|
+
};
|
|
3554
|
+
});
|
|
3555
|
+
const pattern = gatherBindingPatternTypeSuffix(makeNode({
|
|
3556
|
+
type: "ArrayBindingPattern",
|
|
3557
|
+
elements,
|
|
3558
|
+
length: after.length,
|
|
3559
|
+
children: ["[", elements, "]"],
|
|
3560
|
+
names
|
|
3561
|
+
}));
|
|
3562
|
+
const { typeSuffix } = pattern;
|
|
3563
|
+
const blockPrefix = parameters.blockPrefix = makeNode({
|
|
3564
|
+
type: "PostRestBindingElements",
|
|
3565
|
+
children: [
|
|
3566
|
+
pattern,
|
|
3567
|
+
" = ",
|
|
3568
|
+
restIdentifier,
|
|
3569
|
+
".splice(-",
|
|
3570
|
+
after.length.toString(),
|
|
3571
|
+
")"
|
|
3572
|
+
],
|
|
3573
|
+
elements,
|
|
3574
|
+
names
|
|
3575
|
+
});
|
|
3576
|
+
if (rest.typeSuffix) {
|
|
3577
|
+
let optionalType = function(typeSuffix3, fallback) {
|
|
3578
|
+
const t2 = typeSuffix3?.t ?? fallback;
|
|
3579
|
+
if (typeSuffix3?.optional) {
|
|
3580
|
+
return [
|
|
3581
|
+
t2,
|
|
3582
|
+
{
|
|
3583
|
+
type: "Error",
|
|
3584
|
+
message: "Optional parameter not allowed in/after rest parameter"
|
|
3585
|
+
}
|
|
3586
|
+
];
|
|
3587
|
+
}
|
|
3588
|
+
return t2;
|
|
3589
|
+
};
|
|
3590
|
+
const ref = makeRef("rest");
|
|
3591
|
+
const restRef = [
|
|
3592
|
+
{ children: [ref], ts: true },
|
|
3593
|
+
{ children: [restIdentifier], js: true }
|
|
3594
|
+
];
|
|
3595
|
+
blockPrefix.children[blockPrefix.children.indexOf(restIdentifier)] = restRef;
|
|
3596
|
+
blockPrefix.children.push({
|
|
3597
|
+
ts: true,
|
|
3598
|
+
children: [
|
|
3599
|
+
", ",
|
|
3600
|
+
restIdentifier,
|
|
3601
|
+
" = ",
|
|
3602
|
+
ref,
|
|
3603
|
+
" as ",
|
|
3604
|
+
trimFirstSpace(rest.typeSuffix.t)
|
|
3605
|
+
]
|
|
3606
|
+
});
|
|
3607
|
+
const bindingIndex = rest.rest.children.indexOf(rest.rest.binding);
|
|
3608
|
+
assert.notEqual(bindingIndex, -1, "Could not find binding in rest parameter");
|
|
3609
|
+
rest.rest.children[bindingIndex] = rest.rest.binding = { ...rest.rest.binding, js: true };
|
|
3610
|
+
rest.rest.children.splice(bindingIndex + 1, 0, {
|
|
3611
|
+
children: [ref],
|
|
3612
|
+
ts: true
|
|
3613
|
+
});
|
|
3614
|
+
const oldSuffix = rest.typeSuffix;
|
|
3615
|
+
const colon = oldSuffix.colon ?? ": ";
|
|
3616
|
+
const afterTypes = after.flatMap((p) => {
|
|
3617
|
+
return [",", optionalType(p.typeSuffix, " unknown")];
|
|
3618
|
+
});
|
|
3619
|
+
const t = [
|
|
3620
|
+
"[",
|
|
3621
|
+
"...",
|
|
3622
|
+
optionalType(oldSuffix, "unknown[]"),
|
|
3623
|
+
...afterTypes,
|
|
3624
|
+
"]"
|
|
3625
|
+
];
|
|
3626
|
+
const typeSuffix2 = makeNode({
|
|
3627
|
+
type: "TypeSuffix",
|
|
3628
|
+
ts: true,
|
|
3629
|
+
colon,
|
|
3630
|
+
t,
|
|
3631
|
+
children: [
|
|
3632
|
+
...oldSuffix.children.filter(($8) => (
|
|
3633
|
+
// spaces and colon
|
|
3634
|
+
$8 !== oldSuffix.optional && $8 !== oldSuffix.t
|
|
3635
|
+
)),
|
|
3636
|
+
!oldSuffix.colon ? colon : void 0,
|
|
3637
|
+
t
|
|
3638
|
+
]
|
|
3639
|
+
});
|
|
3640
|
+
const suffixIndex = rest.children.indexOf(rest.typeSuffix);
|
|
3641
|
+
assert.notEqual(suffixIndex, -1, "Could not find typeSuffix in rest parameter");
|
|
3642
|
+
rest.children[suffixIndex] = rest.typeSuffix = typeSuffix2;
|
|
3643
|
+
blockPrefix.children.splice(-1, 0, {
|
|
3644
|
+
ts: true,
|
|
3645
|
+
children: [" as [", afterTypes.slice(1), "]"]
|
|
3646
|
+
});
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
parameters.parameters.push(rest);
|
|
3650
|
+
}
|
|
3405
3651
|
if (!block) {
|
|
3406
3652
|
return;
|
|
3407
3653
|
}
|
|
@@ -3416,28 +3662,29 @@ function processParams(f) {
|
|
|
3416
3662
|
indent = expressions[0][0];
|
|
3417
3663
|
}
|
|
3418
3664
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
3419
|
-
injectParamProps: isConstructor
|
|
3665
|
+
injectParamProps: isConstructor,
|
|
3666
|
+
assignPins: true
|
|
3420
3667
|
});
|
|
3421
3668
|
if (isConstructor) {
|
|
3422
|
-
const { ancestor } = findAncestor(f, ($
|
|
3669
|
+
const { ancestor } = findAncestor(f, ($9) => $9.type === "ClassExpression");
|
|
3423
3670
|
if (ancestor != null) {
|
|
3424
|
-
const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($
|
|
3671
|
+
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));
|
|
3425
3672
|
const classExpressions = ancestor.body.expressions;
|
|
3426
|
-
let
|
|
3427
|
-
assert.notEqual(
|
|
3673
|
+
let index2 = findChildIndex(classExpressions, f);
|
|
3674
|
+
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3428
3675
|
let m4;
|
|
3429
|
-
while (m4 = classExpressions[
|
|
3430
|
-
|
|
3676
|
+
while (m4 = classExpressions[index2 - 1]?.[1], typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "MethodDefinition" && "name" in m4 && m4.name === "constructor") {
|
|
3677
|
+
index2--;
|
|
3431
3678
|
}
|
|
3432
|
-
const fStatement = classExpressions[
|
|
3433
|
-
for (let
|
|
3434
|
-
const parameter =
|
|
3679
|
+
const fStatement = classExpressions[index2];
|
|
3680
|
+
for (let ref18 = gatherRecursive(parameters, ($13) => $13.type === "Parameter"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
|
|
3681
|
+
const parameter = ref18[i9];
|
|
3435
3682
|
const { accessModifier } = parameter;
|
|
3436
3683
|
if (!(accessModifier || parameter.typeSuffix)) {
|
|
3437
3684
|
continue;
|
|
3438
3685
|
}
|
|
3439
|
-
for (let
|
|
3440
|
-
const binding =
|
|
3686
|
+
for (let ref19 = gatherRecursive(parameter, ($14) => $14.type === "AtBinding"), i10 = 0, len9 = ref19.length; i10 < len9; i10++) {
|
|
3687
|
+
const binding = ref19[i10];
|
|
3441
3688
|
const typeSuffix = binding.parent?.typeSuffix;
|
|
3442
3689
|
if (!(accessModifier || typeSuffix)) {
|
|
3443
3690
|
continue;
|
|
@@ -3450,7 +3697,7 @@ function processParams(f) {
|
|
|
3450
3697
|
if (fields.has(id)) {
|
|
3451
3698
|
continue;
|
|
3452
3699
|
}
|
|
3453
|
-
classExpressions.splice(
|
|
3700
|
+
classExpressions.splice(index2++, 0, [fStatement[0], {
|
|
3454
3701
|
type: "FieldDefinition",
|
|
3455
3702
|
id,
|
|
3456
3703
|
typeSuffix,
|
|
@@ -3465,34 +3712,53 @@ function processParams(f) {
|
|
|
3465
3712
|
type: "SemicolonDelimiter",
|
|
3466
3713
|
children: [";"]
|
|
3467
3714
|
};
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3715
|
+
let prefix = [];
|
|
3716
|
+
for (let ref20 = splices, i11 = 0, len10 = ref20.length; i11 < len10; i11++) {
|
|
3717
|
+
const binding = ref20[i11];
|
|
3718
|
+
assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
|
|
3719
|
+
prefix.push(makeNode({
|
|
3720
|
+
type: "Declaration",
|
|
3721
|
+
children: ["let ", binding],
|
|
3722
|
+
names: binding.names,
|
|
3723
|
+
bindings: [],
|
|
3724
|
+
// avoid implicit return of any bindings
|
|
3725
|
+
decl: "let"
|
|
3726
|
+
}));
|
|
3727
|
+
}
|
|
3728
|
+
concatAssign(prefix, thisAssignments);
|
|
3729
|
+
prefix = prefix.map((s) => s?.js ? ["", makeNode({
|
|
3730
|
+
// TODO: figure out how to get JS only statement tuples
|
|
3731
|
+
...s,
|
|
3732
|
+
children: [indent, ...s.children, delimiter]
|
|
3733
|
+
})] : [indent, s, delimiter]);
|
|
3475
3734
|
if (!prefix.length) {
|
|
3476
3735
|
return;
|
|
3477
3736
|
}
|
|
3737
|
+
let index = -1;
|
|
3478
3738
|
if (isConstructor) {
|
|
3479
|
-
|
|
3480
|
-
expressions,
|
|
3481
|
-
(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"
|
|
3482
|
-
);
|
|
3483
|
-
if (superCalls.length) {
|
|
3484
|
-
const { child } = findAncestor(superCalls[0], (a4) => a4 === block);
|
|
3485
|
-
const index = findChildIndex(expressions, child);
|
|
3486
|
-
if (index < 0) {
|
|
3487
|
-
throw new Error("Could not find super call within top-level expressions");
|
|
3488
|
-
}
|
|
3489
|
-
expressions.splice(index + 1, 0, ...prefix);
|
|
3490
|
-
return;
|
|
3491
|
-
}
|
|
3739
|
+
index = findSuperCall(block);
|
|
3492
3740
|
}
|
|
3493
|
-
expressions.
|
|
3741
|
+
expressions.splice(index + 1, 0, ...prefix);
|
|
3742
|
+
updateParentPointers(block);
|
|
3494
3743
|
braceBlock(block);
|
|
3495
3744
|
}
|
|
3745
|
+
function findSuperCall(block) {
|
|
3746
|
+
const { expressions } = block;
|
|
3747
|
+
const superCalls = gatherNodes(
|
|
3748
|
+
expressions,
|
|
3749
|
+
(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"
|
|
3750
|
+
);
|
|
3751
|
+
if (superCalls.length) {
|
|
3752
|
+
const { child } = findAncestor(superCalls[0], (a5) => a5 === block);
|
|
3753
|
+
const index = findChildIndex(expressions, child);
|
|
3754
|
+
if (index < 0) {
|
|
3755
|
+
throw new Error("Could not find super call within top-level expressions");
|
|
3756
|
+
}
|
|
3757
|
+
return index;
|
|
3758
|
+
} else {
|
|
3759
|
+
return -1;
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3496
3762
|
function processSignature(f) {
|
|
3497
3763
|
const { block, signature } = f;
|
|
3498
3764
|
if (!f.async?.length && hasAwait(block)) {
|
|
@@ -3500,8 +3766,8 @@ function processSignature(f) {
|
|
|
3500
3766
|
f.async.push("async ");
|
|
3501
3767
|
signature.modifier.async = true;
|
|
3502
3768
|
} else {
|
|
3503
|
-
for (let
|
|
3504
|
-
const a =
|
|
3769
|
+
for (let ref21 = gatherRecursiveWithinFunction(block, ($15) => $15.type === "Await"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
|
|
3770
|
+
const a = ref21[i12];
|
|
3505
3771
|
const i = findChildIndex(a.parent, a);
|
|
3506
3772
|
a.parent.children.splice(i + 1, 0, {
|
|
3507
3773
|
type: "Error",
|
|
@@ -3515,9 +3781,9 @@ function processSignature(f) {
|
|
|
3515
3781
|
f.generator.push("*");
|
|
3516
3782
|
signature.modifier.generator = true;
|
|
3517
3783
|
} else {
|
|
3518
|
-
for (let
|
|
3519
|
-
const y =
|
|
3520
|
-
const i = y.children.findIndex(($
|
|
3784
|
+
for (let ref22 = gatherRecursiveWithinFunction(block, ($16) => $16.type === "YieldExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
|
|
3785
|
+
const y = ref22[i13];
|
|
3786
|
+
const i = y.children.findIndex(($17) => $17.type === "Yield");
|
|
3521
3787
|
y.children.splice(i + 1, 0, {
|
|
3522
3788
|
type: "Error",
|
|
3523
3789
|
message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
|
|
@@ -3530,8 +3796,8 @@ function processSignature(f) {
|
|
|
3530
3796
|
}
|
|
3531
3797
|
}
|
|
3532
3798
|
function processFunctions(statements, config2) {
|
|
3533
|
-
for (let
|
|
3534
|
-
const f =
|
|
3799
|
+
for (let ref23 = gatherRecursiveAll(statements, ($18) => $18.type === "FunctionExpression" || $18.type === "ArrowFunction" || $18.type === "MethodDefinition"), i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
|
|
3800
|
+
const f = ref23[i14];
|
|
3535
3801
|
if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
|
|
3536
3802
|
implicitFunctionBlock(f);
|
|
3537
3803
|
}
|
|
@@ -3587,9 +3853,9 @@ function expressionizeIteration(exp) {
|
|
|
3587
3853
|
}
|
|
3588
3854
|
let done;
|
|
3589
3855
|
if (!async) {
|
|
3590
|
-
let
|
|
3591
|
-
if ((
|
|
3592
|
-
const { block: parentBlock, index } =
|
|
3856
|
+
let ref24;
|
|
3857
|
+
if ((ref24 = blockContainingStatement(exp)) && typeof ref24 === "object" && "block" in ref24 && "index" in ref24) {
|
|
3858
|
+
const { block: parentBlock, index } = ref24;
|
|
3593
3859
|
statements[0][0] = parentBlock.expressions[index][0];
|
|
3594
3860
|
parentBlock.expressions.splice(index, index + 1 - index, ...statements);
|
|
3595
3861
|
updateParentPointers(parentBlock);
|
|
@@ -3606,8 +3872,8 @@ function expressionizeIteration(exp) {
|
|
|
3606
3872
|
}
|
|
3607
3873
|
}
|
|
3608
3874
|
function processIterationExpressions(statements) {
|
|
3609
|
-
for (let
|
|
3610
|
-
const s =
|
|
3875
|
+
for (let ref25 = gatherRecursiveAll(statements, ($19) => $19.type === "IterationExpression"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
|
|
3876
|
+
const s = ref25[i15];
|
|
3611
3877
|
expressionizeIteration(s);
|
|
3612
3878
|
}
|
|
3613
3879
|
}
|
|
@@ -3628,38 +3894,40 @@ function processCoffeeDo(ws, expression) {
|
|
|
3628
3894
|
ws = trimFirstSpace(ws);
|
|
3629
3895
|
const args = [];
|
|
3630
3896
|
if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
|
|
3631
|
-
|
|
3897
|
+
let { parameters } = expression;
|
|
3898
|
+
const parameterList = parameters.parameters;
|
|
3899
|
+
const results1 = [];
|
|
3900
|
+
for (let i16 = 0, len15 = parameterList.length; i16 < len15; i16++) {
|
|
3901
|
+
let parameter = parameterList[i16];
|
|
3902
|
+
if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
|
|
3903
|
+
let ref26;
|
|
3904
|
+
if (ref26 = parameter.initializer) {
|
|
3905
|
+
const initializer = ref26;
|
|
3906
|
+
args.push(initializer.expression, parameter.delim);
|
|
3907
|
+
parameter = {
|
|
3908
|
+
...parameter,
|
|
3909
|
+
initializer: void 0,
|
|
3910
|
+
children: parameter.children.filter((a6) => a6 !== initializer)
|
|
3911
|
+
};
|
|
3912
|
+
} else {
|
|
3913
|
+
args.push(parameter.children.filter(
|
|
3914
|
+
(a7) => a7 !== parameter.typeSuffix
|
|
3915
|
+
));
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
results1.push(parameter);
|
|
3919
|
+
}
|
|
3920
|
+
;
|
|
3921
|
+
const newParameterList = results1;
|
|
3632
3922
|
const newParameters = {
|
|
3633
3923
|
...parameters,
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
for (let ref23 = parameters.children, i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
|
|
3637
|
-
let parameter = ref23[i14];
|
|
3638
|
-
if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
|
|
3639
|
-
let ref24;
|
|
3640
|
-
if (ref24 = parameter.initializer) {
|
|
3641
|
-
const initializer = ref24;
|
|
3642
|
-
args.push(initializer.expression, parameter.delim);
|
|
3643
|
-
parameter = {
|
|
3644
|
-
...parameter,
|
|
3645
|
-
initializer: void 0,
|
|
3646
|
-
children: parameter.children.filter((a5) => a5 !== initializer)
|
|
3647
|
-
};
|
|
3648
|
-
} else {
|
|
3649
|
-
args.push(parameter.children.filter(
|
|
3650
|
-
(a6) => a6 !== parameter.typeSuffix
|
|
3651
|
-
));
|
|
3652
|
-
}
|
|
3653
|
-
}
|
|
3654
|
-
results1.push(parameter);
|
|
3655
|
-
}
|
|
3656
|
-
return results1;
|
|
3657
|
-
})()
|
|
3924
|
+
parameters: newParameterList,
|
|
3925
|
+
children: parameters.children.map(($20) => $20 === parameterList ? newParameterList : $20)
|
|
3658
3926
|
};
|
|
3659
3927
|
expression = {
|
|
3660
3928
|
...expression,
|
|
3661
3929
|
parameters: newParameters,
|
|
3662
|
-
children: expression.children.map(($
|
|
3930
|
+
children: expression.children.map(($21) => $21 === parameters ? newParameters : $21)
|
|
3663
3931
|
};
|
|
3664
3932
|
}
|
|
3665
3933
|
return {
|
|
@@ -3681,12 +3949,16 @@ function makeAmpersandFunction(rhs) {
|
|
|
3681
3949
|
ref = makeRef("$");
|
|
3682
3950
|
inplacePrepend(ref, body);
|
|
3683
3951
|
}
|
|
3684
|
-
if (startsWithPredicate(body, ($
|
|
3952
|
+
if (startsWithPredicate(body, ($22) => $22.type === "ObjectExpression")) {
|
|
3685
3953
|
body = makeLeftHandSideExpression(body);
|
|
3686
3954
|
}
|
|
3955
|
+
const parameterList = [
|
|
3956
|
+
typeSuffix ? [ref, typeSuffix] : ref
|
|
3957
|
+
];
|
|
3687
3958
|
const parameters = makeNode({
|
|
3688
3959
|
type: "Parameters",
|
|
3689
|
-
children: typeSuffix ? ["(",
|
|
3960
|
+
children: typeSuffix ? ["(", parameterList, ")"] : [parameterList],
|
|
3961
|
+
parameters: parameterList,
|
|
3690
3962
|
names: []
|
|
3691
3963
|
});
|
|
3692
3964
|
const expressions = [[" ", body]];
|
|
@@ -3720,14 +3992,14 @@ function makeAmpersandFunction(rhs) {
|
|
|
3720
3992
|
}
|
|
3721
3993
|
if (gatherRecursiveWithinFunction(
|
|
3722
3994
|
block,
|
|
3723
|
-
(
|
|
3995
|
+
(a8) => a8 === ref
|
|
3724
3996
|
).length > 1) {
|
|
3725
3997
|
fn.ampersandBlock = false;
|
|
3726
3998
|
}
|
|
3727
3999
|
return fn;
|
|
3728
4000
|
}
|
|
3729
4001
|
|
|
3730
|
-
// source
|
|
4002
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
|
|
3731
4003
|
function blockWithPrefix(prefixStatements, block) {
|
|
3732
4004
|
if (prefixStatements && prefixStatements.length) {
|
|
3733
4005
|
const expressions = [...prefixStatements, ...block.expressions];
|
|
@@ -3814,10 +4086,8 @@ function getIndent(statement) {
|
|
|
3814
4086
|
if (Array.isArray(indent)) {
|
|
3815
4087
|
indent = indent.flat(Infinity);
|
|
3816
4088
|
return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
|
|
3817
|
-
if (typeof n === "string")
|
|
3818
|
-
|
|
3819
|
-
if (n.token != null)
|
|
3820
|
-
return n.token;
|
|
4089
|
+
if (typeof n === "string") return n;
|
|
4090
|
+
if (n.token != null) return n.token;
|
|
3821
4091
|
return "";
|
|
3822
4092
|
});
|
|
3823
4093
|
}
|
|
@@ -3945,7 +4215,7 @@ function blockContainingStatement(exp) {
|
|
|
3945
4215
|
};
|
|
3946
4216
|
}
|
|
3947
4217
|
|
|
3948
|
-
// source
|
|
4218
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
|
|
3949
4219
|
var precedenceOrder = [
|
|
3950
4220
|
["||", "??"],
|
|
3951
4221
|
["^^"],
|
|
@@ -4009,7 +4279,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4009
4279
|
while (i < expandedOps.length) {
|
|
4010
4280
|
let op = expandedOps[i];
|
|
4011
4281
|
if (op.special) {
|
|
4012
|
-
let
|
|
4282
|
+
let advanceLeft = function(allowEqual) {
|
|
4013
4283
|
while (start >= 4) {
|
|
4014
4284
|
const prevPrec = getPrecedence(expandedOps[start - 2]);
|
|
4015
4285
|
if (!(prevPrec > prec || allowEqual && prevPrec === prec)) {
|
|
@@ -4018,7 +4288,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4018
4288
|
start -= 4;
|
|
4019
4289
|
}
|
|
4020
4290
|
return false;
|
|
4021
|
-
},
|
|
4291
|
+
}, advanceRight = function(allowEqual) {
|
|
4022
4292
|
while (end + 4 < expandedOps.length) {
|
|
4023
4293
|
const nextPrec = getPrecedence(expandedOps[end + 2]);
|
|
4024
4294
|
if (!(nextPrec > prec || allowEqual && nextPrec === prec)) {
|
|
@@ -4028,24 +4298,23 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4028
4298
|
}
|
|
4029
4299
|
return false;
|
|
4030
4300
|
};
|
|
4031
|
-
var advanceLeft = advanceLeft2, advanceRight = advanceRight2;
|
|
4032
4301
|
let start = i - 2, end = i + 2;
|
|
4033
4302
|
const prec = getPrecedence(op);
|
|
4034
4303
|
let error;
|
|
4035
4304
|
switch (op.assoc) {
|
|
4036
4305
|
case "left":
|
|
4037
4306
|
case void 0: {
|
|
4038
|
-
|
|
4039
|
-
|
|
4307
|
+
advanceLeft(true);
|
|
4308
|
+
advanceRight(false);
|
|
4040
4309
|
break;
|
|
4041
4310
|
}
|
|
4042
4311
|
case "right": {
|
|
4043
|
-
|
|
4044
|
-
|
|
4312
|
+
advanceLeft(false);
|
|
4313
|
+
advanceRight(true);
|
|
4045
4314
|
break;
|
|
4046
4315
|
}
|
|
4047
4316
|
case "non": {
|
|
4048
|
-
if (
|
|
4317
|
+
if (advanceLeft(false) || advanceRight(false)) {
|
|
4049
4318
|
error = {
|
|
4050
4319
|
type: "Error",
|
|
4051
4320
|
message: `non-associative operator ${op.token} used at same precedence level without parenthesization`
|
|
@@ -4055,13 +4324,13 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4055
4324
|
break;
|
|
4056
4325
|
}
|
|
4057
4326
|
case "arguments": {
|
|
4058
|
-
if (
|
|
4327
|
+
if (advanceLeft(false)) {
|
|
4059
4328
|
error = {
|
|
4060
4329
|
type: "Error",
|
|
4061
4330
|
message: `arguments operator ${op.token} used at same precedence level as ${expandedOps[start - 2].token} to the left`
|
|
4062
4331
|
};
|
|
4063
4332
|
}
|
|
4064
|
-
|
|
4333
|
+
advanceRight(true);
|
|
4065
4334
|
break;
|
|
4066
4335
|
}
|
|
4067
4336
|
default: {
|
|
@@ -4145,13 +4414,11 @@ function processExpandedBinaryOpExpression(expandedOps) {
|
|
|
4145
4414
|
type = "CallExpression";
|
|
4146
4415
|
} else if (op.token) {
|
|
4147
4416
|
children = [a, wsOp, op, wsB, b];
|
|
4148
|
-
if (op.negated)
|
|
4149
|
-
children = ["(", ...children, ")"];
|
|
4417
|
+
if (op.negated) children = ["(", ...children, ")"];
|
|
4150
4418
|
} else {
|
|
4151
4419
|
throw new Error("Unknown operator: " + JSON.stringify(op));
|
|
4152
4420
|
}
|
|
4153
|
-
if (op.negated)
|
|
4154
|
-
children.unshift("!");
|
|
4421
|
+
if (op.negated) children.unshift("!");
|
|
4155
4422
|
if (error != null) {
|
|
4156
4423
|
children.push(error);
|
|
4157
4424
|
}
|
|
@@ -4284,7 +4551,7 @@ function expandChainedComparisons([first, binops]) {
|
|
|
4284
4551
|
}
|
|
4285
4552
|
}
|
|
4286
4553
|
|
|
4287
|
-
// source
|
|
4554
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
|
|
4288
4555
|
function processPatternTest(lhs, patterns) {
|
|
4289
4556
|
const { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m");
|
|
4290
4557
|
const conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
|
|
@@ -4406,8 +4673,7 @@ function processPatternMatching(statements) {
|
|
|
4406
4673
|
});
|
|
4407
4674
|
}
|
|
4408
4675
|
function getPatternConditions(pattern, ref, conditions = []) {
|
|
4409
|
-
if (pattern.rest)
|
|
4410
|
-
return conditions;
|
|
4676
|
+
if (pattern.rest) return conditions;
|
|
4411
4677
|
switch (pattern.type) {
|
|
4412
4678
|
case "ArrayBindingPattern": {
|
|
4413
4679
|
const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), l = (length - +hasRest).toString(), lengthCheck = hasRest ? [ref, ".length >= ", l] : [getHelperRef("len"), "(", ref, ", ", l, ")"];
|
|
@@ -4518,7 +4784,7 @@ function getPatternConditions(pattern, ref, conditions = []) {
|
|
|
4518
4784
|
}
|
|
4519
4785
|
return conditions;
|
|
4520
4786
|
}
|
|
4521
|
-
function getPatternBlockPrefix(pattern, ref, decl = "const ",
|
|
4787
|
+
function getPatternBlockPrefix(pattern, ref, decl = "const ", typeSuffix) {
|
|
4522
4788
|
switch (pattern.type) {
|
|
4523
4789
|
case "ArrayBindingPattern": {
|
|
4524
4790
|
if (!pattern.length) {
|
|
@@ -4549,7 +4815,7 @@ function getPatternBlockPrefix(pattern, ref, decl = "const ", suffix) {
|
|
|
4549
4815
|
return [
|
|
4550
4816
|
["", {
|
|
4551
4817
|
type: "Declaration",
|
|
4552
|
-
children: [decl, patternBindings2,
|
|
4818
|
+
children: [decl, patternBindings2, typeSuffix, " = ", ref, ...splices],
|
|
4553
4819
|
names: [],
|
|
4554
4820
|
bindings: []
|
|
4555
4821
|
// avoid implicit return of any bindings
|
|
@@ -4738,7 +5004,7 @@ function aliasBinding(p, ref) {
|
|
|
4738
5004
|
}
|
|
4739
5005
|
}
|
|
4740
5006
|
|
|
4741
|
-
// source
|
|
5007
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
|
|
4742
5008
|
function len2(arr, length) {
|
|
4743
5009
|
return arr.length === length;
|
|
4744
5010
|
}
|
|
@@ -4782,21 +5048,51 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
|
|
|
4782
5048
|
});
|
|
4783
5049
|
}
|
|
4784
5050
|
function processDeclarations(statements) {
|
|
4785
|
-
gatherRecursiveAll(statements, ($) => $.type === "Declaration").
|
|
4786
|
-
const
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
5051
|
+
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len1 = ref1.length; i1 < len1; i1++) {
|
|
5052
|
+
const declaration = ref1[i1];
|
|
5053
|
+
const { bindings } = declaration;
|
|
5054
|
+
if (!(bindings != null)) {
|
|
5055
|
+
continue;
|
|
5056
|
+
}
|
|
5057
|
+
for (let i2 = 0, len22 = bindings.length; i2 < len22; i2++) {
|
|
5058
|
+
const binding = bindings[i2];
|
|
5059
|
+
let { typeSuffix, initializer } = binding;
|
|
5060
|
+
if (typeSuffix && typeSuffix.optional) {
|
|
5061
|
+
if (initializer && !typeSuffix.t) {
|
|
5062
|
+
const expression = trimFirstSpace(initializer.expression);
|
|
5063
|
+
let m;
|
|
5064
|
+
if (m = expression.type, m === "Identifier" || m === "MemberExpression") {
|
|
5065
|
+
typeSuffix.children.push(": ", typeSuffix.t = {
|
|
5066
|
+
type: "TypeTypeof",
|
|
5067
|
+
children: ["typeof ", expression],
|
|
5068
|
+
expression
|
|
5069
|
+
});
|
|
5070
|
+
} else if (expression.type === "Literal" || expression.type === "RegularExpressionLiteral" || expression.type === "TemplateLiteral") {
|
|
5071
|
+
typeSuffix.children.push(": ", typeSuffix.t = literalType(expression));
|
|
5072
|
+
} else {
|
|
5073
|
+
spliceChild(binding, typeSuffix, 1, {
|
|
5074
|
+
type: "Error",
|
|
5075
|
+
message: `Optional type can only be inferred from literals or member expressions, not ${expression.type}`
|
|
5076
|
+
});
|
|
5077
|
+
continue;
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
if (typeSuffix.t) {
|
|
5081
|
+
convertOptionalType(typeSuffix);
|
|
5082
|
+
} else {
|
|
5083
|
+
spliceChild(binding, typeSuffix, 1);
|
|
5084
|
+
binding.children.push(initializer = binding.initializer = {
|
|
5085
|
+
type: "Initializer",
|
|
5086
|
+
expression: "undefined",
|
|
5087
|
+
children: [" = ", "undefined"]
|
|
5088
|
+
});
|
|
5089
|
+
}
|
|
4791
5090
|
}
|
|
4792
|
-
const { initializer } = binding;
|
|
4793
5091
|
if (initializer) {
|
|
4794
|
-
|
|
5092
|
+
prependStatementExpressionBlock(initializer, declaration);
|
|
4795
5093
|
}
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
});
|
|
4799
|
-
});
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
4800
5096
|
}
|
|
4801
5097
|
function prependStatementExpressionBlock(initializer, statement) {
|
|
4802
5098
|
let { expression: exp } = initializer;
|
|
@@ -4958,16 +5254,16 @@ function processDeclarationConditionStatement(s) {
|
|
|
4958
5254
|
if (conditions.length) {
|
|
4959
5255
|
let children = condition.children;
|
|
4960
5256
|
if (s.negated) {
|
|
4961
|
-
let
|
|
4962
|
-
if (!(
|
|
5257
|
+
let m1;
|
|
5258
|
+
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")) {
|
|
4963
5259
|
throw new Error("Unsupported negated condition");
|
|
4964
5260
|
}
|
|
4965
5261
|
;
|
|
4966
5262
|
({ children } = condition.expression.children[1]);
|
|
4967
5263
|
}
|
|
4968
5264
|
children.unshift("(");
|
|
4969
|
-
for (let
|
|
4970
|
-
const c = conditions[
|
|
5265
|
+
for (let i3 = 0, len3 = conditions.length; i3 < len3; i3++) {
|
|
5266
|
+
const c = conditions[i3];
|
|
4971
5267
|
children.push(" && ", c);
|
|
4972
5268
|
}
|
|
4973
5269
|
children.push(")");
|
|
@@ -4989,11 +5285,11 @@ function processDeclarationConditionStatement(s) {
|
|
|
4989
5285
|
ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
|
|
4990
5286
|
updateParentPointers(ancestor);
|
|
4991
5287
|
braceBlock(ancestor);
|
|
4992
|
-
let
|
|
5288
|
+
let ref2;
|
|
4993
5289
|
switch (s.type) {
|
|
4994
5290
|
case "IfStatement": {
|
|
4995
|
-
if (
|
|
4996
|
-
const elseBlock =
|
|
5291
|
+
if (ref2 = s.else?.block) {
|
|
5292
|
+
const elseBlock = ref2;
|
|
4997
5293
|
if (elseBlock.bare && !elseBlock.semicolon) {
|
|
4998
5294
|
elseBlock.children.push(elseBlock.semicolon = ";");
|
|
4999
5295
|
}
|
|
@@ -5084,11 +5380,12 @@ function processDeclarationConditionStatement(s) {
|
|
|
5084
5380
|
function dynamizeFromClause(from) {
|
|
5085
5381
|
from = from.slice(1);
|
|
5086
5382
|
from = trimFirstSpace(from);
|
|
5087
|
-
let
|
|
5088
|
-
if (
|
|
5089
|
-
const assert2 =
|
|
5090
|
-
let
|
|
5091
|
-
|
|
5383
|
+
let ref3;
|
|
5384
|
+
if (ref3 = from[from.length - 1]?.assertion) {
|
|
5385
|
+
const assert2 = ref3;
|
|
5386
|
+
let ref4;
|
|
5387
|
+
ref4 = from[from.length - 1];
|
|
5388
|
+
ref4.children = ref4.children.filter((a2) => a2 !== assert2);
|
|
5092
5389
|
from.push(", {", assert2.keyword, ":", assert2.object, "}");
|
|
5093
5390
|
}
|
|
5094
5391
|
return ["(", ...from, ")"];
|
|
@@ -5097,20 +5394,20 @@ function dynamizeImportDeclaration(decl) {
|
|
|
5097
5394
|
const { imports } = decl;
|
|
5098
5395
|
let { star, binding, specifiers } = imports;
|
|
5099
5396
|
const justDefault = binding && !specifiers && !star;
|
|
5100
|
-
let
|
|
5397
|
+
let ref5;
|
|
5101
5398
|
{
|
|
5102
5399
|
if (binding) {
|
|
5103
5400
|
if (specifiers) {
|
|
5104
|
-
|
|
5401
|
+
ref5 = makeRef();
|
|
5105
5402
|
} else {
|
|
5106
|
-
|
|
5403
|
+
ref5 = binding;
|
|
5107
5404
|
}
|
|
5108
5405
|
} else {
|
|
5109
|
-
|
|
5406
|
+
ref5 = convertNamedImportsToObject(imports, true);
|
|
5110
5407
|
}
|
|
5111
5408
|
}
|
|
5112
5409
|
;
|
|
5113
|
-
const pattern =
|
|
5410
|
+
const pattern = ref5;
|
|
5114
5411
|
const c = "const";
|
|
5115
5412
|
const expression = [
|
|
5116
5413
|
justDefault ? "(" : void 0,
|
|
@@ -5233,7 +5530,7 @@ function convertWithClause(withClause, extendsClause) {
|
|
|
5233
5530
|
return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
|
|
5234
5531
|
}
|
|
5235
5532
|
|
|
5236
|
-
// source
|
|
5533
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
|
|
5237
5534
|
function processUnaryExpression(pre, exp, post) {
|
|
5238
5535
|
if (!(pre.length || post)) {
|
|
5239
5536
|
return exp;
|
|
@@ -5395,7 +5692,7 @@ function processUnaryNestedExpression(pre, args, post) {
|
|
|
5395
5692
|
return processUnaryExpression(pre, args, post);
|
|
5396
5693
|
}
|
|
5397
5694
|
|
|
5398
|
-
// source
|
|
5695
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
|
|
5399
5696
|
function constructInvocation(fn, arg) {
|
|
5400
5697
|
let expr = fn.expr;
|
|
5401
5698
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -5418,11 +5715,9 @@ function constructInvocation(fn, arg) {
|
|
|
5418
5715
|
lhs = makeLeftHandSideExpression(lhs);
|
|
5419
5716
|
}
|
|
5420
5717
|
let comment = skipIfOnlyWS(fn.trailingComment);
|
|
5421
|
-
if (comment)
|
|
5422
|
-
lhs.children.push(comment);
|
|
5718
|
+
if (comment) lhs.children.push(comment);
|
|
5423
5719
|
comment = skipIfOnlyWS(fn.leadingComment);
|
|
5424
|
-
if (comment)
|
|
5425
|
-
lhs.children.splice(1, 0, comment);
|
|
5720
|
+
if (comment) lhs.children.splice(1, 0, comment);
|
|
5426
5721
|
switch (arg.type) {
|
|
5427
5722
|
case "CommaExpression": {
|
|
5428
5723
|
arg = makeLeftHandSideExpression(arg);
|
|
@@ -5511,27 +5806,26 @@ function processPipelineExpressions(statements) {
|
|
|
5511
5806
|
let initRef;
|
|
5512
5807
|
if (i2 === 0) {
|
|
5513
5808
|
checkValidLHS(arg);
|
|
5514
|
-
outer:
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
if (arg.children.length <= 2) {
|
|
5518
|
-
break;
|
|
5519
|
-
}
|
|
5520
|
-
}
|
|
5521
|
-
case "CallExpression": {
|
|
5522
|
-
const access = arg.children.pop();
|
|
5523
|
-
usingRef = makeRef();
|
|
5524
|
-
initRef = {
|
|
5525
|
-
type: "AssignmentExpression",
|
|
5526
|
-
children: [usingRef, " = ", arg, comma]
|
|
5527
|
-
};
|
|
5528
|
-
arg = {
|
|
5529
|
-
type: "MemberExpression",
|
|
5530
|
-
children: [usingRef, access]
|
|
5531
|
-
};
|
|
5809
|
+
outer: switch (arg.type) {
|
|
5810
|
+
case "MemberExpression": {
|
|
5811
|
+
if (arg.children.length <= 2) {
|
|
5532
5812
|
break;
|
|
5533
5813
|
}
|
|
5534
5814
|
}
|
|
5815
|
+
case "CallExpression": {
|
|
5816
|
+
const access = arg.children.pop();
|
|
5817
|
+
usingRef = makeRef();
|
|
5818
|
+
initRef = {
|
|
5819
|
+
type: "AssignmentExpression",
|
|
5820
|
+
children: [usingRef, " = ", arg, comma]
|
|
5821
|
+
};
|
|
5822
|
+
arg = {
|
|
5823
|
+
type: "MemberExpression",
|
|
5824
|
+
children: [usingRef, access]
|
|
5825
|
+
};
|
|
5826
|
+
break;
|
|
5827
|
+
}
|
|
5828
|
+
}
|
|
5535
5829
|
const lhs = [[
|
|
5536
5830
|
[initRef],
|
|
5537
5831
|
arg,
|
|
@@ -5559,8 +5853,7 @@ function processPipelineExpressions(statements) {
|
|
|
5559
5853
|
});
|
|
5560
5854
|
}
|
|
5561
5855
|
} else {
|
|
5562
|
-
if (i2 === 0)
|
|
5563
|
-
s.children = children;
|
|
5856
|
+
if (i2 === 0) s.children = children;
|
|
5564
5857
|
}
|
|
5565
5858
|
if (returns && (ref = needsRef(arg))) {
|
|
5566
5859
|
usingRef = usingRef || ref;
|
|
@@ -5624,7 +5917,7 @@ function processPipelineExpressions(statements) {
|
|
|
5624
5917
|
});
|
|
5625
5918
|
}
|
|
5626
5919
|
|
|
5627
|
-
// source
|
|
5920
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
|
|
5628
5921
|
function processRangeExpression(start, ws1, range, end) {
|
|
5629
5922
|
ws1 = [ws1, range.children[0]];
|
|
5630
5923
|
const ws2 = range.children[1];
|
|
@@ -5647,10 +5940,8 @@ function processRangeExpression(start, ws1, range, end) {
|
|
|
5647
5940
|
const abs = ref;
|
|
5648
5941
|
const lengthAdjust = 1 - Number(!range.left.inclusive) - Number(!range.right.inclusive);
|
|
5649
5942
|
let ref1;
|
|
5650
|
-
if (lengthAdjust > 0)
|
|
5651
|
-
|
|
5652
|
-
else if (lengthAdjust < 0)
|
|
5653
|
-
ref1 = ` - ${-lengthAdjust}`;
|
|
5943
|
+
if (lengthAdjust > 0) ref1 = ` + ${lengthAdjust}`;
|
|
5944
|
+
else if (lengthAdjust < 0) ref1 = ` - ${-lengthAdjust}`;
|
|
5654
5945
|
else {
|
|
5655
5946
|
ref1 = void 0;
|
|
5656
5947
|
}
|
|
@@ -5786,10 +6077,8 @@ function forRange(open, forDeclaration, range, stepExp, close) {
|
|
|
5786
6077
|
asc = stepValue > 0;
|
|
5787
6078
|
}
|
|
5788
6079
|
let ref3;
|
|
5789
|
-
if (stepRef)
|
|
5790
|
-
|
|
5791
|
-
else
|
|
5792
|
-
ref3 = maybeRef(start, "start");
|
|
6080
|
+
if (stepRef) ref3 = start;
|
|
6081
|
+
else ref3 = maybeRef(start, "start");
|
|
5793
6082
|
let startRef = ref3;
|
|
5794
6083
|
let endRef = maybeRef(end, "end");
|
|
5795
6084
|
const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
|
|
@@ -5966,8 +6255,7 @@ function processForInOf($0) {
|
|
|
5966
6255
|
};
|
|
5967
6256
|
}
|
|
5968
6257
|
let ws2, decl2;
|
|
5969
|
-
if (declaration2)
|
|
5970
|
-
[, , ws2, decl2] = declaration2;
|
|
6258
|
+
if (declaration2) [, , ws2, decl2] = declaration2;
|
|
5971
6259
|
switch (inOf.token) {
|
|
5972
6260
|
case "of": {
|
|
5973
6261
|
const counterRef = makeRef("i");
|
|
@@ -6032,8 +6320,8 @@ function processForInOf($0) {
|
|
|
6032
6320
|
};
|
|
6033
6321
|
}
|
|
6034
6322
|
|
|
6035
|
-
// source
|
|
6036
|
-
var
|
|
6323
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
|
|
6324
|
+
var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
|
|
6037
6325
|
function findDecs(statements) {
|
|
6038
6326
|
const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
|
|
6039
6327
|
const declarationNames = declarations.flatMap((d) => d.names);
|
|
@@ -6088,8 +6376,7 @@ function createConstLetDecs(statements, scopes, letOrConst) {
|
|
|
6088
6376
|
}
|
|
6089
6377
|
continue;
|
|
6090
6378
|
}
|
|
6091
|
-
if (node.names == null)
|
|
6092
|
-
continue;
|
|
6379
|
+
if (node.names == null) continue;
|
|
6093
6380
|
let names = node.names.filter((name) => !hasDec(name));
|
|
6094
6381
|
if (node.type == "AssignmentExpression") {
|
|
6095
6382
|
undeclaredIdentifiers.push(...names);
|
|
@@ -6125,19 +6412,17 @@ function createVarDecs(block, scopes, pushVar) {
|
|
|
6125
6412
|
function findAssignments(statements2, decs2) {
|
|
6126
6413
|
let assignmentStatements2 = gatherNodes(statements2, ($3) => $3.type === "AssignmentExpression");
|
|
6127
6414
|
if (assignmentStatements2.length) {
|
|
6128
|
-
|
|
6415
|
+
concatAssign2(
|
|
6129
6416
|
assignmentStatements2,
|
|
6130
6417
|
findAssignments(assignmentStatements2.map((s) => s.children), decs2)
|
|
6131
6418
|
);
|
|
6132
6419
|
}
|
|
6133
6420
|
return assignmentStatements2;
|
|
6134
6421
|
}
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
};
|
|
6140
|
-
}
|
|
6422
|
+
pushVar ??= (name) => {
|
|
6423
|
+
varIds.push(name);
|
|
6424
|
+
return decs.add(name);
|
|
6425
|
+
};
|
|
6141
6426
|
const { expressions: statements } = block;
|
|
6142
6427
|
const decs = findDecs(statements);
|
|
6143
6428
|
scopes.push(decs);
|
|
@@ -6145,8 +6430,7 @@ function createVarDecs(block, scopes, pushVar) {
|
|
|
6145
6430
|
const assignmentStatements = findAssignments(statements, scopes);
|
|
6146
6431
|
const undeclaredIdentifiers = assignmentStatements.flatMap(($4) => $4?.names || []);
|
|
6147
6432
|
undeclaredIdentifiers.filter((x, i, a) => {
|
|
6148
|
-
if (!hasDec(x))
|
|
6149
|
-
return a.indexOf(x) === i;
|
|
6433
|
+
if (!hasDec(x)) return a.indexOf(x) === i;
|
|
6150
6434
|
return;
|
|
6151
6435
|
}).forEach(pushVar);
|
|
6152
6436
|
const fnNodes = gatherNodes(statements, isFunction);
|
|
@@ -6182,7 +6466,7 @@ function createVarDecs(block, scopes, pushVar) {
|
|
|
6182
6466
|
scopes.pop();
|
|
6183
6467
|
}
|
|
6184
6468
|
|
|
6185
|
-
// source
|
|
6469
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
|
|
6186
6470
|
function getIndentLevel(str, tab) {
|
|
6187
6471
|
if (tab != null && tab != 1) {
|
|
6188
6472
|
const tabs = str.match(/\t/g);
|
|
@@ -6350,7 +6634,7 @@ function quoteString(str) {
|
|
|
6350
6634
|
return JSON.stringify(str);
|
|
6351
6635
|
}
|
|
6352
6636
|
|
|
6353
|
-
// source
|
|
6637
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
|
|
6354
6638
|
var xor = (a, b) => a ? !b && a : b;
|
|
6355
6639
|
function addPostfixStatement(statement, ws, post) {
|
|
6356
6640
|
const expressions = [
|
|
@@ -6364,8 +6648,7 @@ function addPostfixStatement(statement, ws, post) {
|
|
|
6364
6648
|
bare: false
|
|
6365
6649
|
});
|
|
6366
6650
|
const children = [...post.children, block];
|
|
6367
|
-
if (!isWhitespaceOrEmpty(ws))
|
|
6368
|
-
children.push(ws);
|
|
6651
|
+
if (!isWhitespaceOrEmpty(ws)) children.push(ws);
|
|
6369
6652
|
post = makeNode({ ...post, children, block });
|
|
6370
6653
|
if (post.type === "IfStatement") {
|
|
6371
6654
|
post.then = block;
|
|
@@ -6437,8 +6720,7 @@ function expressionizeBlock(blockOrExpression) {
|
|
|
6437
6720
|
let i1 = 0;
|
|
6438
6721
|
for (const [ws, s, _delim] of expressions) {
|
|
6439
6722
|
const i = i1++;
|
|
6440
|
-
if (!isExpression(s))
|
|
6441
|
-
return;
|
|
6723
|
+
if (!isExpression(s)) return;
|
|
6442
6724
|
const wrapped = makeLeftHandSideExpression(s);
|
|
6443
6725
|
if (i === l - 1) {
|
|
6444
6726
|
results.push([ws, wrapped]);
|
|
@@ -6800,8 +7082,7 @@ function processCallMemberExpression(node) {
|
|
|
6800
7082
|
prefix = [ref].concat(glob.dot);
|
|
6801
7083
|
}
|
|
6802
7084
|
}
|
|
6803
|
-
if (wValue)
|
|
6804
|
-
value.unshift(wValue);
|
|
7085
|
+
if (wValue) value.unshift(wValue);
|
|
6805
7086
|
if (part.type === "SpreadProperty") {
|
|
6806
7087
|
parts.push({
|
|
6807
7088
|
type: part.type,
|
|
@@ -6844,8 +7125,7 @@ function processCallMemberExpression(node) {
|
|
|
6844
7125
|
],
|
|
6845
7126
|
properties: parts
|
|
6846
7127
|
};
|
|
6847
|
-
if (i === children.length - 1)
|
|
6848
|
-
return object;
|
|
7128
|
+
if (i === children.length - 1) return object;
|
|
6849
7129
|
return processCallMemberExpression({
|
|
6850
7130
|
// in case there are more
|
|
6851
7131
|
...node,
|
|
@@ -6986,10 +7266,8 @@ function lastAccessInCallExpression(exp) {
|
|
|
6986
7266
|
;
|
|
6987
7267
|
({ children } = exp);
|
|
6988
7268
|
i = children.length - 1;
|
|
6989
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
|
|
6990
|
-
|
|
6991
|
-
if (i < 0)
|
|
6992
|
-
return;
|
|
7269
|
+
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7270
|
+
if (i < 0) return;
|
|
6993
7271
|
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
6994
7272
|
return children[i];
|
|
6995
7273
|
}
|
|
@@ -7062,8 +7340,7 @@ function convertObjectToJSXAttributes(obj) {
|
|
|
7062
7340
|
rest.push(part);
|
|
7063
7341
|
continue;
|
|
7064
7342
|
}
|
|
7065
|
-
if (i > 0)
|
|
7066
|
-
parts.push(" ");
|
|
7343
|
+
if (i > 0) parts.push(" ");
|
|
7067
7344
|
switch (part.type) {
|
|
7068
7345
|
case "Identifier": {
|
|
7069
7346
|
parts.push([part.name, "={", part.name, "}"]);
|
|
@@ -7109,16 +7386,16 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
|
|
|
7109
7386
|
const { token } = kind;
|
|
7110
7387
|
ws = trimFirstSpace(ws);
|
|
7111
7388
|
let setVal;
|
|
7112
|
-
const
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7389
|
+
const parameterList = [];
|
|
7390
|
+
const isGet = token === "get";
|
|
7391
|
+
if (!isGet) {
|
|
7392
|
+
parameterList.push(setVal = makeRef("value"));
|
|
7393
|
+
}
|
|
7394
|
+
const parameters = {
|
|
7118
7395
|
type: "Parameters",
|
|
7119
|
-
children: ["(",
|
|
7120
|
-
|
|
7121
|
-
implicit:
|
|
7396
|
+
children: ["(", parameterList, ")"],
|
|
7397
|
+
parameters: parameterList,
|
|
7398
|
+
implicit: isGet
|
|
7122
7399
|
};
|
|
7123
7400
|
let expressions;
|
|
7124
7401
|
if (block) {
|
|
@@ -7134,7 +7411,7 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
|
|
|
7134
7411
|
};
|
|
7135
7412
|
}
|
|
7136
7413
|
if (autoReturn) {
|
|
7137
|
-
const finalStatement =
|
|
7414
|
+
const finalStatement = isGet ? [[expressions[0]?.[0] || "", ws], wrapWithReturn(value)] : [[expressions[0]?.[0] || "", ws], [value, " = ", setVal]];
|
|
7138
7415
|
expressions.push(finalStatement);
|
|
7139
7416
|
}
|
|
7140
7417
|
const children = [kind, " ", name, parameters, returnType, block];
|
|
@@ -7163,7 +7440,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7163
7440
|
}
|
|
7164
7441
|
function processAssignments(statements) {
|
|
7165
7442
|
for (let ref7 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref7.length; i5 < len3; i5++) {
|
|
7166
|
-
let
|
|
7443
|
+
let extractAssignment = function(lhs) {
|
|
7167
7444
|
let expr = lhs;
|
|
7168
7445
|
while (expr.type === "ParenthesizedExpression") {
|
|
7169
7446
|
expr = expr.expression;
|
|
@@ -7182,7 +7459,6 @@ function processAssignments(statements) {
|
|
|
7182
7459
|
;
|
|
7183
7460
|
return;
|
|
7184
7461
|
};
|
|
7185
|
-
var extractAssignment = extractAssignment2;
|
|
7186
7462
|
const exp = ref7[i5];
|
|
7187
7463
|
checkValidLHS(exp.assigned);
|
|
7188
7464
|
const pre = [], post = [];
|
|
@@ -7195,7 +7471,7 @@ function processAssignments(statements) {
|
|
|
7195
7471
|
for (let ref9 = exp.lhs, i6 = 0, len4 = ref9.length; i6 < len4; i6++) {
|
|
7196
7472
|
const lhsPart = ref9[i6];
|
|
7197
7473
|
let ref10;
|
|
7198
|
-
if (ref10 =
|
|
7474
|
+
if (ref10 = extractAssignment(lhsPart[1])) {
|
|
7199
7475
|
const newLhs = ref10;
|
|
7200
7476
|
lhsPart[1] = newLhs;
|
|
7201
7477
|
}
|
|
@@ -7204,7 +7480,7 @@ function processAssignments(statements) {
|
|
|
7204
7480
|
break;
|
|
7205
7481
|
}
|
|
7206
7482
|
case "UpdateExpression": {
|
|
7207
|
-
if (ref8 =
|
|
7483
|
+
if (ref8 = extractAssignment(exp.assigned)) {
|
|
7208
7484
|
const newLhs = ref8;
|
|
7209
7485
|
const i = exp.children.indexOf(exp.assigned);
|
|
7210
7486
|
exp.assigned = exp.children[i] = newLhs;
|
|
@@ -7260,13 +7536,11 @@ function processAssignments(statements) {
|
|
|
7260
7536
|
}
|
|
7261
7537
|
}
|
|
7262
7538
|
if ($1.some(($8) => $8[$8.length - 1].special)) {
|
|
7263
|
-
if ($1.length !== 1)
|
|
7264
|
-
throw new Error("Only one assignment with id= is allowed");
|
|
7539
|
+
if ($1.length !== 1) throw new Error("Only one assignment with id= is allowed");
|
|
7265
7540
|
const [, lhs, , op] = $1[0];
|
|
7266
7541
|
const { call, omitLhs } = op;
|
|
7267
7542
|
const index = exp.children.indexOf($2);
|
|
7268
|
-
if (index < 0)
|
|
7269
|
-
throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7543
|
+
if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7270
7544
|
exp.children.splice(
|
|
7271
7545
|
index,
|
|
7272
7546
|
1,
|
|
@@ -7317,8 +7591,7 @@ function processAssignments(statements) {
|
|
|
7317
7591
|
c[4] = [", ...", $2];
|
|
7318
7592
|
c[5] = ")";
|
|
7319
7593
|
lastAssignment.pop();
|
|
7320
|
-
if (isWhitespaceOrEmpty(lastAssignment[2]))
|
|
7321
|
-
lastAssignment.pop();
|
|
7594
|
+
if (isWhitespaceOrEmpty(lastAssignment[2])) lastAssignment.pop();
|
|
7322
7595
|
if ($1.length > 1) {
|
|
7323
7596
|
throw new Error("Not implemented yet! TODO: Handle multiple splice assignments");
|
|
7324
7597
|
}
|
|
@@ -7378,8 +7651,7 @@ function processAssignments(statements) {
|
|
|
7378
7651
|
exp.names = $1.flatMap(([, l]) => l.names || []);
|
|
7379
7652
|
if (tail.length) {
|
|
7380
7653
|
const index = exp.children.indexOf($2);
|
|
7381
|
-
if (index < 0)
|
|
7382
|
-
throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7654
|
+
if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
|
|
7383
7655
|
exp.children.splice(index + 1, 0, ...tail);
|
|
7384
7656
|
}
|
|
7385
7657
|
if (block) {
|
|
@@ -7556,10 +7828,8 @@ function processTypes(node) {
|
|
|
7556
7828
|
const space = getTrimmingSpace(unary);
|
|
7557
7829
|
inplaceInsertTrimmingSpace(unary, "");
|
|
7558
7830
|
let ref16;
|
|
7559
|
-
if (unary.suffix.length)
|
|
7560
|
-
|
|
7561
|
-
else
|
|
7562
|
-
ref16 = unary.t;
|
|
7831
|
+
if (unary.suffix.length) ref16 = unary;
|
|
7832
|
+
else ref16 = unary.t;
|
|
7563
7833
|
const t = ref16;
|
|
7564
7834
|
const arg = makeNode({
|
|
7565
7835
|
type: "TypeArgument",
|
|
@@ -7635,6 +7905,7 @@ function processStatementExpressions(statements) {
|
|
|
7635
7905
|
;
|
|
7636
7906
|
break;
|
|
7637
7907
|
}
|
|
7908
|
+
// else do nothing, handled separately currently
|
|
7638
7909
|
default: {
|
|
7639
7910
|
replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
7640
7911
|
}
|
|
@@ -7751,6 +8022,91 @@ function processBreaksContinues(statements) {
|
|
|
7751
8022
|
delete label.special;
|
|
7752
8023
|
}
|
|
7753
8024
|
}
|
|
8025
|
+
function processCoffeeClasses(statements) {
|
|
8026
|
+
for (let ref21 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref21.length; i11 < len9; i11++) {
|
|
8027
|
+
const ce = ref21[i11];
|
|
8028
|
+
const { expressions } = ce.body;
|
|
8029
|
+
const indent = expressions[0]?.[0] ?? "\n";
|
|
8030
|
+
const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
|
|
8031
|
+
if (autoBinds.length) {
|
|
8032
|
+
let construct;
|
|
8033
|
+
for (const [, c] of expressions) {
|
|
8034
|
+
if (typeof c === "object" && c != null && "type" in c && c.type === "MethodDefinition" && "name" in c && c.name === "constructor" && c.block) {
|
|
8035
|
+
construct = c;
|
|
8036
|
+
break;
|
|
8037
|
+
}
|
|
8038
|
+
}
|
|
8039
|
+
if (!construct) {
|
|
8040
|
+
const parametersList = [];
|
|
8041
|
+
const parameters = {
|
|
8042
|
+
type: "Parameters",
|
|
8043
|
+
children: [parametersList],
|
|
8044
|
+
parameters: parametersList,
|
|
8045
|
+
names: []
|
|
8046
|
+
};
|
|
8047
|
+
const signature = {
|
|
8048
|
+
type: "MethodSignature",
|
|
8049
|
+
children: ["constructor(", parameters, ")"],
|
|
8050
|
+
parameters,
|
|
8051
|
+
modifier: {},
|
|
8052
|
+
returnType: void 0
|
|
8053
|
+
};
|
|
8054
|
+
const block = makeEmptyBlock();
|
|
8055
|
+
construct = {
|
|
8056
|
+
...signature,
|
|
8057
|
+
type: "MethodDefinition",
|
|
8058
|
+
name: "constructor",
|
|
8059
|
+
block,
|
|
8060
|
+
signature,
|
|
8061
|
+
children: [...signature.children, block]
|
|
8062
|
+
};
|
|
8063
|
+
expressions.unshift([indent, construct]);
|
|
8064
|
+
}
|
|
8065
|
+
const index = findSuperCall(construct.block);
|
|
8066
|
+
construct.block.expressions.splice(
|
|
8067
|
+
index + 1,
|
|
8068
|
+
0,
|
|
8069
|
+
...(() => {
|
|
8070
|
+
const results3 = [];
|
|
8071
|
+
for (let i12 = 0, len10 = autoBinds.length; i12 < len10; i12++) {
|
|
8072
|
+
const [, a] = autoBinds[i12];
|
|
8073
|
+
results3.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
|
|
8074
|
+
}
|
|
8075
|
+
return results3;
|
|
8076
|
+
})()
|
|
8077
|
+
);
|
|
8078
|
+
}
|
|
8079
|
+
const privates = expressions.filter(($15) => $15[1]?.type === "CoffeeClassPrivate");
|
|
8080
|
+
if (!privates.length) {
|
|
8081
|
+
continue;
|
|
8082
|
+
}
|
|
8083
|
+
const { parent } = ce;
|
|
8084
|
+
for (let i13 = expressions.length + -1; i13 >= 0; --i13) {
|
|
8085
|
+
const i = i13;
|
|
8086
|
+
if (expressions[i][1]?.type === "CoffeeClassPrivate") {
|
|
8087
|
+
expressions.splice(i, 1);
|
|
8088
|
+
}
|
|
8089
|
+
}
|
|
8090
|
+
let wrapped = wrapIIFE([
|
|
8091
|
+
...privates,
|
|
8092
|
+
[indent, wrapWithReturn(ce)]
|
|
8093
|
+
]);
|
|
8094
|
+
if (ce && typeof ce === "object" && "binding" in ce) {
|
|
8095
|
+
let { binding } = ce;
|
|
8096
|
+
binding = trimFirstSpace(binding);
|
|
8097
|
+
wrapped = makeNode({
|
|
8098
|
+
type: "AssignmentExpression",
|
|
8099
|
+
children: [binding, " = ", wrapped],
|
|
8100
|
+
lhs: binding,
|
|
8101
|
+
// TODO: incorrect shape
|
|
8102
|
+
assigned: binding,
|
|
8103
|
+
expression: wrapped,
|
|
8104
|
+
names: [ce.name]
|
|
8105
|
+
});
|
|
8106
|
+
}
|
|
8107
|
+
replaceNode(ce, wrapped, parent);
|
|
8108
|
+
}
|
|
8109
|
+
}
|
|
7754
8110
|
function processProgram(root) {
|
|
7755
8111
|
const state2 = getState();
|
|
7756
8112
|
const config2 = getConfig();
|
|
@@ -7765,7 +8121,7 @@ function processProgram(root) {
|
|
|
7765
8121
|
if (config2.iife || config2.repl) {
|
|
7766
8122
|
rootIIFE = wrapIIFE(root.expressions, root.topLevelAwait);
|
|
7767
8123
|
const newExpressions = [["", rootIIFE]];
|
|
7768
|
-
root.children = root.children.map(($
|
|
8124
|
+
root.children = root.children.map(($16) => $16 === root.expressions ? newExpressions : $16);
|
|
7769
8125
|
root.expressions = newExpressions;
|
|
7770
8126
|
}
|
|
7771
8127
|
addParentPointers(root);
|
|
@@ -7784,6 +8140,9 @@ function processProgram(root) {
|
|
|
7784
8140
|
processBreaksContinues(statements);
|
|
7785
8141
|
hoistRefDecs(statements);
|
|
7786
8142
|
processFunctions(statements, config2);
|
|
8143
|
+
if (config2.coffeeClasses) {
|
|
8144
|
+
processCoffeeClasses(statements);
|
|
8145
|
+
}
|
|
7787
8146
|
statements.unshift(...state2.prelude);
|
|
7788
8147
|
if (config2.autoLet) {
|
|
7789
8148
|
createConstLetDecs(statements, [], "let");
|
|
@@ -7807,10 +8166,10 @@ async function processProgramAsync(root) {
|
|
|
7807
8166
|
await processComptime(statements);
|
|
7808
8167
|
}
|
|
7809
8168
|
function processRepl(root, rootIIFE) {
|
|
7810
|
-
const topBlock = gatherRecursive(rootIIFE, ($
|
|
8169
|
+
const topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0];
|
|
7811
8170
|
let i = 0;
|
|
7812
|
-
for (let
|
|
7813
|
-
const decl =
|
|
8171
|
+
for (let ref22 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref22.length; i14 < len11; i14++) {
|
|
8172
|
+
const decl = ref22[i14];
|
|
7814
8173
|
if (!decl.names?.length) {
|
|
7815
8174
|
continue;
|
|
7816
8175
|
}
|
|
@@ -7823,8 +8182,8 @@ function processRepl(root, rootIIFE) {
|
|
|
7823
8182
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
7824
8183
|
}
|
|
7825
8184
|
}
|
|
7826
|
-
for (let
|
|
7827
|
-
const func =
|
|
8185
|
+
for (let ref23 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref23.length; i15 < len12; i15++) {
|
|
8186
|
+
const func = ref23[i15];
|
|
7828
8187
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
7829
8188
|
if (func.parent === topBlock) {
|
|
7830
8189
|
replaceNode(func, void 0);
|
|
@@ -7836,8 +8195,8 @@ function processRepl(root, rootIIFE) {
|
|
|
7836
8195
|
}
|
|
7837
8196
|
}
|
|
7838
8197
|
}
|
|
7839
|
-
for (let
|
|
7840
|
-
const classExp =
|
|
8198
|
+
for (let ref24 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref24.length; i16 < len13; i16++) {
|
|
8199
|
+
const classExp = ref24[i16];
|
|
7841
8200
|
let m8;
|
|
7842
8201
|
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)) {
|
|
7843
8202
|
classExp.children.unshift(classExp.name, "=");
|
|
@@ -7846,14 +8205,13 @@ function processRepl(root, rootIIFE) {
|
|
|
7846
8205
|
}
|
|
7847
8206
|
}
|
|
7848
8207
|
function populateRefs(statements) {
|
|
7849
|
-
const refNodes = gatherRecursive(statements, ($
|
|
8208
|
+
const refNodes = gatherRecursive(statements, ($21) => $21.type === "Ref");
|
|
7850
8209
|
if (refNodes.length) {
|
|
7851
8210
|
const ids = gatherRecursive(statements, (s) => s.type === "Identifier");
|
|
7852
8211
|
const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
|
|
7853
8212
|
refNodes.forEach((ref) => {
|
|
7854
8213
|
const { type, base } = ref;
|
|
7855
|
-
if (type !== "Ref")
|
|
7856
|
-
return;
|
|
8214
|
+
if (type !== "Ref") return;
|
|
7857
8215
|
ref.type = "Identifier";
|
|
7858
8216
|
let n = 0;
|
|
7859
8217
|
let name = base;
|
|
@@ -7869,8 +8227,8 @@ function populateRefs(statements) {
|
|
|
7869
8227
|
function processPlaceholders(statements) {
|
|
7870
8228
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
7871
8229
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
7872
|
-
for (let
|
|
7873
|
-
const exp =
|
|
8230
|
+
for (let ref25 = gatherRecursiveAll(statements, ($22) => $22.type === "Placeholder"), i17 = 0, len14 = ref25.length; i17 < len14; i17++) {
|
|
8231
|
+
const exp = ref25[i17];
|
|
7874
8232
|
let ancestor;
|
|
7875
8233
|
if (exp.subtype === ".") {
|
|
7876
8234
|
({ ancestor } = findAncestor(
|
|
@@ -7979,11 +8337,11 @@ function processPlaceholders(statements) {
|
|
|
7979
8337
|
for (const [ancestor, placeholders] of placeholderMap) {
|
|
7980
8338
|
let ref = makeRef("$");
|
|
7981
8339
|
let typeSuffix;
|
|
7982
|
-
for (let
|
|
7983
|
-
const placeholder = placeholders[
|
|
8340
|
+
for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
|
|
8341
|
+
const placeholder = placeholders[i18];
|
|
7984
8342
|
typeSuffix ??= placeholder.typeSuffix;
|
|
7985
|
-
let
|
|
7986
|
-
(
|
|
8343
|
+
let ref26;
|
|
8344
|
+
(ref26 = placeholder.children)[ref26.length - 1] = ref;
|
|
7987
8345
|
}
|
|
7988
8346
|
const { parent } = ancestor;
|
|
7989
8347
|
const body = maybeUnwrap(ancestor);
|
|
@@ -8004,16 +8362,16 @@ function processPlaceholders(statements) {
|
|
|
8004
8362
|
}
|
|
8005
8363
|
case "PipelineExpression": {
|
|
8006
8364
|
const i = findChildIndex(parent, ancestor);
|
|
8007
|
-
let
|
|
8365
|
+
let ref27;
|
|
8008
8366
|
if (i === 1) {
|
|
8009
|
-
|
|
8367
|
+
ref27 = ancestor === parent.children[i];
|
|
8010
8368
|
} else if (i === 2) {
|
|
8011
|
-
|
|
8369
|
+
ref27 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
8012
8370
|
} else {
|
|
8013
|
-
|
|
8371
|
+
ref27 = void 0;
|
|
8014
8372
|
}
|
|
8015
8373
|
;
|
|
8016
|
-
outer =
|
|
8374
|
+
outer = ref27;
|
|
8017
8375
|
break;
|
|
8018
8376
|
}
|
|
8019
8377
|
case "AssignmentExpression":
|
|
@@ -8028,9 +8386,9 @@ function processPlaceholders(statements) {
|
|
|
8028
8386
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
8029
8387
|
}
|
|
8030
8388
|
replaceNode(ancestor, fnExp, parent);
|
|
8031
|
-
let
|
|
8032
|
-
if (
|
|
8033
|
-
const ws =
|
|
8389
|
+
let ref28;
|
|
8390
|
+
if (ref28 = getTrimmingSpace(body)) {
|
|
8391
|
+
const ws = ref28;
|
|
8034
8392
|
inplaceInsertTrimmingSpace(body, "");
|
|
8035
8393
|
inplacePrepend(ws, fnExp);
|
|
8036
8394
|
}
|
|
@@ -8043,8 +8401,7 @@ function reorderBindingRestProperty(props) {
|
|
|
8043
8401
|
let restCount = 0;
|
|
8044
8402
|
props.forEach(({ type }, i) => {
|
|
8045
8403
|
if (type === "BindingRestProperty") {
|
|
8046
|
-
if (restIndex < 0)
|
|
8047
|
-
restIndex = i;
|
|
8404
|
+
if (restIndex < 0) restIndex = i;
|
|
8048
8405
|
return restCount++;
|
|
8049
8406
|
}
|
|
8050
8407
|
;
|
|
@@ -8075,8 +8432,8 @@ function reorderBindingRestProperty(props) {
|
|
|
8075
8432
|
}
|
|
8076
8433
|
];
|
|
8077
8434
|
}
|
|
8078
|
-
let
|
|
8079
|
-
if (Array.isArray(rest.delim) && (
|
|
8435
|
+
let ref29;
|
|
8436
|
+
if (Array.isArray(rest.delim) && (ref29 = rest.delim)[ref29.length - 1]?.token === ",") {
|
|
8080
8437
|
rest.delim = rest.delim.slice(0, -1);
|
|
8081
8438
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
8082
8439
|
}
|
|
@@ -9423,10 +9780,8 @@ function NonPipelineExpression(ctx, state2) {
|
|
|
9423
9780
|
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) {
|
|
9424
9781
|
var expression = $3;
|
|
9425
9782
|
var trailing = $5;
|
|
9426
|
-
if (!expression)
|
|
9427
|
-
|
|
9428
|
-
if (!trailing)
|
|
9429
|
-
return expression;
|
|
9783
|
+
if (!expression) return $skip;
|
|
9784
|
+
if (!trailing) return expression;
|
|
9430
9785
|
return {
|
|
9431
9786
|
type: "CallExpression",
|
|
9432
9787
|
children: [expression, ...trailing]
|
|
@@ -9436,8 +9791,7 @@ function NestedExpressionizedStatement(ctx, state2) {
|
|
|
9436
9791
|
return (0, import_lib2.$EVENT)(ctx, state2, "NestedExpressionizedStatement", NestedExpressionizedStatement$0);
|
|
9437
9792
|
}
|
|
9438
9793
|
var ExpressionizedStatementWithTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExpressionizedStatement, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
|
|
9439
|
-
if (!$2)
|
|
9440
|
-
return $1;
|
|
9794
|
+
if (!$2) return $1;
|
|
9441
9795
|
return {
|
|
9442
9796
|
type: "CallExpression",
|
|
9443
9797
|
children: [
|
|
@@ -9462,8 +9816,7 @@ function ExpressionizedStatement(ctx, state2) {
|
|
|
9462
9816
|
}
|
|
9463
9817
|
var StatementExpression$0 = DebuggerStatement;
|
|
9464
9818
|
var StatementExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IfStatement), function($skip, $loc, $0, $1) {
|
|
9465
|
-
if (!$1.else && $1.then.implicit)
|
|
9466
|
-
return $skip;
|
|
9819
|
+
if (!$1.else && $1.then.implicit) return $skip;
|
|
9467
9820
|
return $1;
|
|
9468
9821
|
});
|
|
9469
9822
|
var StatementExpression$2 = IterationExpression;
|
|
@@ -9475,8 +9828,7 @@ function StatementExpression(ctx, state2) {
|
|
|
9475
9828
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "StatementExpression", StatementExpression$$);
|
|
9476
9829
|
}
|
|
9477
9830
|
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) {
|
|
9478
|
-
if ($2.length == 0)
|
|
9479
|
-
return $1;
|
|
9831
|
+
if ($2.length == 0) return $1;
|
|
9480
9832
|
return $0;
|
|
9481
9833
|
});
|
|
9482
9834
|
function CommaExpression(ctx, state2) {
|
|
@@ -9485,8 +9837,7 @@ function CommaExpression(ctx, state2) {
|
|
|
9485
9837
|
var Arguments$0 = ExplicitArguments;
|
|
9486
9838
|
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) {
|
|
9487
9839
|
var args = $2;
|
|
9488
|
-
if (args)
|
|
9489
|
-
return args;
|
|
9840
|
+
if (args) return args;
|
|
9490
9841
|
return $skip;
|
|
9491
9842
|
});
|
|
9492
9843
|
var Arguments$$ = [Arguments$0, Arguments$1];
|
|
@@ -9498,10 +9849,8 @@ var ImplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ApplicationSt
|
|
|
9498
9849
|
var ws = $3;
|
|
9499
9850
|
var args = $6;
|
|
9500
9851
|
var close = $9;
|
|
9501
|
-
if (!args)
|
|
9502
|
-
|
|
9503
|
-
if (skipImplicitArguments(args))
|
|
9504
|
-
return $skip;
|
|
9852
|
+
if (!args) return $skip;
|
|
9853
|
+
if (skipImplicitArguments(args)) return $skip;
|
|
9505
9854
|
return {
|
|
9506
9855
|
type: "Call",
|
|
9507
9856
|
args,
|
|
@@ -9547,14 +9896,12 @@ var ForbiddenImplicitCalls$3 = (0, import_lib2.$S)(ClassImplicitCallForbidden, (
|
|
|
9547
9896
|
var ForbiddenImplicitCalls$4 = (0, import_lib2.$S)(Identifier, (0, import_lib2.$EXPECT)($L3, 'ForbiddenImplicitCalls "="'), Whitespace);
|
|
9548
9897
|
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) {
|
|
9549
9898
|
var id = $1;
|
|
9550
|
-
if (state.operators.has(id.name))
|
|
9551
|
-
return $0;
|
|
9899
|
+
if (state.operators.has(id.name)) return $0;
|
|
9552
9900
|
return $skip;
|
|
9553
9901
|
});
|
|
9554
9902
|
var ForbiddenImplicitCalls$6 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, (0, import_lib2.$E)(_), Identifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
9555
9903
|
var id = $3;
|
|
9556
|
-
if (state.operators.has(id.name))
|
|
9557
|
-
return $0;
|
|
9904
|
+
if (state.operators.has(id.name)) return $0;
|
|
9558
9905
|
return $skip;
|
|
9559
9906
|
});
|
|
9560
9907
|
var ForbiddenImplicitCalls$7 = (0, import_lib2.$S)(PostfixStatement, NoBlock);
|
|
@@ -9577,18 +9924,15 @@ function ArgumentsWithTrailingCallExpressions(ctx, state2) {
|
|
|
9577
9924
|
}
|
|
9578
9925
|
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) {
|
|
9579
9926
|
$1 = $1.flat();
|
|
9580
|
-
if (!$1.length && !$2)
|
|
9581
|
-
|
|
9582
|
-
if (!$2)
|
|
9583
|
-
return $1;
|
|
9927
|
+
if (!$1.length && !$2) return $skip;
|
|
9928
|
+
if (!$2) return $1;
|
|
9584
9929
|
return [...$1, ...$2];
|
|
9585
9930
|
});
|
|
9586
9931
|
function TrailingCallExpressions(ctx, state2) {
|
|
9587
9932
|
return (0, import_lib2.$EVENT)(ctx, state2, "TrailingCallExpressions", TrailingCallExpressions$0);
|
|
9588
9933
|
}
|
|
9589
9934
|
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) {
|
|
9590
|
-
if (!$2.length)
|
|
9591
|
-
return $skip;
|
|
9935
|
+
if (!$2.length) return $skip;
|
|
9592
9936
|
return $2.flat();
|
|
9593
9937
|
});
|
|
9594
9938
|
var IndentedTrailingCallExpressions$1 = (0, import_lib2.$TV)((0, import_lib2.$P)(NestedTrailingCallExpression), function($skip, $loc, $0, $1) {
|
|
@@ -9636,8 +9980,7 @@ var ArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
|
|
|
9636
9980
|
];
|
|
9637
9981
|
});
|
|
9638
9982
|
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) {
|
|
9639
|
-
if (!Array.isArray($1))
|
|
9640
|
-
$1 = [$1];
|
|
9983
|
+
if (!Array.isArray($1)) $1 = [$1];
|
|
9641
9984
|
return [
|
|
9642
9985
|
...trimFirstSpace($1),
|
|
9643
9986
|
...$2.flatMap(
|
|
@@ -9664,8 +10007,7 @@ function NestedArguments(ctx, state2) {
|
|
|
9664
10007
|
}
|
|
9665
10008
|
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) {
|
|
9666
10009
|
var args = $4;
|
|
9667
|
-
if (!args.length)
|
|
9668
|
-
return $skip;
|
|
10010
|
+
if (!args.length) return $skip;
|
|
9669
10011
|
return stripTrailingImplicitComma(args.flat());
|
|
9670
10012
|
});
|
|
9671
10013
|
function NestedArgumentList(ctx, state2) {
|
|
@@ -9719,8 +10061,7 @@ function ArgumentPart(ctx, state2) {
|
|
|
9719
10061
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
|
|
9720
10062
|
}
|
|
9721
10063
|
var BinaryOpExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnaryExpression, (0, import_lib2.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
|
|
9722
|
-
if (!$2.length)
|
|
9723
|
-
return $1;
|
|
10064
|
+
if (!$2.length) return $1;
|
|
9724
10065
|
return processBinaryOpExpression($0);
|
|
9725
10066
|
});
|
|
9726
10067
|
function BinaryOpExpression(ctx, state2) {
|
|
@@ -9774,8 +10115,7 @@ function IsLike(ctx, state2) {
|
|
|
9774
10115
|
}
|
|
9775
10116
|
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) {
|
|
9776
10117
|
var wrhs = $2;
|
|
9777
|
-
if (!wrhs)
|
|
9778
|
-
return $skip;
|
|
10118
|
+
if (!wrhs) return $skip;
|
|
9779
10119
|
return wrhs;
|
|
9780
10120
|
});
|
|
9781
10121
|
var WRHS$1 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS);
|
|
@@ -9837,8 +10177,7 @@ function UnaryBody(ctx, state2) {
|
|
|
9837
10177
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
|
|
9838
10178
|
}
|
|
9839
10179
|
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) {
|
|
9840
|
-
if (!$2)
|
|
9841
|
-
return $skip;
|
|
10180
|
+
if (!$2) return $skip;
|
|
9842
10181
|
return $2;
|
|
9843
10182
|
});
|
|
9844
10183
|
var MaybeNestedCoffeeDoBody$1 = (0, import_lib2.$S)((0, import_lib2.$E)(_), CoffeeDoBody);
|
|
@@ -9927,8 +10266,7 @@ var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressi
|
|
|
9927
10266
|
};
|
|
9928
10267
|
});
|
|
9929
10268
|
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) {
|
|
9930
|
-
if (!$2)
|
|
9931
|
-
return $1;
|
|
10269
|
+
if (!$2) return $1;
|
|
9932
10270
|
return {
|
|
9933
10271
|
type: "UpdateExpression",
|
|
9934
10272
|
assigned: $1,
|
|
@@ -10061,14 +10399,14 @@ var ArrowFunction$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
|
10061
10399
|
var returnType = $3;
|
|
10062
10400
|
var arrow = $4;
|
|
10063
10401
|
var expOrBlock = $5;
|
|
10064
|
-
if (!async)
|
|
10065
|
-
async = [];
|
|
10402
|
+
if (!async) async = [];
|
|
10066
10403
|
return {
|
|
10067
10404
|
type: "ArrowFunction",
|
|
10068
10405
|
signature: {
|
|
10069
10406
|
modifier: {
|
|
10070
10407
|
async: !!async.length
|
|
10071
10408
|
},
|
|
10409
|
+
parameters,
|
|
10072
10410
|
returnType
|
|
10073
10411
|
},
|
|
10074
10412
|
parameters,
|
|
@@ -10085,8 +10423,7 @@ function ArrowFunction(ctx, state2) {
|
|
|
10085
10423
|
var FatArrow$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), FatArrowToken), function($skip, $loc, $0, $1, $2) {
|
|
10086
10424
|
var ws = $1;
|
|
10087
10425
|
var arrow = $2;
|
|
10088
|
-
if (!ws)
|
|
10089
|
-
ws = " ";
|
|
10426
|
+
if (!ws) ws = " ";
|
|
10090
10427
|
return [ws, arrow];
|
|
10091
10428
|
});
|
|
10092
10429
|
function FatArrow(ctx, state2) {
|
|
@@ -10153,8 +10490,7 @@ function TernaryRest(ctx, state2) {
|
|
|
10153
10490
|
}
|
|
10154
10491
|
var NestedTernaryRest$0 = (0, import_lib2.$S)(Nested, QuestionMark, MaybeNestedExpression, Nested, Colon, MaybeNestedExpression);
|
|
10155
10492
|
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) {
|
|
10156
|
-
if ($2)
|
|
10157
|
-
return $2;
|
|
10493
|
+
if ($2) return $2;
|
|
10158
10494
|
return $skip;
|
|
10159
10495
|
});
|
|
10160
10496
|
var NestedTernaryRest$$ = [NestedTernaryRest$0, NestedTernaryRest$1];
|
|
@@ -10193,8 +10529,7 @@ function PipelineExpression(ctx, state2) {
|
|
|
10193
10529
|
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) {
|
|
10194
10530
|
var first = $1;
|
|
10195
10531
|
var rest = $3;
|
|
10196
|
-
if (!rest.length)
|
|
10197
|
-
return $skip;
|
|
10532
|
+
if (!rest.length) return $skip;
|
|
10198
10533
|
return [
|
|
10199
10534
|
...first,
|
|
10200
10535
|
...rest.map(([nested, line]) => [nested, ...line]).flat()
|
|
@@ -10257,8 +10592,7 @@ var OptimizedParenthesizedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
|
|
|
10257
10592
|
const { expression } = $1;
|
|
10258
10593
|
switch (expression.type) {
|
|
10259
10594
|
case "StatementExpression":
|
|
10260
|
-
if (expression.statement.type !== "IterationExpression")
|
|
10261
|
-
break;
|
|
10595
|
+
if (expression.statement.type !== "IterationExpression") break;
|
|
10262
10596
|
case "IterationExpression":
|
|
10263
10597
|
return expression;
|
|
10264
10598
|
}
|
|
@@ -10269,8 +10603,7 @@ function OptimizedParenthesizedExpression(ctx, state2) {
|
|
|
10269
10603
|
}
|
|
10270
10604
|
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) {
|
|
10271
10605
|
var open = $1;
|
|
10272
|
-
if (!$3)
|
|
10273
|
-
return $skip;
|
|
10606
|
+
if (!$3) return $skip;
|
|
10274
10607
|
const [expression, ws, close] = $3;
|
|
10275
10608
|
if (expression.type === "ParenthesizedExpression" && expression.implicit) {
|
|
10276
10609
|
return {
|
|
@@ -10328,8 +10661,7 @@ function PlaceholderTypeSuffix(ctx, state2) {
|
|
|
10328
10661
|
return (0, import_lib2.$EVENT)(ctx, state2, "PlaceholderTypeSuffix", PlaceholderTypeSuffix$0);
|
|
10329
10662
|
}
|
|
10330
10663
|
var ClassDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ClassExpression), function($skip, $loc, $0, $1) {
|
|
10331
|
-
if ($1.id)
|
|
10332
|
-
return $1;
|
|
10664
|
+
if ($1.id) return $1;
|
|
10333
10665
|
return makeLeftHandSideExpression($1);
|
|
10334
10666
|
});
|
|
10335
10667
|
function ClassDeclaration(ctx, state2) {
|
|
@@ -10374,10 +10706,8 @@ var ClassHeritage$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExtendsClause, (0
|
|
|
10374
10706
|
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) {
|
|
10375
10707
|
var withClause = $1;
|
|
10376
10708
|
var implementsClause = $2;
|
|
10377
|
-
if (withClause)
|
|
10378
|
-
|
|
10379
|
-
if (implementsClause)
|
|
10380
|
-
return implementsClause;
|
|
10709
|
+
if (withClause) return [convertWithClause(withClause), implementsClause];
|
|
10710
|
+
if (implementsClause) return implementsClause;
|
|
10381
10711
|
return $skip;
|
|
10382
10712
|
});
|
|
10383
10713
|
var ClassHeritage$$ = [ClassHeritage$0, ClassHeritage$1];
|
|
@@ -10512,8 +10842,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
|
|
|
10512
10842
|
var expressions = $4;
|
|
10513
10843
|
var ws2 = $6;
|
|
10514
10844
|
var close = $7;
|
|
10515
|
-
if (!expressions)
|
|
10516
|
-
expressions = [];
|
|
10845
|
+
if (!expressions) expressions = [];
|
|
10517
10846
|
return {
|
|
10518
10847
|
type: "BlockStatement",
|
|
10519
10848
|
subtype: "ClassBody",
|
|
@@ -10523,8 +10852,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
|
|
|
10523
10852
|
});
|
|
10524
10853
|
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) {
|
|
10525
10854
|
var expressions = $2;
|
|
10526
|
-
if (!expressions)
|
|
10527
|
-
expressions = $0[1] = [];
|
|
10855
|
+
if (!expressions) expressions = $0[1] = [];
|
|
10528
10856
|
return {
|
|
10529
10857
|
type: "BlockStatement",
|
|
10530
10858
|
subtype: "ClassBody",
|
|
@@ -10539,8 +10867,7 @@ function ClassBody(ctx, state2) {
|
|
|
10539
10867
|
var ClassBracedContent$0 = NestedClassElements;
|
|
10540
10868
|
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) {
|
|
10541
10869
|
var stmts = $2;
|
|
10542
|
-
if (!stmts)
|
|
10543
|
-
return $skip;
|
|
10870
|
+
if (!stmts) return $skip;
|
|
10544
10871
|
return stmts;
|
|
10545
10872
|
});
|
|
10546
10873
|
var ClassBracedContent$$ = [ClassBracedContent$0, ClassBracedContent$1];
|
|
@@ -10549,8 +10876,7 @@ function ClassBracedContent(ctx, state2) {
|
|
|
10549
10876
|
}
|
|
10550
10877
|
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) {
|
|
10551
10878
|
var elements = $2;
|
|
10552
|
-
if (!elements.length)
|
|
10553
|
-
return $skip;
|
|
10879
|
+
if (!elements.length) return $skip;
|
|
10554
10880
|
return elements;
|
|
10555
10881
|
});
|
|
10556
10882
|
function NestedClassElements(ctx, state2) {
|
|
@@ -10608,8 +10934,7 @@ function ClassSignatureBody(ctx, state2) {
|
|
|
10608
10934
|
}
|
|
10609
10935
|
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) {
|
|
10610
10936
|
var elements = $2;
|
|
10611
|
-
if (!elements.length)
|
|
10612
|
-
return $skip;
|
|
10937
|
+
if (!elements.length) return $skip;
|
|
10613
10938
|
return elements;
|
|
10614
10939
|
});
|
|
10615
10940
|
function NestedClassSignatureElements(ctx, state2) {
|
|
@@ -10626,8 +10951,7 @@ function ClassSignatureElement(ctx, state2) {
|
|
|
10626
10951
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ClassSignatureElement", ClassSignatureElement$$);
|
|
10627
10952
|
}
|
|
10628
10953
|
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) {
|
|
10629
|
-
if (!($1 || $2))
|
|
10630
|
-
return $skip;
|
|
10954
|
+
if (!($1 || $2)) return $skip;
|
|
10631
10955
|
return {
|
|
10632
10956
|
ts: true,
|
|
10633
10957
|
children: $0
|
|
@@ -10640,7 +10964,7 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
|
|
|
10640
10964
|
var id = $2;
|
|
10641
10965
|
var exp = $6;
|
|
10642
10966
|
switch (exp.type) {
|
|
10643
|
-
case "FunctionExpression":
|
|
10967
|
+
case "FunctionExpression": {
|
|
10644
10968
|
const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
|
|
10645
10969
|
const children = exp.children.slice();
|
|
10646
10970
|
if (exp.generator) {
|
|
@@ -10650,8 +10974,29 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
|
|
|
10650
10974
|
}
|
|
10651
10975
|
return {
|
|
10652
10976
|
...exp,
|
|
10977
|
+
type: "MethodDefinition",
|
|
10978
|
+
name: id.name,
|
|
10979
|
+
signature: { ...exp.signature, id, name: id.name },
|
|
10653
10980
|
children
|
|
10654
10981
|
};
|
|
10982
|
+
}
|
|
10983
|
+
case "ArrowFunction": {
|
|
10984
|
+
const block = { ...exp.block };
|
|
10985
|
+
const children = exp.children.filter((c) => !(Array.isArray(c) && c[c.length - 1]?.token?.includes("=>"))).map((c) => c === exp.block ? block : c);
|
|
10986
|
+
children.unshift(id);
|
|
10987
|
+
exp = {
|
|
10988
|
+
...exp,
|
|
10989
|
+
type: "MethodDefinition",
|
|
10990
|
+
name: id.name,
|
|
10991
|
+
signature: { ...exp.signature, id, name: id.name },
|
|
10992
|
+
block,
|
|
10993
|
+
children,
|
|
10994
|
+
autoBind: true
|
|
10995
|
+
};
|
|
10996
|
+
block.parent = exp;
|
|
10997
|
+
braceBlock(block);
|
|
10998
|
+
return exp;
|
|
10999
|
+
}
|
|
10655
11000
|
default:
|
|
10656
11001
|
return {
|
|
10657
11002
|
type: "FieldDefinition",
|
|
@@ -10661,11 +11006,11 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
|
|
|
10661
11006
|
}
|
|
10662
11007
|
});
|
|
10663
11008
|
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) {
|
|
10664
|
-
var
|
|
11009
|
+
var readonly = $1;
|
|
10665
11010
|
var id = $2;
|
|
10666
11011
|
var typeSuffix = $3;
|
|
10667
11012
|
var ca = $5;
|
|
10668
|
-
|
|
11013
|
+
readonly.children[0].$loc = {
|
|
10669
11014
|
pos: ca.$loc.pos - 1,
|
|
10670
11015
|
length: ca.$loc.length + 1
|
|
10671
11016
|
};
|
|
@@ -10673,21 +11018,36 @@ var FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly,
|
|
|
10673
11018
|
type: "FieldDefinition",
|
|
10674
11019
|
id,
|
|
10675
11020
|
typeSuffix,
|
|
10676
|
-
children: $0
|
|
11021
|
+
children: $0,
|
|
11022
|
+
readonly
|
|
10677
11023
|
};
|
|
10678
11024
|
});
|
|
10679
|
-
var FieldDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
11025
|
+
var FieldDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEnabled, ActualAssignment), function($skip, $loc, $0, $1, $2) {
|
|
11026
|
+
var assignment = $2;
|
|
11027
|
+
return {
|
|
11028
|
+
type: "CoffeeClassPrivate",
|
|
11029
|
+
children: [assignment],
|
|
11030
|
+
assignment
|
|
11031
|
+
};
|
|
11032
|
+
});
|
|
11033
|
+
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) {
|
|
11034
|
+
var abstract = $1;
|
|
11035
|
+
var readonly = $2;
|
|
10680
11036
|
var id = $3;
|
|
10681
11037
|
var typeSuffix = $4;
|
|
11038
|
+
var initializer = $5;
|
|
10682
11039
|
return {
|
|
10683
11040
|
type: "FieldDefinition",
|
|
10684
11041
|
children: $0,
|
|
10685
|
-
ts:
|
|
11042
|
+
ts: abstract ? true : void 0,
|
|
10686
11043
|
id,
|
|
10687
|
-
typeSuffix
|
|
11044
|
+
typeSuffix,
|
|
11045
|
+
abstract,
|
|
11046
|
+
readonly,
|
|
11047
|
+
initializer
|
|
10688
11048
|
};
|
|
10689
11049
|
});
|
|
10690
|
-
var FieldDefinition$$ = [FieldDefinition$0, FieldDefinition$1, FieldDefinition$2];
|
|
11050
|
+
var FieldDefinition$$ = [FieldDefinition$0, FieldDefinition$1, FieldDefinition$2, FieldDefinition$3];
|
|
10691
11051
|
function FieldDefinition(ctx, state2) {
|
|
10692
11052
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "FieldDefinition", FieldDefinition$$);
|
|
10693
11053
|
}
|
|
@@ -10723,8 +11083,7 @@ var HashThis$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(At
|
|
|
10723
11083
|
var at = $1;
|
|
10724
11084
|
var id = $2;
|
|
10725
11085
|
var beforeIn = $3;
|
|
10726
|
-
if (beforeIn != null && at == null)
|
|
10727
|
-
return ['"', id.name, '"'];
|
|
11086
|
+
if (beforeIn != null && at == null) return ['"', id.name, '"'];
|
|
10728
11087
|
return {
|
|
10729
11088
|
type: "MemberExpression",
|
|
10730
11089
|
children: [at ?? "this", {
|
|
@@ -10851,8 +11210,7 @@ var CallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
10851
11210
|
var CallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ArgumentsWithTrailingCallExpressions), function($skip, $loc, $0, $1, $2) {
|
|
10852
11211
|
var optional = $1;
|
|
10853
11212
|
var argsWithTrailing = $2;
|
|
10854
|
-
if (!optional)
|
|
10855
|
-
return argsWithTrailing;
|
|
11213
|
+
if (!optional) return argsWithTrailing;
|
|
10856
11214
|
const call = argsWithTrailing[0];
|
|
10857
11215
|
return [{
|
|
10858
11216
|
...call,
|
|
@@ -10878,8 +11236,7 @@ var ExplicitCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0,
|
|
|
10878
11236
|
var ExplicitCallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
|
|
10879
11237
|
var optional = $1;
|
|
10880
11238
|
var call = $2;
|
|
10881
|
-
if (!optional)
|
|
10882
|
-
return call;
|
|
11239
|
+
if (!optional) return call;
|
|
10883
11240
|
return {
|
|
10884
11241
|
...call,
|
|
10885
11242
|
children: [optional, ...call.children],
|
|
@@ -10947,8 +11304,7 @@ function MemberBase(ctx, state2) {
|
|
|
10947
11304
|
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) {
|
|
10948
11305
|
var comments = $2;
|
|
10949
11306
|
var body = $3;
|
|
10950
|
-
if (Array.isArray(body))
|
|
10951
|
-
return [...comments, ...body];
|
|
11307
|
+
if (Array.isArray(body)) return [...comments, ...body];
|
|
10952
11308
|
return {
|
|
10953
11309
|
...body,
|
|
10954
11310
|
children: [...comments, ...body.children]
|
|
@@ -10961,8 +11317,7 @@ var MemberExpressionRestBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, im
|
|
|
10961
11317
|
var dot = $1;
|
|
10962
11318
|
var comments = $2;
|
|
10963
11319
|
var content = $3;
|
|
10964
|
-
if (!dot && !comments.length)
|
|
10965
|
-
return content;
|
|
11320
|
+
if (!dot && !comments.length) return content;
|
|
10966
11321
|
if (dot) {
|
|
10967
11322
|
if (dot.type === "Optional" && content.type === "SliceExpression") {
|
|
10968
11323
|
return [...dot.children.slice(0, -1), ...comments, content];
|
|
@@ -11059,8 +11414,7 @@ var SliceParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import
|
|
|
11059
11414
|
const inc = [];
|
|
11060
11415
|
if (dots.right.inclusive) {
|
|
11061
11416
|
end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
|
|
11062
|
-
if (!reversed)
|
|
11063
|
-
inc.push(" || 1/0");
|
|
11417
|
+
if (!reversed) inc.push(" || 1/0");
|
|
11064
11418
|
}
|
|
11065
11419
|
children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
|
|
11066
11420
|
} else {
|
|
@@ -11311,10 +11665,12 @@ var Parameters$0 = NonEmptyParameters;
|
|
|
11311
11665
|
var Parameters$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
|
|
11312
11666
|
var tp = $1;
|
|
11313
11667
|
var p = $2;
|
|
11668
|
+
const parameters = [];
|
|
11314
11669
|
return {
|
|
11315
11670
|
type: "Parameters",
|
|
11316
|
-
children: [tp, { $loc: p.$loc, token: "(
|
|
11671
|
+
children: [tp, { $loc: p.$loc, token: "(" }, parameters, ")"],
|
|
11317
11672
|
tp,
|
|
11673
|
+
parameters,
|
|
11318
11674
|
names: [],
|
|
11319
11675
|
implicit: true
|
|
11320
11676
|
};
|
|
@@ -11337,10 +11693,11 @@ function ShortArrowParameters(ctx, state2) {
|
|
|
11337
11693
|
return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
|
|
11338
11694
|
}
|
|
11339
11695
|
var ArrowParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ShortArrowParameters), function($skip, $loc, $0, $1) {
|
|
11696
|
+
const parameters = [$1];
|
|
11340
11697
|
return {
|
|
11341
11698
|
type: "Parameters",
|
|
11342
|
-
children: ["(",
|
|
11343
|
-
|
|
11699
|
+
children: ["(", parameters, ")"],
|
|
11700
|
+
parameters
|
|
11344
11701
|
};
|
|
11345
11702
|
});
|
|
11346
11703
|
var ArrowParameters$1 = Parameters;
|
|
@@ -11351,83 +11708,13 @@ function ArrowParameters(ctx, state2) {
|
|
|
11351
11708
|
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) {
|
|
11352
11709
|
var tp = $1;
|
|
11353
11710
|
var open = $2;
|
|
11354
|
-
var
|
|
11711
|
+
var parameters = $3;
|
|
11355
11712
|
var close = $4;
|
|
11356
|
-
let tt, before = [], rest, after = [], errors = [];
|
|
11357
|
-
function append2(p) {
|
|
11358
|
-
(rest ? after : before).push(p);
|
|
11359
|
-
}
|
|
11360
|
-
for (const param of params) {
|
|
11361
|
-
switch (param.type) {
|
|
11362
|
-
case "ThisType":
|
|
11363
|
-
if (tt) {
|
|
11364
|
-
append2({
|
|
11365
|
-
type: "Error",
|
|
11366
|
-
message: "Only one typed this parameter is allowed"
|
|
11367
|
-
});
|
|
11368
|
-
append2(param);
|
|
11369
|
-
} else {
|
|
11370
|
-
tt = trimFirstSpace(param);
|
|
11371
|
-
if (before.length || rest) {
|
|
11372
|
-
let delim = tt.children.at(-1);
|
|
11373
|
-
if (Array.isArray(delim))
|
|
11374
|
-
delim = delim.at(-1);
|
|
11375
|
-
if (delim?.token !== ",") {
|
|
11376
|
-
tt = {
|
|
11377
|
-
...tt,
|
|
11378
|
-
children: [...tt.children, ", "]
|
|
11379
|
-
};
|
|
11380
|
-
}
|
|
11381
|
-
}
|
|
11382
|
-
}
|
|
11383
|
-
break;
|
|
11384
|
-
case "FunctionRestParameter":
|
|
11385
|
-
if (rest) {
|
|
11386
|
-
append2({
|
|
11387
|
-
type: "Error",
|
|
11388
|
-
message: "Only one rest parameter is allowed"
|
|
11389
|
-
});
|
|
11390
|
-
append2(param);
|
|
11391
|
-
} else {
|
|
11392
|
-
rest = param;
|
|
11393
|
-
}
|
|
11394
|
-
break;
|
|
11395
|
-
default:
|
|
11396
|
-
append2(param);
|
|
11397
|
-
}
|
|
11398
|
-
}
|
|
11399
|
-
const names = before.flatMap((p) => p.names);
|
|
11400
|
-
if (rest) {
|
|
11401
|
-
const restIdentifier = rest.binding.ref || rest.binding;
|
|
11402
|
-
names.push(...rest.names || []);
|
|
11403
|
-
let blockPrefix;
|
|
11404
|
-
if (after.length) {
|
|
11405
|
-
blockPrefix = {
|
|
11406
|
-
children: ["[", trimFirstSpace(after), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
|
|
11407
|
-
names: after.flatMap((p) => p.names)
|
|
11408
|
-
};
|
|
11409
|
-
}
|
|
11410
|
-
return {
|
|
11411
|
-
type: "Parameters",
|
|
11412
|
-
children: [
|
|
11413
|
-
tp,
|
|
11414
|
-
open,
|
|
11415
|
-
tt,
|
|
11416
|
-
...before,
|
|
11417
|
-
// Remove delimiter
|
|
11418
|
-
{ ...rest, children: rest.children.slice(0, -1) },
|
|
11419
|
-
close
|
|
11420
|
-
],
|
|
11421
|
-
tp,
|
|
11422
|
-
names,
|
|
11423
|
-
blockPrefix
|
|
11424
|
-
};
|
|
11425
|
-
}
|
|
11426
11713
|
return {
|
|
11427
11714
|
type: "Parameters",
|
|
11428
|
-
children: [tp, open,
|
|
11429
|
-
|
|
11430
|
-
|
|
11715
|
+
children: [tp, open, parameters, close],
|
|
11716
|
+
tp,
|
|
11717
|
+
parameters
|
|
11431
11718
|
};
|
|
11432
11719
|
});
|
|
11433
11720
|
function NonEmptyParameters(ctx, state2) {
|
|
@@ -11448,8 +11735,7 @@ function ParameterList(ctx, state2) {
|
|
|
11448
11735
|
}
|
|
11449
11736
|
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) {
|
|
11450
11737
|
var params = $2;
|
|
11451
|
-
if (!params.length)
|
|
11452
|
-
return $skip;
|
|
11738
|
+
if (!params.length) return $skip;
|
|
11453
11739
|
return params;
|
|
11454
11740
|
});
|
|
11455
11741
|
function NestedParameterList(ctx, state2) {
|
|
@@ -11473,12 +11759,15 @@ function Parameter(ctx, state2) {
|
|
|
11473
11759
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "Parameter", Parameter$$);
|
|
11474
11760
|
}
|
|
11475
11761
|
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) {
|
|
11476
|
-
var
|
|
11762
|
+
var rest = $2;
|
|
11763
|
+
var typeSuffix = $3;
|
|
11477
11764
|
return {
|
|
11478
11765
|
type: "FunctionRestParameter",
|
|
11479
11766
|
children: $0.slice(1),
|
|
11480
|
-
|
|
11481
|
-
|
|
11767
|
+
rest,
|
|
11768
|
+
names: rest.names,
|
|
11769
|
+
binding: rest.binding,
|
|
11770
|
+
typeSuffix
|
|
11482
11771
|
};
|
|
11483
11772
|
});
|
|
11484
11773
|
function FunctionRestParameter(ctx, state2) {
|
|
@@ -11565,7 +11854,7 @@ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExp
|
|
|
11565
11854
|
var expression = $2;
|
|
11566
11855
|
return {
|
|
11567
11856
|
type: "PinPattern",
|
|
11568
|
-
children:
|
|
11857
|
+
children: [expression],
|
|
11569
11858
|
expression
|
|
11570
11859
|
};
|
|
11571
11860
|
});
|
|
@@ -11626,8 +11915,7 @@ function ObjectBindingPattern(ctx, state2) {
|
|
|
11626
11915
|
var ObjectBindingPatternContent$0 = NestedBindingProperties;
|
|
11627
11916
|
var ObjectBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingPropertyList), function($skip, $loc, $0, $1) {
|
|
11628
11917
|
var props = $0;
|
|
11629
|
-
if (!props)
|
|
11630
|
-
return { children: [], names: [] };
|
|
11918
|
+
if (!props) return { children: [], names: [] };
|
|
11631
11919
|
return reorderBindingRestProperty(props);
|
|
11632
11920
|
});
|
|
11633
11921
|
var ObjectBindingPatternContent$$ = [ObjectBindingPatternContent$0, ObjectBindingPatternContent$1];
|
|
@@ -11667,8 +11955,7 @@ function ArrayBindingPattern(ctx, state2) {
|
|
|
11667
11955
|
var ArrayBindingPatternContent$0 = NestedBindingElements;
|
|
11668
11956
|
var ArrayBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingElementList), function($skip, $loc, $0, $1) {
|
|
11669
11957
|
var elements = $0;
|
|
11670
|
-
if (!elements)
|
|
11671
|
-
return { children: [], names: [], length: 0 };
|
|
11958
|
+
if (!elements) return { children: [], names: [], length: 0 };
|
|
11672
11959
|
return adjustBindingElements(elements);
|
|
11673
11960
|
});
|
|
11674
11961
|
var ArrayBindingPatternContent$$ = [ArrayBindingPatternContent$0, ArrayBindingPatternContent$1];
|
|
@@ -11693,8 +11980,7 @@ var NestedBindingElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
|
|
|
11693
11980
|
var indent = $1;
|
|
11694
11981
|
var elements = $2;
|
|
11695
11982
|
return elements.map((element, i) => {
|
|
11696
|
-
if (i > 0)
|
|
11697
|
-
return element;
|
|
11983
|
+
if (i > 0) return element;
|
|
11698
11984
|
return {
|
|
11699
11985
|
...element,
|
|
11700
11986
|
children: [indent, ...element.children.slice(1)]
|
|
@@ -11711,8 +11997,7 @@ function Elision(ctx, state2) {
|
|
|
11711
11997
|
}
|
|
11712
11998
|
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) {
|
|
11713
11999
|
var props = $2;
|
|
11714
|
-
if (!props.length)
|
|
11715
|
-
return $skip;
|
|
12000
|
+
if (!props.length) return $skip;
|
|
11716
12001
|
return reorderBindingRestProperty(props.flat());
|
|
11717
12002
|
});
|
|
11718
12003
|
function NestedBindingProperties(ctx, state2) {
|
|
@@ -11722,8 +12007,7 @@ var NestedBindingPropertyList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Neste
|
|
|
11722
12007
|
var ws = $1;
|
|
11723
12008
|
var props = $2;
|
|
11724
12009
|
return props.map((prop, i) => {
|
|
11725
|
-
if (i > 0)
|
|
11726
|
-
return prop;
|
|
12010
|
+
if (i > 0) return prop;
|
|
11727
12011
|
return prepend(ws, prop);
|
|
11728
12012
|
});
|
|
11729
12013
|
});
|
|
@@ -11785,6 +12069,7 @@ var BindingProperty$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
11785
12069
|
name: binding,
|
|
11786
12070
|
value: {
|
|
11787
12071
|
type: "PinPattern",
|
|
12072
|
+
children: [binding],
|
|
11788
12073
|
expression: binding
|
|
11789
12074
|
}
|
|
11790
12075
|
};
|
|
@@ -11848,8 +12133,7 @@ function BindingTypeSuffix(ctx, state2) {
|
|
|
11848
12133
|
}
|
|
11849
12134
|
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) {
|
|
11850
12135
|
var elements = $2;
|
|
11851
|
-
if (!elements.length)
|
|
11852
|
-
return $skip;
|
|
12136
|
+
if (!elements.length) return $skip;
|
|
11853
12137
|
return adjustBindingElements(elements.flat());
|
|
11854
12138
|
});
|
|
11855
12139
|
function NestedBindingElements(ctx, state2) {
|
|
@@ -11888,7 +12172,7 @@ var BindingRestElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
11888
12172
|
var typeSuffix = $4;
|
|
11889
12173
|
return {
|
|
11890
12174
|
type: "BindingRestElement",
|
|
11891
|
-
children: [ws,
|
|
12175
|
+
children: [ws, dots, binding],
|
|
11892
12176
|
dots,
|
|
11893
12177
|
binding,
|
|
11894
12178
|
typeSuffix,
|
|
@@ -11928,10 +12212,8 @@ function EmptyBindingPattern(ctx, state2) {
|
|
|
11928
12212
|
return (0, import_lib2.$EVENT)(ctx, state2, "EmptyBindingPattern", EmptyBindingPattern$0);
|
|
11929
12213
|
}
|
|
11930
12214
|
var FunctionDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionExpression), function($skip, $loc, $0, $1) {
|
|
11931
|
-
if ($1.type !== "FunctionExpression")
|
|
11932
|
-
|
|
11933
|
-
if ($1.id)
|
|
11934
|
-
return $1;
|
|
12215
|
+
if ($1.type !== "FunctionExpression") return $skip;
|
|
12216
|
+
if ($1.id) return $1;
|
|
11935
12217
|
return makeLeftHandSideExpression($1);
|
|
11936
12218
|
});
|
|
11937
12219
|
function FunctionDeclaration(ctx, state2) {
|
|
@@ -11945,10 +12227,8 @@ var FunctionSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
11945
12227
|
var w = $5;
|
|
11946
12228
|
var parameters = $6;
|
|
11947
12229
|
var returnType = $7;
|
|
11948
|
-
if (!async)
|
|
11949
|
-
|
|
11950
|
-
if (!generator)
|
|
11951
|
-
generator = [];
|
|
12230
|
+
if (!async) async = [];
|
|
12231
|
+
if (!generator) generator = [];
|
|
11952
12232
|
const id = wid?.[1];
|
|
11953
12233
|
return {
|
|
11954
12234
|
type: "FunctionSignature",
|
|
@@ -11993,16 +12273,16 @@ var FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
11993
12273
|
var open = $2;
|
|
11994
12274
|
var op = $3;
|
|
11995
12275
|
var close = $4;
|
|
11996
|
-
if (op.special && op.call && !op.negated)
|
|
11997
|
-
return op.call;
|
|
12276
|
+
if (op.special && op.call && !op.negated) return op.call;
|
|
11998
12277
|
const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
|
|
11999
12278
|
[[], op, [], refB]
|
|
12000
12279
|
// BinaryOpRHS
|
|
12001
12280
|
]]);
|
|
12281
|
+
const parameterList = [[refA, ","], refB];
|
|
12002
12282
|
const parameters = {
|
|
12003
12283
|
type: "Parameters",
|
|
12004
|
-
children: ["(",
|
|
12005
|
-
|
|
12284
|
+
children: ["(", parameterList, ")"],
|
|
12285
|
+
parameters: parameterList
|
|
12006
12286
|
};
|
|
12007
12287
|
const block = {
|
|
12008
12288
|
expressions: [body]
|
|
@@ -12163,10 +12443,8 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12163
12443
|
var w2 = $8;
|
|
12164
12444
|
var parameters = $9;
|
|
12165
12445
|
var returnType = $10;
|
|
12166
|
-
if (!async)
|
|
12167
|
-
|
|
12168
|
-
if (!generator)
|
|
12169
|
-
generator = [];
|
|
12446
|
+
if (!async) async = [];
|
|
12447
|
+
if (!generator) generator = [];
|
|
12170
12448
|
if (!func) {
|
|
12171
12449
|
func = { $loc: op.$loc, token: "function" };
|
|
12172
12450
|
} else {
|
|
@@ -12235,8 +12513,7 @@ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12235
12513
|
var returnType = $3;
|
|
12236
12514
|
var arrow = $5;
|
|
12237
12515
|
var block = $6;
|
|
12238
|
-
if (!async)
|
|
12239
|
-
async = [];
|
|
12516
|
+
if (!async) async = [];
|
|
12240
12517
|
const generator = [];
|
|
12241
12518
|
return {
|
|
12242
12519
|
type: "FunctionExpression",
|
|
@@ -12281,8 +12558,7 @@ var ExplicitBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
|
12281
12558
|
var block = $4;
|
|
12282
12559
|
var ws2 = $6;
|
|
12283
12560
|
var close = $7;
|
|
12284
|
-
if (!block)
|
|
12285
|
-
return $skip;
|
|
12561
|
+
if (!block) return $skip;
|
|
12286
12562
|
return {
|
|
12287
12563
|
...block,
|
|
12288
12564
|
children: [ws1, open, ...block.children, ws2, close],
|
|
@@ -12295,8 +12571,7 @@ var ExplicitBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IndentedAtLeast,
|
|
|
12295
12571
|
var block = $4;
|
|
12296
12572
|
var ws2 = $6;
|
|
12297
12573
|
var close = $7;
|
|
12298
|
-
if (!block)
|
|
12299
|
-
return $skip;
|
|
12574
|
+
if (!block) return $skip;
|
|
12300
12575
|
return {
|
|
12301
12576
|
...block,
|
|
12302
12577
|
children: [ws1, open, ...block.children, ws2, close],
|
|
@@ -12321,8 +12596,7 @@ function EmptyBracedContent(ctx, state2) {
|
|
|
12321
12596
|
}
|
|
12322
12597
|
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) {
|
|
12323
12598
|
var open = $2;
|
|
12324
|
-
if (!$4)
|
|
12325
|
-
return $skip;
|
|
12599
|
+
if (!$4) return $skip;
|
|
12326
12600
|
const [block, ...tail] = $4;
|
|
12327
12601
|
return {
|
|
12328
12602
|
...block,
|
|
@@ -12352,8 +12626,7 @@ function Block(ctx, state2) {
|
|
|
12352
12626
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "Block", Block$$);
|
|
12353
12627
|
}
|
|
12354
12628
|
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) {
|
|
12355
|
-
if (!$3)
|
|
12356
|
-
return $skip;
|
|
12629
|
+
if (!$3) return $skip;
|
|
12357
12630
|
return $3;
|
|
12358
12631
|
});
|
|
12359
12632
|
function BareNestedBlock(ctx, state2) {
|
|
@@ -12489,8 +12762,7 @@ var BracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, (0
|
|
|
12489
12762
|
var s = $3;
|
|
12490
12763
|
var ws = $4;
|
|
12491
12764
|
var c = $5;
|
|
12492
|
-
if (!s.children.length)
|
|
12493
|
-
return $skip;
|
|
12765
|
+
if (!s.children.length) return $skip;
|
|
12494
12766
|
return {
|
|
12495
12767
|
type: "BlockStatement",
|
|
12496
12768
|
expressions: s.expressions,
|
|
@@ -12508,8 +12780,7 @@ var NoPostfixBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpen
|
|
|
12508
12780
|
var s = $3;
|
|
12509
12781
|
var ws = $4;
|
|
12510
12782
|
var c = $5;
|
|
12511
|
-
if (!s.expressions.length)
|
|
12512
|
-
return $skip;
|
|
12783
|
+
if (!s.expressions.length) return $skip;
|
|
12513
12784
|
return {
|
|
12514
12785
|
type: "BlockStatement",
|
|
12515
12786
|
expressions: s.expressions,
|
|
@@ -12527,8 +12798,7 @@ var NoCommaBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBr
|
|
|
12527
12798
|
var s = $3;
|
|
12528
12799
|
var ws = $4;
|
|
12529
12800
|
var c = $5;
|
|
12530
|
-
if (!s.children.length)
|
|
12531
|
-
return $skip;
|
|
12801
|
+
if (!s.children.length) return $skip;
|
|
12532
12802
|
return {
|
|
12533
12803
|
type: "BlockStatement",
|
|
12534
12804
|
expressions: s.expressions,
|
|
@@ -12569,11 +12839,9 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
|
|
|
12569
12839
|
var stmts = $2;
|
|
12570
12840
|
var last = $3;
|
|
12571
12841
|
const expressions = [...stmts];
|
|
12572
|
-
if (last)
|
|
12573
|
-
expressions.push(last);
|
|
12842
|
+
if (last) expressions.push(last);
|
|
12574
12843
|
const children = [expressions];
|
|
12575
|
-
if (hasTrailingComment(expressions))
|
|
12576
|
-
children.push(["\n"]);
|
|
12844
|
+
if (hasTrailingComment(expressions)) children.push(["\n"]);
|
|
12577
12845
|
return {
|
|
12578
12846
|
type: "BlockStatement",
|
|
12579
12847
|
expressions,
|
|
@@ -12588,8 +12856,7 @@ var PostfixedSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
|
|
|
12588
12856
|
var stmts = $1;
|
|
12589
12857
|
var last = $2;
|
|
12590
12858
|
const children = [...stmts];
|
|
12591
|
-
if (last)
|
|
12592
|
-
children.push(last);
|
|
12859
|
+
if (last) children.push(last);
|
|
12593
12860
|
return {
|
|
12594
12861
|
type: "BlockStatement",
|
|
12595
12862
|
expressions: children,
|
|
@@ -12604,8 +12871,7 @@ var PostfixedSingleLineNoCommaStatements$0 = (0, import_lib2.$TS)((0, import_lib
|
|
|
12604
12871
|
var stmts = $1;
|
|
12605
12872
|
var last = $2;
|
|
12606
12873
|
const children = [...stmts];
|
|
12607
|
-
if (last)
|
|
12608
|
-
children.push(last);
|
|
12874
|
+
if (last) children.push(last);
|
|
12609
12875
|
return {
|
|
12610
12876
|
type: "BlockStatement",
|
|
12611
12877
|
expressions: children,
|
|
@@ -12618,8 +12884,7 @@ function PostfixedSingleLineNoCommaStatements(ctx, state2) {
|
|
|
12618
12884
|
}
|
|
12619
12885
|
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) {
|
|
12620
12886
|
var statements = $2;
|
|
12621
|
-
if (!statements.length)
|
|
12622
|
-
return $skip;
|
|
12887
|
+
if (!statements.length) return $skip;
|
|
12623
12888
|
statements = statements.flat();
|
|
12624
12889
|
return {
|
|
12625
12890
|
type: "BlockStatement",
|
|
@@ -12646,8 +12911,7 @@ var BlockStatementPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
12646
12911
|
var ws = $2;
|
|
12647
12912
|
var statement = $3;
|
|
12648
12913
|
var delimiter = $4;
|
|
12649
|
-
if (ws)
|
|
12650
|
-
statement = prepend(ws, statement);
|
|
12914
|
+
if (ws) statement = prepend(ws, statement);
|
|
12651
12915
|
return [statement, delimiter];
|
|
12652
12916
|
});
|
|
12653
12917
|
function BlockStatementPart(ctx, state2) {
|
|
@@ -12674,7 +12938,7 @@ function LiteralContent(ctx, state2) {
|
|
|
12674
12938
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "LiteralContent", LiteralContent$$);
|
|
12675
12939
|
}
|
|
12676
12940
|
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) {
|
|
12677
|
-
return { $loc, token: $1 };
|
|
12941
|
+
return { type: "NullLiteral", $loc, token: $1 };
|
|
12678
12942
|
});
|
|
12679
12943
|
function NullLiteral(ctx, state2) {
|
|
12680
12944
|
return (0, import_lib2.$EVENT)(ctx, state2, "NullLiteral", NullLiteral$0);
|
|
@@ -12689,17 +12953,17 @@ var _BooleanLiteral$0 = (0, import_lib2.$T)((0, import_lib2.$S)(CoffeeBooleansEn
|
|
|
12689
12953
|
return value[1];
|
|
12690
12954
|
});
|
|
12691
12955
|
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) {
|
|
12692
|
-
return { $loc, token: $1 };
|
|
12956
|
+
return { type: "BooleanLiteral", $loc, token: $1 };
|
|
12693
12957
|
});
|
|
12694
12958
|
var _BooleanLiteral$$ = [_BooleanLiteral$0, _BooleanLiteral$1];
|
|
12695
12959
|
function _BooleanLiteral(ctx, state2) {
|
|
12696
12960
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "_BooleanLiteral", _BooleanLiteral$$);
|
|
12697
12961
|
}
|
|
12698
12962
|
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) {
|
|
12699
|
-
return { $loc, token: "true" };
|
|
12963
|
+
return { type: "BooleanLiteral", $loc, token: "true" };
|
|
12700
12964
|
});
|
|
12701
12965
|
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) {
|
|
12702
|
-
return { $loc, token: "false" };
|
|
12966
|
+
return { type: "BooleanLiteral", $loc, token: "false" };
|
|
12703
12967
|
});
|
|
12704
12968
|
var CoffeeScriptBooleanLiteral$$ = [CoffeeScriptBooleanLiteral$0, CoffeeScriptBooleanLiteral$1];
|
|
12705
12969
|
function CoffeeScriptBooleanLiteral(ctx, state2) {
|
|
@@ -12796,8 +13060,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
|
|
|
12796
13060
|
var open = $1;
|
|
12797
13061
|
var close = $2;
|
|
12798
13062
|
var content = $5;
|
|
12799
|
-
if (!content)
|
|
12800
|
-
return $skip;
|
|
13063
|
+
if (!content) return $skip;
|
|
12801
13064
|
let last = content[content.length - 1];
|
|
12802
13065
|
let lastArray = Array.isArray(last) ? last : last.children;
|
|
12803
13066
|
if (isComma(lastArray[lastArray.length - 1])) {
|
|
@@ -12817,8 +13080,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
|
|
|
12817
13080
|
});
|
|
12818
13081
|
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) {
|
|
12819
13082
|
var open = $1;
|
|
12820
|
-
if (!$3)
|
|
12821
|
-
return $skip;
|
|
13083
|
+
if (!$3) return $skip;
|
|
12822
13084
|
const [content, ws, close] = $3;
|
|
12823
13085
|
if (content.type === "RangeExpression") {
|
|
12824
13086
|
return prepend(ws, content);
|
|
@@ -12953,8 +13215,7 @@ var ArrayLiteralContent$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(ElementList
|
|
|
12953
13215
|
var list = $1;
|
|
12954
13216
|
var delimiter = $2;
|
|
12955
13217
|
var nested = $3;
|
|
12956
|
-
if (!nested)
|
|
12957
|
-
return list;
|
|
13218
|
+
if (!nested) return list;
|
|
12958
13219
|
return [...list, delimiter, ...nested];
|
|
12959
13220
|
});
|
|
12960
13221
|
var ArrayLiteralContent$3 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, ElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
|
|
@@ -12978,13 +13239,10 @@ var NestedElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, ElementLi
|
|
|
12978
13239
|
var list = $2;
|
|
12979
13240
|
var delimiter = $3;
|
|
12980
13241
|
const { length } = list;
|
|
12981
|
-
if (!length)
|
|
12982
|
-
return $skip;
|
|
13242
|
+
if (!length) return $skip;
|
|
12983
13243
|
return list.map((e, i) => {
|
|
12984
|
-
if (i === 0)
|
|
12985
|
-
|
|
12986
|
-
if (i === length - 1)
|
|
12987
|
-
e = append(e, delimiter);
|
|
13244
|
+
if (i === 0) e = prepend(indent, e);
|
|
13245
|
+
if (i === length - 1) e = append(e, delimiter);
|
|
12988
13246
|
return e;
|
|
12989
13247
|
});
|
|
12990
13248
|
});
|
|
@@ -13001,8 +13259,7 @@ function ArrayElementDelimiter(ctx, state2) {
|
|
|
13001
13259
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrayElementDelimiter", ArrayElementDelimiter$$);
|
|
13002
13260
|
}
|
|
13003
13261
|
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) {
|
|
13004
|
-
if ($2)
|
|
13005
|
-
return $2;
|
|
13262
|
+
if ($2) return $2;
|
|
13006
13263
|
return $skip;
|
|
13007
13264
|
});
|
|
13008
13265
|
function ElementListWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -13019,8 +13276,7 @@ function ElementList(ctx, state2) {
|
|
|
13019
13276
|
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) {
|
|
13020
13277
|
var first = $2;
|
|
13021
13278
|
var rest = $3;
|
|
13022
|
-
if (!rest.length)
|
|
13023
|
-
return [first];
|
|
13279
|
+
if (!rest.length) return [first];
|
|
13024
13280
|
return [
|
|
13025
13281
|
append(first, rest[0][0])
|
|
13026
13282
|
].concat(
|
|
@@ -13085,8 +13341,7 @@ var NestedBulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
|
|
|
13085
13341
|
var open = $1;
|
|
13086
13342
|
var content = $4;
|
|
13087
13343
|
var close = $6;
|
|
13088
|
-
if (!content.length)
|
|
13089
|
-
return $skip;
|
|
13344
|
+
if (!content.length) return $skip;
|
|
13090
13345
|
content = content.flat();
|
|
13091
13346
|
const last = content[content.length - 1];
|
|
13092
13347
|
if (last.children?.at(-1)?.implicit) {
|
|
@@ -13104,8 +13359,7 @@ var BulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket
|
|
|
13104
13359
|
var open = $1;
|
|
13105
13360
|
var content = $2;
|
|
13106
13361
|
var close = $3;
|
|
13107
|
-
if (!content)
|
|
13108
|
-
return $skip;
|
|
13362
|
+
if (!content) return $skip;
|
|
13109
13363
|
content = [
|
|
13110
13364
|
...trimFirstSpace(content[0]),
|
|
13111
13365
|
// replace first space with bracket
|
|
@@ -13134,11 +13388,9 @@ function NestedArrayBullet(ctx, state2) {
|
|
|
13134
13388
|
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) {
|
|
13135
13389
|
var bullet = $1;
|
|
13136
13390
|
var content = $2;
|
|
13137
|
-
if (!content)
|
|
13138
|
-
return $skip;
|
|
13391
|
+
if (!content) return $skip;
|
|
13139
13392
|
let [list, delimiter] = content;
|
|
13140
|
-
if (!list.length)
|
|
13141
|
-
return $skip;
|
|
13393
|
+
if (!list.length) return $skip;
|
|
13142
13394
|
list = list.slice();
|
|
13143
13395
|
list[0] = prepend(bullet, list[0]);
|
|
13144
13396
|
if (delimiter) {
|
|
@@ -13165,8 +13417,7 @@ var BulletIndent$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Bullet), function(
|
|
|
13165
13417
|
$loc,
|
|
13166
13418
|
level: getIndentLevel(" ".repeat(state.currentIndent.level) + bullet + ws, config.tab)
|
|
13167
13419
|
};
|
|
13168
|
-
if (config.verbose)
|
|
13169
|
-
console.log("pushing bullet indent", indent);
|
|
13420
|
+
if (config.verbose) console.log("pushing bullet indent", indent);
|
|
13170
13421
|
state.indentLevels.push(indent);
|
|
13171
13422
|
return indent;
|
|
13172
13423
|
});
|
|
@@ -13211,8 +13462,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
|
|
|
13211
13462
|
var open = $1;
|
|
13212
13463
|
var close = $2;
|
|
13213
13464
|
var properties = $5;
|
|
13214
|
-
if (!properties?.length)
|
|
13215
|
-
return $skip;
|
|
13465
|
+
if (!properties?.length) return $skip;
|
|
13216
13466
|
let last = properties[properties.length - 1];
|
|
13217
13467
|
if (last.delim?.implicit) {
|
|
13218
13468
|
last = {
|
|
@@ -13231,8 +13481,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
|
|
|
13231
13481
|
});
|
|
13232
13482
|
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) {
|
|
13233
13483
|
var open = $1;
|
|
13234
|
-
if (!$3)
|
|
13235
|
-
return $skip;
|
|
13484
|
+
if (!$3) return $skip;
|
|
13236
13485
|
const [properties, ...close] = $3;
|
|
13237
13486
|
return {
|
|
13238
13487
|
type: "ObjectExpression",
|
|
@@ -13250,8 +13499,7 @@ var SingleLineObjectProperties$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0,
|
|
|
13250
13499
|
return line.flatMap(([prop, delim]) => {
|
|
13251
13500
|
prop = Array.isArray(prop) ? prop : [prop];
|
|
13252
13501
|
let last = prop[prop.length - 1];
|
|
13253
|
-
if (!last)
|
|
13254
|
-
return [];
|
|
13502
|
+
if (!last) return [];
|
|
13255
13503
|
last = {
|
|
13256
13504
|
...last,
|
|
13257
13505
|
delim,
|
|
@@ -13288,8 +13536,7 @@ function BracedObjectLiteralContent(ctx, state2) {
|
|
|
13288
13536
|
}
|
|
13289
13537
|
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) {
|
|
13290
13538
|
var properties = $4;
|
|
13291
|
-
if (!properties)
|
|
13292
|
-
return $skip;
|
|
13539
|
+
if (!properties) return $skip;
|
|
13293
13540
|
return {
|
|
13294
13541
|
type: "ObjectExpression",
|
|
13295
13542
|
properties,
|
|
@@ -13323,8 +13570,7 @@ function NestedImplicitPropertyDefinition(ctx, state2) {
|
|
|
13323
13570
|
}
|
|
13324
13571
|
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) {
|
|
13325
13572
|
var defs = $2;
|
|
13326
|
-
if (!defs.length)
|
|
13327
|
-
return $skip;
|
|
13573
|
+
if (!defs.length) return $skip;
|
|
13328
13574
|
return defs.flat();
|
|
13329
13575
|
});
|
|
13330
13576
|
function NestedPropertyDefinitions(ctx, state2) {
|
|
@@ -13334,8 +13580,7 @@ var NestedPropertyDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
|
|
|
13334
13580
|
var ws = $1;
|
|
13335
13581
|
var inlineProps = $2;
|
|
13336
13582
|
return inlineProps.flatMap(([prop, delim], i) => {
|
|
13337
|
-
if (!Array.isArray(prop))
|
|
13338
|
-
prop = [prop];
|
|
13583
|
+
if (!Array.isArray(prop)) prop = [prop];
|
|
13339
13584
|
if (i === 0) {
|
|
13340
13585
|
const [first, ...rest] = prop;
|
|
13341
13586
|
prop = [prepend(ws, first), ...rest];
|
|
@@ -13468,8 +13713,7 @@ var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13468
13713
|
children: def.children.flatMap((c, i) => i ? [",", c] : [c])
|
|
13469
13714
|
};
|
|
13470
13715
|
}
|
|
13471
|
-
if (!def.block || def.block.empty)
|
|
13472
|
-
return $skip;
|
|
13716
|
+
if (!def.block || def.block.empty) return $skip;
|
|
13473
13717
|
return prepend(ws, def);
|
|
13474
13718
|
});
|
|
13475
13719
|
var PropertyDefinition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), DotDotDot, Expression), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -13491,8 +13735,11 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13491
13735
|
var post = $5;
|
|
13492
13736
|
if (!pre.length && !post) {
|
|
13493
13737
|
switch (value.type) {
|
|
13738
|
+
// `{identifier}` remains `{identifier}`, the one shorthand JS supports
|
|
13494
13739
|
case "Identifier":
|
|
13495
13740
|
return prepend(ws, value);
|
|
13741
|
+
// PropertyGlob like x.{a,b} turns into ObjectExpression {a: x.a, b: x.b}
|
|
13742
|
+
// (via `processCallMemberExpression`)
|
|
13496
13743
|
case "ObjectExpression":
|
|
13497
13744
|
let first = value.properties[0];
|
|
13498
13745
|
if (first) {
|
|
@@ -13506,8 +13753,7 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13506
13753
|
}
|
|
13507
13754
|
}
|
|
13508
13755
|
const last = lastAccessInCallExpression(value);
|
|
13509
|
-
if (!last)
|
|
13510
|
-
return $skip;
|
|
13756
|
+
if (!last) return $skip;
|
|
13511
13757
|
let name, ref, refAssignment;
|
|
13512
13758
|
const { expression, type } = last;
|
|
13513
13759
|
if (type === "Index") {
|
|
@@ -13520,11 +13766,10 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13520
13766
|
value = {
|
|
13521
13767
|
...value,
|
|
13522
13768
|
children: value.children.map((c) => {
|
|
13523
|
-
if (c === last)
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
};
|
|
13769
|
+
if (c === last) return {
|
|
13770
|
+
type: "Index",
|
|
13771
|
+
children: ["[", ref, "]"]
|
|
13772
|
+
};
|
|
13528
13773
|
return c;
|
|
13529
13774
|
})
|
|
13530
13775
|
};
|
|
@@ -13536,11 +13781,9 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
13536
13781
|
}
|
|
13537
13782
|
} else {
|
|
13538
13783
|
({ name } = last);
|
|
13539
|
-
if (!name)
|
|
13540
|
-
return $skip;
|
|
13784
|
+
if (!name) return $skip;
|
|
13541
13785
|
}
|
|
13542
|
-
if (name[0] === "#")
|
|
13543
|
-
name = name.slice(1);
|
|
13786
|
+
if (name[0] === "#") name = name.slice(1);
|
|
13544
13787
|
return {
|
|
13545
13788
|
type: "Property",
|
|
13546
13789
|
children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
|
|
@@ -13611,8 +13854,7 @@ var ComputedPropertyName$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracke
|
|
|
13611
13854
|
});
|
|
13612
13855
|
var ComputedPropertyName$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket, TemplateLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3) {
|
|
13613
13856
|
var expression = $2;
|
|
13614
|
-
if ($2.type === "StringLiteral")
|
|
13615
|
-
return $2;
|
|
13857
|
+
if ($2.type === "StringLiteral") return $2;
|
|
13616
13858
|
return {
|
|
13617
13859
|
type: "ComputedPropertyName",
|
|
13618
13860
|
children: $0,
|
|
@@ -13639,8 +13881,7 @@ function Decorator(ctx, state2) {
|
|
|
13639
13881
|
}
|
|
13640
13882
|
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) {
|
|
13641
13883
|
var decorators = $2;
|
|
13642
|
-
if (!decorators.length)
|
|
13643
|
-
return $skip;
|
|
13884
|
+
if (!decorators.length) return $skip;
|
|
13644
13885
|
return $0;
|
|
13645
13886
|
});
|
|
13646
13887
|
function Decorators(ctx, state2) {
|
|
@@ -13679,8 +13920,7 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
|
|
|
13679
13920
|
var ws = $2;
|
|
13680
13921
|
var content = $4;
|
|
13681
13922
|
var block = $6;
|
|
13682
|
-
if (!content)
|
|
13683
|
-
return $skip;
|
|
13923
|
+
if (!content) return $skip;
|
|
13684
13924
|
const [base, rest, returnType] = content;
|
|
13685
13925
|
const value = [base, rest];
|
|
13686
13926
|
if (!rest.length) {
|
|
@@ -13691,12 +13931,9 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
|
|
|
13691
13931
|
({ name: name2 } = lastAccess2);
|
|
13692
13932
|
}
|
|
13693
13933
|
}
|
|
13694
|
-
if (!name2)
|
|
13695
|
-
|
|
13696
|
-
if (
|
|
13697
|
-
return $skip;
|
|
13698
|
-
if (name2[0] === "#")
|
|
13699
|
-
name2 = name2.slice(1);
|
|
13934
|
+
if (!name2) ({ name: name2 } = base);
|
|
13935
|
+
if (!name2) return $skip;
|
|
13936
|
+
if (name2[0] === "#") name2 = name2.slice(1);
|
|
13700
13937
|
const autoReturn = !block || base.type !== "Identifier";
|
|
13701
13938
|
return makeGetterMethod(name2, ws, base, returnType, block, kind, autoReturn);
|
|
13702
13939
|
}
|
|
@@ -13769,10 +14006,8 @@ var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, im
|
|
|
13769
14006
|
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) {
|
|
13770
14007
|
var async = $1;
|
|
13771
14008
|
var generator = $2;
|
|
13772
|
-
if (!async)
|
|
13773
|
-
|
|
13774
|
-
if (!generator)
|
|
13775
|
-
generator = [];
|
|
14009
|
+
if (!async) async = [];
|
|
14010
|
+
if (!generator) generator = [];
|
|
13776
14011
|
return {
|
|
13777
14012
|
async,
|
|
13778
14013
|
generator,
|
|
@@ -13813,8 +14048,7 @@ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(MethodModifier,
|
|
|
13813
14048
|
} else if (name.token) {
|
|
13814
14049
|
name = name.token.match(/^(?:"|')/) ? name.token.slice(1, -1) : name.token;
|
|
13815
14050
|
}
|
|
13816
|
-
if (optional)
|
|
13817
|
-
optional = { ...optional, ts: true };
|
|
14051
|
+
if (optional) optional = { ...optional, ts: true };
|
|
13818
14052
|
return {
|
|
13819
14053
|
type: "MethodSignature",
|
|
13820
14054
|
children: [...modifier.children, name, ws1, optional, ws2, parameters, returnType],
|
|
@@ -13871,8 +14105,7 @@ var AssignmentOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentOpSymbol
|
|
|
13871
14105
|
children: [$1, ...$2]
|
|
13872
14106
|
};
|
|
13873
14107
|
}
|
|
13874
|
-
if (typeof $1 !== "string")
|
|
13875
|
-
return $1;
|
|
14108
|
+
if (typeof $1 !== "string") return $1;
|
|
13876
14109
|
return { $loc, token: $1 };
|
|
13877
14110
|
});
|
|
13878
14111
|
function AssignmentOp(ctx, state2) {
|
|
@@ -13990,10 +14223,8 @@ var NotDedentedBinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
|
|
|
13990
14223
|
var ws2 = $2;
|
|
13991
14224
|
var op = $3;
|
|
13992
14225
|
const ws = [];
|
|
13993
|
-
if (ws1)
|
|
13994
|
-
|
|
13995
|
-
if (ws2)
|
|
13996
|
-
ws.push(...ws2);
|
|
14226
|
+
if (ws1) ws.push(...ws1);
|
|
14227
|
+
if (ws2) ws.push(...ws2);
|
|
13997
14228
|
return [ws, op];
|
|
13998
14229
|
});
|
|
13999
14230
|
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) {
|
|
@@ -14001,8 +14232,7 @@ var NotDedentedBinaryOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedBinar
|
|
|
14001
14232
|
var ws2 = $3;
|
|
14002
14233
|
var op = $6;
|
|
14003
14234
|
const ws = [...ws1];
|
|
14004
|
-
if (ws2)
|
|
14005
|
-
ws.push(...ws2);
|
|
14235
|
+
if (ws2) ws.push(...ws2);
|
|
14006
14236
|
return [ws, op];
|
|
14007
14237
|
});
|
|
14008
14238
|
var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
|
|
@@ -14011,8 +14241,7 @@ function NotDedentedBinaryOp(ctx, state2) {
|
|
|
14011
14241
|
}
|
|
14012
14242
|
var IdentifierBinaryOp$0 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
|
|
14013
14243
|
var id = $0;
|
|
14014
|
-
if (state.operators.has(id.name))
|
|
14015
|
-
return id;
|
|
14244
|
+
if (state.operators.has(id.name)) return id;
|
|
14016
14245
|
return $skip;
|
|
14017
14246
|
});
|
|
14018
14247
|
function IdentifierBinaryOp(ctx, state2) {
|
|
@@ -14026,14 +14255,12 @@ function BinaryOp(ctx, state2) {
|
|
|
14026
14255
|
return (0, import_lib2.$EVENT)(ctx, state2, "BinaryOp", BinaryOp$0);
|
|
14027
14256
|
}
|
|
14028
14257
|
var _BinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BinaryOpSymbol), function($skip, $loc, $0, $1) {
|
|
14029
|
-
if (typeof $1 === "string")
|
|
14030
|
-
return { $loc, token: $1 };
|
|
14258
|
+
if (typeof $1 === "string") return { $loc, token: $1 };
|
|
14031
14259
|
return $1;
|
|
14032
14260
|
});
|
|
14033
14261
|
var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
|
|
14034
14262
|
var id = $0;
|
|
14035
|
-
if (!state.operators.has(id.name))
|
|
14036
|
-
return $skip;
|
|
14263
|
+
if (!state.operators.has(id.name)) return $skip;
|
|
14037
14264
|
return {
|
|
14038
14265
|
token: id.name,
|
|
14039
14266
|
call: id,
|
|
@@ -14043,8 +14270,7 @@ var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1)
|
|
|
14043
14270
|
});
|
|
14044
14271
|
var _BinaryOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __, Identifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
14045
14272
|
var id = $3;
|
|
14046
|
-
if (!state.operators.has(id.name))
|
|
14047
|
-
return $skip;
|
|
14273
|
+
if (!state.operators.has(id.name)) return $skip;
|
|
14048
14274
|
return {
|
|
14049
14275
|
token: id.name,
|
|
14050
14276
|
call: id,
|
|
@@ -14127,13 +14353,11 @@ var BinaryOpSymbol$24 = (0, import_lib2.$T)((0, import_lib2.$EXPECT)($L92, 'Bina
|
|
|
14127
14353
|
return "!==";
|
|
14128
14354
|
});
|
|
14129
14355
|
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) {
|
|
14130
|
-
if (config.coffeeEq)
|
|
14131
|
-
return "!==";
|
|
14356
|
+
if (config.coffeeEq) return "!==";
|
|
14132
14357
|
return "!=";
|
|
14133
14358
|
});
|
|
14134
14359
|
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) {
|
|
14135
|
-
if (config.coffeeIsnt)
|
|
14136
|
-
return "!==";
|
|
14360
|
+
if (config.coffeeIsnt) return "!==";
|
|
14137
14361
|
return $skip;
|
|
14138
14362
|
});
|
|
14139
14363
|
var BinaryOpSymbol$27 = (0, import_lib2.$EXPECT)($L96, 'BinaryOpSymbol "==="');
|
|
@@ -14141,8 +14365,7 @@ var BinaryOpSymbol$28 = (0, import_lib2.$T)((0, import_lib2.$C)((0, import_lib2.
|
|
|
14141
14365
|
return "===";
|
|
14142
14366
|
});
|
|
14143
14367
|
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) {
|
|
14144
|
-
if (config.coffeeEq)
|
|
14145
|
-
return "===";
|
|
14368
|
+
if (config.coffeeEq) return "===";
|
|
14146
14369
|
return "==";
|
|
14147
14370
|
});
|
|
14148
14371
|
var BinaryOpSymbol$30 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L102, 'BinaryOpSymbol "and"'), NonIdContinue), function(value) {
|
|
@@ -14340,8 +14563,7 @@ var UnaryOp$1 = AwaitOp;
|
|
|
14340
14563
|
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) {
|
|
14341
14564
|
var op = $1;
|
|
14342
14565
|
var ws = $3;
|
|
14343
|
-
if (!ws)
|
|
14344
|
-
return [op, [" "]];
|
|
14566
|
+
if (!ws) return [op, [" "]];
|
|
14345
14567
|
return [op, ws];
|
|
14346
14568
|
});
|
|
14347
14569
|
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) {
|
|
@@ -14385,8 +14607,7 @@ function StatementListItem(ctx, state2) {
|
|
|
14385
14607
|
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) {
|
|
14386
14608
|
var statement = $1;
|
|
14387
14609
|
var post = $2;
|
|
14388
|
-
if (post)
|
|
14389
|
-
return addPostfixStatement(statement, ...post);
|
|
14610
|
+
if (post) return addPostfixStatement(statement, ...post);
|
|
14390
14611
|
return statement;
|
|
14391
14612
|
});
|
|
14392
14613
|
function PostfixedStatement(ctx, state2) {
|
|
@@ -14401,8 +14622,7 @@ function NoCommaStatementListItem(ctx, state2) {
|
|
|
14401
14622
|
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) {
|
|
14402
14623
|
var statement = $1;
|
|
14403
14624
|
var post = $2;
|
|
14404
|
-
if (post)
|
|
14405
|
-
return addPostfixStatement(statement, ...post);
|
|
14625
|
+
if (post) return addPostfixStatement(statement, ...post);
|
|
14406
14626
|
return statement;
|
|
14407
14627
|
});
|
|
14408
14628
|
function PostfixedNoCommaStatement(ctx, state2) {
|
|
@@ -14411,8 +14631,7 @@ function PostfixedNoCommaStatement(ctx, state2) {
|
|
|
14411
14631
|
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) {
|
|
14412
14632
|
var expression = $1;
|
|
14413
14633
|
var post = $2;
|
|
14414
|
-
if (post)
|
|
14415
|
-
return attachPostfixStatementAsExpression(expression, post);
|
|
14634
|
+
if (post) return attachPostfixStatementAsExpression(expression, post);
|
|
14416
14635
|
return expression;
|
|
14417
14636
|
});
|
|
14418
14637
|
function PostfixedExpression(ctx, state2) {
|
|
@@ -14421,8 +14640,7 @@ function PostfixedExpression(ctx, state2) {
|
|
|
14421
14640
|
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) {
|
|
14422
14641
|
var expression = $1;
|
|
14423
14642
|
var post = $2;
|
|
14424
|
-
if (!post.length)
|
|
14425
|
-
return $1;
|
|
14643
|
+
if (!post.length) return $1;
|
|
14426
14644
|
if (post.length === 2 && !Array.isArray(post[1])) {
|
|
14427
14645
|
return attachPostfixStatementAsExpression(expression, post);
|
|
14428
14646
|
}
|
|
@@ -14451,10 +14669,8 @@ var Statement$2 = (0, import_lib2.$T)((0, import_lib2.$S)(IfStatement, (0, impor
|
|
|
14451
14669
|
return value[0];
|
|
14452
14670
|
});
|
|
14453
14671
|
var Statement$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(IterationStatement, (0, import_lib2.$N)(ShouldExpressionize)), function($skip, $loc, $0, $1, $2) {
|
|
14454
|
-
if ($1.generator)
|
|
14455
|
-
|
|
14456
|
-
if ($1.reduction)
|
|
14457
|
-
return $skip;
|
|
14672
|
+
if ($1.generator) return $skip;
|
|
14673
|
+
if ($1.reduction) return $skip;
|
|
14458
14674
|
return $1;
|
|
14459
14675
|
});
|
|
14460
14676
|
var Statement$4 = (0, import_lib2.$T)((0, import_lib2.$S)(SwitchStatement, (0, import_lib2.$N)(ShouldExpressionize)), function(value) {
|
|
@@ -14529,8 +14745,7 @@ var Label$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Colon, IdentifierName, Wh
|
|
|
14529
14745
|
var colon = $1;
|
|
14530
14746
|
var id = $2;
|
|
14531
14747
|
var w = $3;
|
|
14532
|
-
if (id.name === "void")
|
|
14533
|
-
return $skip;
|
|
14748
|
+
if (id.name === "void") return $skip;
|
|
14534
14749
|
return {
|
|
14535
14750
|
type: "Label",
|
|
14536
14751
|
name: id.name,
|
|
@@ -14842,8 +15057,7 @@ function ForClause(ctx, state2) {
|
|
|
14842
15057
|
var ForStatementControlWithWhen$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForStatementControlWithReduction, (0, import_lib2.$E)(WhenCondition)), function($skip, $loc, $0, $1, $2) {
|
|
14843
15058
|
var control = $1;
|
|
14844
15059
|
var condition = $2;
|
|
14845
|
-
if (!condition)
|
|
14846
|
-
return control;
|
|
15060
|
+
if (!condition) return control;
|
|
14847
15061
|
const expressions = [["", {
|
|
14848
15062
|
type: "ContinueStatement",
|
|
14849
15063
|
children: ["continue"]
|
|
@@ -15133,8 +15347,7 @@ var SwitchStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Switch, ForbidN
|
|
|
15133
15347
|
var s = $1;
|
|
15134
15348
|
var condition = $3;
|
|
15135
15349
|
var caseBlock = $5;
|
|
15136
|
-
if (!condition)
|
|
15137
|
-
return $skip;
|
|
15350
|
+
if (!condition) return $skip;
|
|
15138
15351
|
if (condition.type === "EmptyCondition") {
|
|
15139
15352
|
caseBlock.clauses.forEach(({ cases }) => {
|
|
15140
15353
|
if (cases) {
|
|
@@ -15197,8 +15410,7 @@ function CaseBlock(ctx, state2) {
|
|
|
15197
15410
|
}
|
|
15198
15411
|
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) {
|
|
15199
15412
|
var clauses = $2;
|
|
15200
|
-
if (clauses.length)
|
|
15201
|
-
return clauses;
|
|
15413
|
+
if (clauses.length) return clauses;
|
|
15202
15414
|
return $skip;
|
|
15203
15415
|
});
|
|
15204
15416
|
function NestedCaseClauses(ctx, state2) {
|
|
@@ -15277,8 +15489,7 @@ function PatternExpressionList(ctx, state2) {
|
|
|
15277
15489
|
var PatternExpression$0 = BindingPattern;
|
|
15278
15490
|
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) {
|
|
15279
15491
|
var pattern = $2;
|
|
15280
|
-
if (!pattern)
|
|
15281
|
-
return $skip;
|
|
15492
|
+
if (!pattern) return $skip;
|
|
15282
15493
|
return {
|
|
15283
15494
|
type: "ConditionFragment",
|
|
15284
15495
|
children: pattern
|
|
@@ -15293,8 +15504,7 @@ var CaseExpressionList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
15293
15504
|
var rest = $2;
|
|
15294
15505
|
const result = rest.map(([ws, _comma, exp, col]) => {
|
|
15295
15506
|
exp = trimFirstSpace(exp);
|
|
15296
|
-
if (ws.length)
|
|
15297
|
-
return [insertTrimmingSpace("case ", ws), exp, col];
|
|
15507
|
+
if (ws.length) return [insertTrimmingSpace("case ", ws), exp, col];
|
|
15298
15508
|
return ["case ", exp, col];
|
|
15299
15509
|
});
|
|
15300
15510
|
result.unshift(first);
|
|
@@ -15306,8 +15516,7 @@ function CaseExpressionList(ctx, state2) {
|
|
|
15306
15516
|
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) {
|
|
15307
15517
|
var value = $1;
|
|
15308
15518
|
if (value.type === "ComputedPropertyName") {
|
|
15309
|
-
if (value.implicit)
|
|
15310
|
-
return value.expression;
|
|
15519
|
+
if (value.implicit) return value.expression;
|
|
15311
15520
|
return { ...value, type: "ArrayExpression" };
|
|
15312
15521
|
}
|
|
15313
15522
|
return value;
|
|
@@ -15324,8 +15533,7 @@ function ImpliedColon(ctx, state2) {
|
|
|
15324
15533
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ImpliedColon", ImpliedColon$$);
|
|
15325
15534
|
}
|
|
15326
15535
|
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) {
|
|
15327
|
-
if ($1)
|
|
15328
|
-
return $1[0];
|
|
15536
|
+
if ($1) return $1[0];
|
|
15329
15537
|
});
|
|
15330
15538
|
function IgnoreColon(ctx, state2) {
|
|
15331
15539
|
return (0, import_lib2.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
|
|
@@ -15356,8 +15564,7 @@ var CatchBinding$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E
|
|
|
15356
15564
|
var parameter = $5;
|
|
15357
15565
|
var ws3 = $7;
|
|
15358
15566
|
var close = $8;
|
|
15359
|
-
if (!parameter)
|
|
15360
|
-
return $skip;
|
|
15567
|
+
if (!parameter) return $skip;
|
|
15361
15568
|
return {
|
|
15362
15569
|
type: "CatchBinding",
|
|
15363
15570
|
parameter,
|
|
@@ -15369,8 +15576,7 @@ var CatchBinding$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(_, InsertOpenParen
|
|
|
15369
15576
|
var open = $2;
|
|
15370
15577
|
var parameter = $5;
|
|
15371
15578
|
var close = $7;
|
|
15372
|
-
if (!parameter)
|
|
15373
|
-
return $skip;
|
|
15579
|
+
if (!parameter) return $skip;
|
|
15374
15580
|
return {
|
|
15375
15581
|
type: "CatchBinding",
|
|
15376
15582
|
parameter,
|
|
@@ -15457,8 +15663,7 @@ var Condition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, InsertOpe
|
|
|
15457
15663
|
var open = $2;
|
|
15458
15664
|
var expression = $3;
|
|
15459
15665
|
var close = $4;
|
|
15460
|
-
if (!expression)
|
|
15461
|
-
return $skip;
|
|
15666
|
+
if (!expression) return $skip;
|
|
15462
15667
|
return {
|
|
15463
15668
|
type: "ParenthesizedExpression",
|
|
15464
15669
|
children: [open, expression, close],
|
|
@@ -15469,8 +15674,7 @@ var Condition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenParen, Expr
|
|
|
15469
15674
|
var open = $1;
|
|
15470
15675
|
var expression = $2;
|
|
15471
15676
|
var close = $3;
|
|
15472
|
-
if (expression.type === "ParenthesizedExpression")
|
|
15473
|
-
return expression;
|
|
15677
|
+
if (expression.type === "ParenthesizedExpression") return expression;
|
|
15474
15678
|
expression = trimFirstSpace(expression);
|
|
15475
15679
|
return {
|
|
15476
15680
|
type: "ParenthesizedExpression",
|
|
@@ -15486,8 +15690,7 @@ var BoundedCondition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenPare
|
|
|
15486
15690
|
var open = $1;
|
|
15487
15691
|
var expression = $2;
|
|
15488
15692
|
var close = $3;
|
|
15489
|
-
if (expression.type === "ParenthesizedExpression")
|
|
15490
|
-
return expression;
|
|
15693
|
+
if (expression.type === "ParenthesizedExpression") return expression;
|
|
15491
15694
|
expression = trimFirstSpace(expression);
|
|
15492
15695
|
return {
|
|
15493
15696
|
type: "ParenthesizedExpression",
|
|
@@ -15500,8 +15703,7 @@ function BoundedCondition(ctx, state2) {
|
|
|
15500
15703
|
}
|
|
15501
15704
|
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) {
|
|
15502
15705
|
var declaration = $4;
|
|
15503
|
-
if (!declaration)
|
|
15504
|
-
return $skip;
|
|
15706
|
+
if (!declaration) return $skip;
|
|
15505
15707
|
return {
|
|
15506
15708
|
type: "DeclarationCondition",
|
|
15507
15709
|
declaration,
|
|
@@ -15513,8 +15715,7 @@ function DeclarationCondition(ctx, state2) {
|
|
|
15513
15715
|
}
|
|
15514
15716
|
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) {
|
|
15515
15717
|
var exp = $3;
|
|
15516
|
-
if (exp)
|
|
15517
|
-
return exp;
|
|
15718
|
+
if (exp) return exp;
|
|
15518
15719
|
return $skip;
|
|
15519
15720
|
});
|
|
15520
15721
|
function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -15522,8 +15723,7 @@ function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
|
15522
15723
|
}
|
|
15523
15724
|
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) {
|
|
15524
15725
|
var exp = $3;
|
|
15525
|
-
if (exp)
|
|
15526
|
-
return exp;
|
|
15726
|
+
if (exp) return exp;
|
|
15527
15727
|
return $skip;
|
|
15528
15728
|
});
|
|
15529
15729
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -15531,8 +15731,7 @@ function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
|
15531
15731
|
}
|
|
15532
15732
|
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) {
|
|
15533
15733
|
var exp = $3;
|
|
15534
|
-
if (exp)
|
|
15535
|
-
return exp;
|
|
15734
|
+
if (exp) return exp;
|
|
15536
15735
|
return $skip;
|
|
15537
15736
|
});
|
|
15538
15737
|
function ExpressionWithObjectApplicationForbidden(ctx, state2) {
|
|
@@ -15540,8 +15739,7 @@ function ExpressionWithObjectApplicationForbidden(ctx, state2) {
|
|
|
15540
15739
|
}
|
|
15541
15740
|
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) {
|
|
15542
15741
|
var exp = $4;
|
|
15543
|
-
if (exp)
|
|
15544
|
-
return exp;
|
|
15742
|
+
if (exp) return exp;
|
|
15545
15743
|
return $skip;
|
|
15546
15744
|
});
|
|
15547
15745
|
function LeftHandSideExpressionWithObjectApplicationForbidden(ctx, state2) {
|
|
@@ -15566,8 +15764,7 @@ function RestoreClassImplicitCall(ctx, state2) {
|
|
|
15566
15764
|
return (0, import_lib2.$EVENT)(ctx, state2, "RestoreClassImplicitCall", RestoreClassImplicitCall$0);
|
|
15567
15765
|
}
|
|
15568
15766
|
var ClassImplicitCallForbidden$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
|
|
15569
|
-
if (!state.classImplicitCallForbidden)
|
|
15570
|
-
return $skip;
|
|
15767
|
+
if (!state.classImplicitCallForbidden) return $skip;
|
|
15571
15768
|
return;
|
|
15572
15769
|
});
|
|
15573
15770
|
function ClassImplicitCallForbidden(ctx, state2) {
|
|
@@ -15595,8 +15792,7 @@ var BracedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($
|
|
|
15595
15792
|
if (config.verbose) {
|
|
15596
15793
|
console.log("forbidBracedApplication:", state.forbidBracedApplication);
|
|
15597
15794
|
}
|
|
15598
|
-
if (state.bracedApplicationForbidden)
|
|
15599
|
-
return $skip;
|
|
15795
|
+
if (state.bracedApplicationForbidden) return $skip;
|
|
15600
15796
|
return;
|
|
15601
15797
|
});
|
|
15602
15798
|
function BracedApplicationAllowed(ctx, state2) {
|
|
@@ -15624,8 +15820,7 @@ var IndentedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)
|
|
|
15624
15820
|
if (config.verbose) {
|
|
15625
15821
|
console.log("forbidIndentedApplication:", state.forbidIndentedApplication);
|
|
15626
15822
|
}
|
|
15627
|
-
if (state.indentedApplicationForbidden)
|
|
15628
|
-
return $skip;
|
|
15823
|
+
if (state.indentedApplicationForbidden) return $skip;
|
|
15629
15824
|
return;
|
|
15630
15825
|
});
|
|
15631
15826
|
function IndentedApplicationAllowed(ctx, state2) {
|
|
@@ -15653,8 +15848,7 @@ var TrailingMemberPropertyAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPE
|
|
|
15653
15848
|
if (config.verbose) {
|
|
15654
15849
|
console.log("forbidTrailingMemberProperty:", state.forbidTrailingMemberProperty);
|
|
15655
15850
|
}
|
|
15656
|
-
if (state.trailingMemberPropertyForbidden)
|
|
15657
|
-
return $skip;
|
|
15851
|
+
if (state.trailingMemberPropertyForbidden) return $skip;
|
|
15658
15852
|
});
|
|
15659
15853
|
function TrailingMemberPropertyAllowed(ctx, state2) {
|
|
15660
15854
|
return (0, import_lib2.$EVENT)(ctx, state2, "TrailingMemberPropertyAllowed", TrailingMemberPropertyAllowed$0);
|
|
@@ -15681,8 +15875,7 @@ var NestedBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0,
|
|
|
15681
15875
|
if (config.verbose) {
|
|
15682
15876
|
console.log("forbidNestedBinaryOp:", state.forbidNestedBinaryOp);
|
|
15683
15877
|
}
|
|
15684
|
-
if (state.nestedBinaryOpForbidden)
|
|
15685
|
-
return $skip;
|
|
15878
|
+
if (state.nestedBinaryOpForbidden) return $skip;
|
|
15686
15879
|
});
|
|
15687
15880
|
function NestedBinaryOpAllowed(ctx, state2) {
|
|
15688
15881
|
return (0, import_lib2.$EVENT)(ctx, state2, "NestedBinaryOpAllowed", NestedBinaryOpAllowed$0);
|
|
@@ -15709,8 +15902,7 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
|
|
|
15709
15902
|
if (config.verbose) {
|
|
15710
15903
|
console.log("forbidNewlineBinaryOp:", state.forbidNewlineBinaryOp);
|
|
15711
15904
|
}
|
|
15712
|
-
if (state.newlineBinaryOpForbidden)
|
|
15713
|
-
return $skip;
|
|
15905
|
+
if (state.newlineBinaryOpForbidden) return $skip;
|
|
15714
15906
|
});
|
|
15715
15907
|
function NewlineBinaryOpAllowed(ctx, state2) {
|
|
15716
15908
|
return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
|
|
@@ -15737,8 +15929,7 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
|
|
|
15737
15929
|
if (config.verbose) {
|
|
15738
15930
|
console.log("forbidPipeline:", state.forbidPipeline);
|
|
15739
15931
|
}
|
|
15740
|
-
if (state.pipelineForbidden)
|
|
15741
|
-
return $skip;
|
|
15932
|
+
if (state.pipelineForbidden) return $skip;
|
|
15742
15933
|
});
|
|
15743
15934
|
function PipelineAllowed(ctx, state2) {
|
|
15744
15935
|
return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
|
|
@@ -15767,14 +15958,12 @@ function ExpressionStatement(ctx, state2) {
|
|
|
15767
15958
|
}
|
|
15768
15959
|
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) {
|
|
15769
15960
|
const children = [$1];
|
|
15770
|
-
if ($2)
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
message: "'break with' outside of loop that returns a value"
|
|
15777
|
-
});
|
|
15961
|
+
if ($2) children.push($2);
|
|
15962
|
+
if ($3) children.push({
|
|
15963
|
+
type: "Error",
|
|
15964
|
+
subtype: "Warning",
|
|
15965
|
+
message: "'break with' outside of loop that returns a value"
|
|
15966
|
+
});
|
|
15778
15967
|
return {
|
|
15779
15968
|
type: "BreakStatement",
|
|
15780
15969
|
label: $2?.[1],
|
|
@@ -15791,14 +15980,12 @@ var KeywordStatement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Continue, _, S
|
|
|
15791
15980
|
});
|
|
15792
15981
|
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) {
|
|
15793
15982
|
const children = [$1];
|
|
15794
|
-
if ($2)
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
message: "'continue with' outside of loop that returns a value"
|
|
15801
|
-
});
|
|
15983
|
+
if ($2) children.push($2);
|
|
15984
|
+
if ($3) children.push({
|
|
15985
|
+
type: "Error",
|
|
15986
|
+
subtype: "Warning",
|
|
15987
|
+
message: "'continue with' outside of loop that returns a value"
|
|
15988
|
+
});
|
|
15802
15989
|
return {
|
|
15803
15990
|
type: "ContinueStatement",
|
|
15804
15991
|
label: $2?.[1],
|
|
@@ -15852,10 +16039,8 @@ var MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral;
|
|
|
15852
16039
|
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) {
|
|
15853
16040
|
var expression = $2;
|
|
15854
16041
|
var trailing = $4;
|
|
15855
|
-
if (!expression)
|
|
15856
|
-
|
|
15857
|
-
if (!trailing)
|
|
15858
|
-
return expression;
|
|
16042
|
+
if (!expression) return $skip;
|
|
16043
|
+
if (!trailing) return expression;
|
|
15859
16044
|
return [expression, trailing];
|
|
15860
16045
|
});
|
|
15861
16046
|
var MaybeNestedNonPipelineExpression$3 = NonPipelineExpression;
|
|
@@ -15868,10 +16053,8 @@ var MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral;
|
|
|
15868
16053
|
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) {
|
|
15869
16054
|
var expression = $2;
|
|
15870
16055
|
var trailing = $4;
|
|
15871
|
-
if (!expression)
|
|
15872
|
-
|
|
15873
|
-
if (!trailing)
|
|
15874
|
-
return expression;
|
|
16056
|
+
if (!expression) return $skip;
|
|
16057
|
+
if (!trailing) return expression;
|
|
15875
16058
|
return [expression, trailing];
|
|
15876
16059
|
});
|
|
15877
16060
|
var MaybeNestedPostfixedExpression$3 = PostfixedExpression;
|
|
@@ -15883,8 +16066,7 @@ var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
|
|
|
15883
16066
|
var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
|
|
15884
16067
|
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) {
|
|
15885
16068
|
var expression = $2;
|
|
15886
|
-
if (!expression)
|
|
15887
|
-
return $skip;
|
|
16069
|
+
if (!expression) return $skip;
|
|
15888
16070
|
return expression;
|
|
15889
16071
|
});
|
|
15890
16072
|
var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing$0, NestedPostfixedExpressionNoTrailing$1, NestedPostfixedExpressionNoTrailing$2];
|
|
@@ -15896,10 +16078,8 @@ var MaybeNestedExpression$1 = NestedImplicitObjectLiteral;
|
|
|
15896
16078
|
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) {
|
|
15897
16079
|
var expression = $2;
|
|
15898
16080
|
var trailing = $4;
|
|
15899
|
-
if (!expression)
|
|
15900
|
-
|
|
15901
|
-
if (!trailing)
|
|
15902
|
-
return expression;
|
|
16081
|
+
if (!expression) return $skip;
|
|
16082
|
+
if (!trailing) return expression;
|
|
15903
16083
|
return [expression, trailing];
|
|
15904
16084
|
});
|
|
15905
16085
|
var MaybeNestedExpression$3 = Expression;
|
|
@@ -15918,8 +16098,7 @@ var MaybeParenNestedExpression$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, i
|
|
|
15918
16098
|
});
|
|
15919
16099
|
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) {
|
|
15920
16100
|
var exp = $5;
|
|
15921
|
-
if (!exp)
|
|
15922
|
-
return $skip;
|
|
16101
|
+
if (!exp) return $skip;
|
|
15923
16102
|
return $0.slice(1);
|
|
15924
16103
|
});
|
|
15925
16104
|
var MaybeParenNestedExpression$$ = [MaybeParenNestedExpression$0, MaybeParenNestedExpression$1, MaybeParenNestedExpression$2, MaybeParenNestedExpression$3];
|
|
@@ -16094,8 +16273,7 @@ function OperatorNamedImports(ctx, state2) {
|
|
|
16094
16273
|
}
|
|
16095
16274
|
var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
16096
16275
|
var module2 = $3;
|
|
16097
|
-
if (!Array.isArray(module2))
|
|
16098
|
-
return $0;
|
|
16276
|
+
if (!Array.isArray(module2)) return $0;
|
|
16099
16277
|
return [$1, $2, ...module2];
|
|
16100
16278
|
});
|
|
16101
16279
|
function FromClause(ctx, state2) {
|
|
@@ -16103,8 +16281,7 @@ function FromClause(ctx, state2) {
|
|
|
16103
16281
|
}
|
|
16104
16282
|
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) {
|
|
16105
16283
|
var module2 = $2;
|
|
16106
|
-
if (!Array.isArray(module2))
|
|
16107
|
-
return $0;
|
|
16284
|
+
if (!Array.isArray(module2)) return $0;
|
|
16108
16285
|
return [$1, ...module2];
|
|
16109
16286
|
});
|
|
16110
16287
|
function ImpliedFromClause(ctx, state2) {
|
|
@@ -16130,8 +16307,7 @@ function ImportAssertion(ctx, state2) {
|
|
|
16130
16307
|
return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
|
|
16131
16308
|
}
|
|
16132
16309
|
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) {
|
|
16133
|
-
if (!$1)
|
|
16134
|
-
return $2;
|
|
16310
|
+
if (!$1) return $2;
|
|
16135
16311
|
return { ts: true, children: $0, binding: $2.binding };
|
|
16136
16312
|
});
|
|
16137
16313
|
var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -16347,8 +16523,7 @@ function ExportFromClause(ctx, state2) {
|
|
|
16347
16523
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ExportFromClause", ExportFromClause$$);
|
|
16348
16524
|
}
|
|
16349
16525
|
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) {
|
|
16350
|
-
if (!$1)
|
|
16351
|
-
return $2;
|
|
16526
|
+
if (!$1) return $2;
|
|
16352
16527
|
return { ts: true, children: $0 };
|
|
16353
16528
|
});
|
|
16354
16529
|
function TypeAndNamedExports(ctx, state2) {
|
|
@@ -16367,8 +16542,7 @@ function NamedExports(ctx, state2) {
|
|
|
16367
16542
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedExports", NamedExports$$);
|
|
16368
16543
|
}
|
|
16369
16544
|
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) {
|
|
16370
|
-
if (!$2)
|
|
16371
|
-
return $0;
|
|
16545
|
+
if (!$2) return $0;
|
|
16372
16546
|
return { ts: true, children: $0 };
|
|
16373
16547
|
});
|
|
16374
16548
|
function ExportSpecifier(ctx, state2) {
|
|
@@ -16380,11 +16554,9 @@ function ImplicitExportSpecifier(ctx, state2) {
|
|
|
16380
16554
|
}
|
|
16381
16555
|
var Declaration$0 = (0, import_lib2.$TV)(ImportDeclaration, function($skip, $loc, $0, $1) {
|
|
16382
16556
|
var decl = $0;
|
|
16383
|
-
if (decl.ts || decl.module || !decl.imports || !decl.from)
|
|
16384
|
-
return $skip;
|
|
16557
|
+
if (decl.ts || decl.module || !decl.imports || !decl.from) return $skip;
|
|
16385
16558
|
const { imports } = decl;
|
|
16386
|
-
if (!imports.binding && !imports.specifiers)
|
|
16387
|
-
return $skip;
|
|
16559
|
+
if (!imports.binding && !imports.specifiers) return $skip;
|
|
16388
16560
|
return dynamizeImportDeclaration(decl);
|
|
16389
16561
|
});
|
|
16390
16562
|
var Declaration$1 = HoistableDeclaration;
|
|
@@ -16654,8 +16826,7 @@ function TripleSingleStringCharacters(ctx, state2) {
|
|
|
16654
16826
|
return (0, import_lib2.$EVENT)(ctx, state2, "TripleSingleStringCharacters", TripleSingleStringCharacters$0);
|
|
16655
16827
|
}
|
|
16656
16828
|
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) {
|
|
16657
|
-
if (!$3)
|
|
16658
|
-
return $skip;
|
|
16829
|
+
if (!$3) return $skip;
|
|
16659
16830
|
return [$1, ...$3];
|
|
16660
16831
|
});
|
|
16661
16832
|
function CoffeeStringSubstitution(ctx, state2) {
|
|
@@ -16678,7 +16849,12 @@ function CoffeeDoubleQuotedStringCharacters(ctx, state2) {
|
|
|
16678
16849
|
}
|
|
16679
16850
|
var RegularExpressionLiteral$0 = HeregexLiteral;
|
|
16680
16851
|
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) {
|
|
16681
|
-
|
|
16852
|
+
var raw = $0;
|
|
16853
|
+
return {
|
|
16854
|
+
type: "RegularExpressionLiteral",
|
|
16855
|
+
raw,
|
|
16856
|
+
children: [{ $loc, token: raw }]
|
|
16857
|
+
};
|
|
16682
16858
|
});
|
|
16683
16859
|
var RegularExpressionLiteral$$ = [RegularExpressionLiteral$0, RegularExpressionLiteral$1];
|
|
16684
16860
|
function RegularExpressionLiteral(ctx, state2) {
|
|
@@ -16837,8 +17013,7 @@ function _TemplateLiteral(ctx, state2) {
|
|
|
16837
17013
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "_TemplateLiteral", _TemplateLiteral$$);
|
|
16838
17014
|
}
|
|
16839
17015
|
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) {
|
|
16840
|
-
if (!$3)
|
|
16841
|
-
return $skip;
|
|
17016
|
+
if (!$3) return $skip;
|
|
16842
17017
|
return [$1, ...$3];
|
|
16843
17018
|
});
|
|
16844
17019
|
function TemplateSubstitution(ctx, state2) {
|
|
@@ -17683,8 +17858,7 @@ var JSXElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(
|
|
|
17683
17858
|
var open = $2;
|
|
17684
17859
|
var children = $3;
|
|
17685
17860
|
var close = $4;
|
|
17686
|
-
if (!children)
|
|
17687
|
-
return $skip;
|
|
17861
|
+
if (!children) return $skip;
|
|
17688
17862
|
let parts;
|
|
17689
17863
|
$0 = $0.slice(1);
|
|
17690
17864
|
if (close) {
|
|
@@ -17707,8 +17881,7 @@ var JSXElement$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeJSXEnabled, JS
|
|
|
17707
17881
|
var open = $2;
|
|
17708
17882
|
var close = $5;
|
|
17709
17883
|
$0 = $0.slice(1);
|
|
17710
|
-
if (open[1] !== close[2])
|
|
17711
|
-
return $skip;
|
|
17884
|
+
if (open[1] !== close[2]) return $skip;
|
|
17712
17885
|
return { type: "JSXElement", children: $0, tag: open[1] };
|
|
17713
17886
|
});
|
|
17714
17887
|
var JSXElement$$ = [JSXElement$0, JSXElement$1, JSXElement$2];
|
|
@@ -17740,8 +17913,7 @@ function JSXOpeningElement(ctx, state2) {
|
|
|
17740
17913
|
}
|
|
17741
17914
|
var JSXOptionalClosingElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingElement), function($skip, $loc, $0, $1, $2) {
|
|
17742
17915
|
var close = $2;
|
|
17743
|
-
if (state.currentJSXTag !== close[2])
|
|
17744
|
-
return $skip;
|
|
17916
|
+
if (state.currentJSXTag !== close[2]) return $skip;
|
|
17745
17917
|
return $0;
|
|
17746
17918
|
});
|
|
17747
17919
|
var JSXOptionalClosingElement$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingElement ""');
|
|
@@ -17757,8 +17929,7 @@ var JSXFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)
|
|
|
17757
17929
|
var open = $2;
|
|
17758
17930
|
var children = $3;
|
|
17759
17931
|
var close = $4;
|
|
17760
|
-
if (!children)
|
|
17761
|
-
return $skip;
|
|
17932
|
+
if (!children) return $skip;
|
|
17762
17933
|
$0 = $0.slice(1);
|
|
17763
17934
|
const parts = close ? $0 : [
|
|
17764
17935
|
...$0,
|
|
@@ -17791,8 +17962,7 @@ function PushJSXOpeningFragment(ctx, state2) {
|
|
|
17791
17962
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushJSXOpeningFragment", PushJSXOpeningFragment$0);
|
|
17792
17963
|
}
|
|
17793
17964
|
var JSXOptionalClosingFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2) {
|
|
17794
|
-
if (state.currentJSXTag !== "")
|
|
17795
|
-
return $skip;
|
|
17965
|
+
if (state.currentJSXTag !== "") return $skip;
|
|
17796
17966
|
return $0;
|
|
17797
17967
|
});
|
|
17798
17968
|
var JSXOptionalClosingFragment$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingFragment ""');
|
|
@@ -17870,10 +18040,8 @@ var JSXAttributes$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$
|
|
|
17870
18040
|
while (root.length && isWhitespaceOrEmpty(root[root.length - 1])) {
|
|
17871
18041
|
root = root.slice(0, -1);
|
|
17872
18042
|
}
|
|
17873
|
-
while (root?.length === 1)
|
|
17874
|
-
|
|
17875
|
-
if (root?.children)
|
|
17876
|
-
root = root.children;
|
|
18043
|
+
while (root?.length === 1) root = root[0];
|
|
18044
|
+
if (root?.children) root = root.children;
|
|
17877
18045
|
if (root?.[0]?.token === "`") {
|
|
17878
18046
|
classValue = ["{", ...exprs, "}"];
|
|
17879
18047
|
} else {
|
|
@@ -17942,8 +18110,7 @@ var JSXAttribute$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(AtThis, (0, import
|
|
|
17942
18110
|
children
|
|
17943
18111
|
});
|
|
17944
18112
|
const last = lastAccessInCallExpression(expr);
|
|
17945
|
-
if (!last)
|
|
17946
|
-
return $skip;
|
|
18113
|
+
if (!last) return $skip;
|
|
17947
18114
|
let name;
|
|
17948
18115
|
if (last.type === "Index") {
|
|
17949
18116
|
return [
|
|
@@ -17969,8 +18136,7 @@ var JSXAttribute$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(Identifier, (0, im
|
|
|
17969
18136
|
return convertObjectToJSXAttributes(expr);
|
|
17970
18137
|
}
|
|
17971
18138
|
const last = lastAccessInCallExpression(expr);
|
|
17972
|
-
if (!last)
|
|
17973
|
-
return $skip;
|
|
18139
|
+
if (!last) return $skip;
|
|
17974
18140
|
let name;
|
|
17975
18141
|
if (last.type === "Index") {
|
|
17976
18142
|
return [
|
|
@@ -18057,8 +18223,7 @@ function JSXAttributeValue(ctx, state2) {
|
|
|
18057
18223
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXAttributeValue", JSXAttributeValue$$);
|
|
18058
18224
|
}
|
|
18059
18225
|
var InlineJSXAttributeValue$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXUnaryExpression, (0, import_lib2.$Q)(InlineJSXBinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
|
|
18060
|
-
if ($2.length)
|
|
18061
|
-
return processBinaryOpExpression($0);
|
|
18226
|
+
if ($2.length) return processBinaryOpExpression($0);
|
|
18062
18227
|
return $1;
|
|
18063
18228
|
});
|
|
18064
18229
|
function InlineJSXAttributeValue(ctx, state2) {
|
|
@@ -18093,8 +18258,7 @@ function InlineJSXUnaryPostfix(ctx, state2) {
|
|
|
18093
18258
|
}
|
|
18094
18259
|
var InlineJSXUpdateExpression$0 = (0, import_lib2.$S)(UpdateExpressionSymbol, UnaryExpression);
|
|
18095
18260
|
var InlineJSXUpdateExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXCallExpression, (0, import_lib2.$E)(UpdateExpressionSymbol)), function($skip, $loc, $0, $1, $2) {
|
|
18096
|
-
if ($2)
|
|
18097
|
-
return $0;
|
|
18261
|
+
if ($2) return $0;
|
|
18098
18262
|
return $1;
|
|
18099
18263
|
});
|
|
18100
18264
|
var InlineJSXUpdateExpression$$ = [InlineJSXUpdateExpression$0, InlineJSXUpdateExpression$1];
|
|
@@ -18150,8 +18314,7 @@ var InlineJSXCallExpressionRest$1 = (0, import_lib2.$TV)((0, import_lib2.$C)(Tem
|
|
|
18150
18314
|
});
|
|
18151
18315
|
var InlineJSXCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
|
|
18152
18316
|
var args = $2;
|
|
18153
|
-
if (!$1)
|
|
18154
|
-
return args;
|
|
18317
|
+
if (!$1) return args;
|
|
18155
18318
|
return [$1, args];
|
|
18156
18319
|
});
|
|
18157
18320
|
var InlineJSXCallExpressionRest$$ = [InlineJSXCallExpressionRest$0, InlineJSXCallExpressionRest$1, InlineJSXCallExpressionRest$2];
|
|
@@ -18175,8 +18338,7 @@ var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
|
|
|
18175
18338
|
var dot = $1;
|
|
18176
18339
|
var comments = $2;
|
|
18177
18340
|
var content = $3;
|
|
18178
|
-
if (!dot && !comments.length)
|
|
18179
|
-
return content;
|
|
18341
|
+
if (!dot && !comments.length) return content;
|
|
18180
18342
|
if (dot) {
|
|
18181
18343
|
if (dot.type === "Optional" && content.type === "SliceExpression") {
|
|
18182
18344
|
return [...dot.children.slice(0, -1), ...comments, content];
|
|
@@ -18264,8 +18426,7 @@ var JSXNested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXEOS, Indent), func
|
|
|
18264
18426
|
var indent = $2;
|
|
18265
18427
|
const { level } = indent;
|
|
18266
18428
|
const currentIndent = state.currentIndent;
|
|
18267
|
-
if (level !== currentIndent.level)
|
|
18268
|
-
return $skip;
|
|
18429
|
+
if (level !== currentIndent.level) return $skip;
|
|
18269
18430
|
return $0;
|
|
18270
18431
|
});
|
|
18271
18432
|
function JSXNested(ctx, state2) {
|
|
@@ -18386,8 +18547,7 @@ function JSXChildExpression(ctx, state2) {
|
|
|
18386
18547
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXChildExpression", JSXChildExpression$$);
|
|
18387
18548
|
}
|
|
18388
18549
|
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) {
|
|
18389
|
-
if (!$2)
|
|
18390
|
-
return $skip;
|
|
18550
|
+
if (!$2) return $skip;
|
|
18391
18551
|
return $2;
|
|
18392
18552
|
});
|
|
18393
18553
|
function IndentedJSXChildExpression(ctx, state2) {
|
|
@@ -18407,8 +18567,7 @@ var JSXCodeChild$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertInlineOpenBr
|
|
|
18407
18567
|
var open = $1;
|
|
18408
18568
|
var expression = $2;
|
|
18409
18569
|
var close = $3;
|
|
18410
|
-
if (!expression)
|
|
18411
|
-
return $skip;
|
|
18570
|
+
if (!expression) return $skip;
|
|
18412
18571
|
return [open, expression, close];
|
|
18413
18572
|
});
|
|
18414
18573
|
function JSXCodeChild(ctx, state2) {
|
|
@@ -18416,14 +18575,12 @@ function JSXCodeChild(ctx, state2) {
|
|
|
18416
18575
|
}
|
|
18417
18576
|
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) {
|
|
18418
18577
|
var expression = $3;
|
|
18419
|
-
if (!expression)
|
|
18420
|
-
return $skip;
|
|
18578
|
+
if (!expression) return $skip;
|
|
18421
18579
|
return expression;
|
|
18422
18580
|
});
|
|
18423
18581
|
var JSXCodeChildExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
|
|
18424
18582
|
var block = $2;
|
|
18425
|
-
if (!block)
|
|
18426
|
-
return $skip;
|
|
18583
|
+
if (!block) return $skip;
|
|
18427
18584
|
const statement = {
|
|
18428
18585
|
type: "DoStatement",
|
|
18429
18586
|
children: [block],
|
|
@@ -18669,8 +18826,7 @@ function NestedInterfaceBlock(ctx, state2) {
|
|
|
18669
18826
|
}
|
|
18670
18827
|
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) {
|
|
18671
18828
|
var props = $2;
|
|
18672
|
-
if (props.length)
|
|
18673
|
-
return props;
|
|
18829
|
+
if (props.length) return props;
|
|
18674
18830
|
return $skip;
|
|
18675
18831
|
});
|
|
18676
18832
|
function NestedInterfaceProperties(ctx, state2) {
|
|
@@ -18707,8 +18863,7 @@ function ModuleOrEmptyBlock(ctx, state2) {
|
|
|
18707
18863
|
}
|
|
18708
18864
|
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) {
|
|
18709
18865
|
var items = $2;
|
|
18710
|
-
if (items.length)
|
|
18711
|
-
return items;
|
|
18866
|
+
if (items.length) return items;
|
|
18712
18867
|
return $skip;
|
|
18713
18868
|
});
|
|
18714
18869
|
function NestedModuleItems(ctx, state2) {
|
|
@@ -18727,8 +18882,7 @@ function DeclareBlock(ctx, state2) {
|
|
|
18727
18882
|
}
|
|
18728
18883
|
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) {
|
|
18729
18884
|
var decs = $2;
|
|
18730
|
-
if (decs.length)
|
|
18731
|
-
return decs;
|
|
18885
|
+
if (decs.length) return decs;
|
|
18732
18886
|
return $skip;
|
|
18733
18887
|
});
|
|
18734
18888
|
function NestedDeclareElements(ctx, state2) {
|
|
@@ -18836,8 +18990,7 @@ function EnumBlock(ctx, state2) {
|
|
|
18836
18990
|
}
|
|
18837
18991
|
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) {
|
|
18838
18992
|
var props = $2;
|
|
18839
|
-
if (!props.length)
|
|
18840
|
-
return $skip;
|
|
18993
|
+
if (!props.length) return $skip;
|
|
18841
18994
|
return {
|
|
18842
18995
|
properties: props.flat().map((p) => p.property),
|
|
18843
18996
|
children: $0
|
|
@@ -18884,12 +19037,13 @@ function TypeIndex(ctx, state2) {
|
|
|
18884
19037
|
}
|
|
18885
19038
|
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) {
|
|
18886
19039
|
var optional = value[1];
|
|
19040
|
+
var colon = value[3];
|
|
18887
19041
|
var t = value[4];
|
|
18888
|
-
return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "children": value };
|
|
19042
|
+
return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "colon": colon, "children": value };
|
|
18889
19043
|
});
|
|
18890
19044
|
var TypeSuffix$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$E)(_), QuestionMark, (0, import_lib2.$E)(_)), function(value) {
|
|
18891
19045
|
var optional = value[1];
|
|
18892
|
-
return { "type": "TypeSuffix", "ts": true, "optional": optional, "children": value };
|
|
19046
|
+
return { "type": "TypeSuffix", "ts": true, "optional": optional, "colon": void 0, "children": value };
|
|
18893
19047
|
});
|
|
18894
19048
|
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) {
|
|
18895
19049
|
var nonnull = $1;
|
|
@@ -18900,6 +19054,7 @@ var TypeSuffix$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NonNullAssertion, (0
|
|
|
18900
19054
|
ts: true,
|
|
18901
19055
|
nonnull,
|
|
18902
19056
|
t,
|
|
19057
|
+
colon,
|
|
18903
19058
|
children: [$1, $2, colon, t]
|
|
18904
19059
|
};
|
|
18905
19060
|
});
|
|
@@ -18911,8 +19066,7 @@ var MaybeNestedType$0 = NestedTypeBulletedTuple;
|
|
|
18911
19066
|
var MaybeNestedType$1 = NestedInterfaceBlock;
|
|
18912
19067
|
var MaybeNestedType$2 = NestedTypeBinaryChain;
|
|
18913
19068
|
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) {
|
|
18914
|
-
if (!$2)
|
|
18915
|
-
return $skip;
|
|
19069
|
+
if (!$2) return $skip;
|
|
18916
19070
|
return $2;
|
|
18917
19071
|
});
|
|
18918
19072
|
var MaybeNestedType$4 = Type;
|
|
@@ -18924,8 +19078,7 @@ var MaybeNestedTypePrimary$0 = NestedTypeBulletedTuple;
|
|
|
18924
19078
|
var MaybeNestedTypePrimary$1 = NestedInterfaceBlock;
|
|
18925
19079
|
var MaybeNestedTypePrimary$2 = NestedTypeBinaryChain;
|
|
18926
19080
|
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) {
|
|
18927
|
-
if (!$2)
|
|
18928
|
-
return $skip;
|
|
19081
|
+
if (!$2) return $skip;
|
|
18929
19082
|
return $2;
|
|
18930
19083
|
});
|
|
18931
19084
|
var MaybeNestedTypePrimary$4 = TypePrimary;
|
|
@@ -18937,8 +19090,7 @@ var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
|
|
|
18937
19090
|
var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
|
|
18938
19091
|
var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
|
|
18939
19092
|
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) {
|
|
18940
|
-
if (!$2)
|
|
18941
|
-
return $skip;
|
|
19093
|
+
if (!$2) return $skip;
|
|
18942
19094
|
return $2;
|
|
18943
19095
|
});
|
|
18944
19096
|
var MaybeNestedTypeUnary$4 = (0, import_lib2.$S)(NotDedented, TypeUnary);
|
|
@@ -18961,8 +19113,7 @@ function ReturnTypeSuffix(ctx, state2) {
|
|
|
18961
19113
|
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) {
|
|
18962
19114
|
var asserts = $1;
|
|
18963
19115
|
var t = $3;
|
|
18964
|
-
if (!t)
|
|
18965
|
-
return $skip;
|
|
19116
|
+
if (!t) return $skip;
|
|
18966
19117
|
if (asserts) {
|
|
18967
19118
|
t = {
|
|
18968
19119
|
type: "TypeAsserts",
|
|
@@ -18984,8 +19135,7 @@ function ReturnType(ctx, state2) {
|
|
|
18984
19135
|
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) {
|
|
18985
19136
|
var lhs = $1;
|
|
18986
19137
|
var rhs = $2;
|
|
18987
|
-
if (!rhs)
|
|
18988
|
-
return lhs;
|
|
19138
|
+
if (!rhs) return lhs;
|
|
18989
19139
|
return {
|
|
18990
19140
|
type: "TypePredicate",
|
|
18991
19141
|
lhs,
|
|
@@ -19004,20 +19154,16 @@ var TypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(
|
|
|
19004
19154
|
var optionalPrefix = $1;
|
|
19005
19155
|
var t = $2;
|
|
19006
19156
|
var ops = $3;
|
|
19007
|
-
if (!ops.length && !optionalPrefix)
|
|
19008
|
-
|
|
19009
|
-
if (!ops
|
|
19010
|
-
return [optionalPrefix, t];
|
|
19011
|
-
if (!optionalPrefix)
|
|
19012
|
-
return [t, ...ops];
|
|
19157
|
+
if (!ops.length && !optionalPrefix) return t;
|
|
19158
|
+
if (!ops.length) return [optionalPrefix, t];
|
|
19159
|
+
if (!optionalPrefix) return [t, ...ops];
|
|
19013
19160
|
return [optionalPrefix, t, ops];
|
|
19014
19161
|
});
|
|
19015
19162
|
function TypeBinary(ctx, state2) {
|
|
19016
19163
|
return (0, import_lib2.$EVENT)(ctx, state2, "TypeBinary", TypeBinary$0);
|
|
19017
19164
|
}
|
|
19018
19165
|
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) {
|
|
19019
|
-
if (!$2.length)
|
|
19020
|
-
return $skip;
|
|
19166
|
+
if (!$2.length) return $skip;
|
|
19021
19167
|
return $2;
|
|
19022
19168
|
});
|
|
19023
19169
|
function NestedTypeBinaryChain(ctx, state2) {
|
|
@@ -19027,8 +19173,7 @@ var NestedTypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeBi
|
|
|
19027
19173
|
var indent = $1;
|
|
19028
19174
|
var op = $2;
|
|
19029
19175
|
var t = $4;
|
|
19030
|
-
if (!t)
|
|
19031
|
-
return $skip;
|
|
19176
|
+
if (!t) return $skip;
|
|
19032
19177
|
return [indent, op, t];
|
|
19033
19178
|
});
|
|
19034
19179
|
function NestedTypeBinary(ctx, state2) {
|
|
@@ -19038,8 +19183,7 @@ var TypeUnary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((
|
|
|
19038
19183
|
var prefix = $1;
|
|
19039
19184
|
var t = $2;
|
|
19040
19185
|
var suffix = $3;
|
|
19041
|
-
if (!prefix.length && !suffix.length)
|
|
19042
|
-
return t;
|
|
19186
|
+
if (!prefix.length && !suffix.length) return t;
|
|
19043
19187
|
return {
|
|
19044
19188
|
type: "TypeUnary",
|
|
19045
19189
|
prefix,
|
|
@@ -19098,9 +19242,11 @@ function UnknownAlias(ctx, state2) {
|
|
|
19098
19242
|
}
|
|
19099
19243
|
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)));
|
|
19100
19244
|
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) {
|
|
19245
|
+
var expression = $4;
|
|
19101
19246
|
return {
|
|
19102
|
-
type: "
|
|
19103
|
-
children: $0
|
|
19247
|
+
type: "TypeTypeof",
|
|
19248
|
+
children: $0,
|
|
19249
|
+
expression
|
|
19104
19250
|
};
|
|
19105
19251
|
});
|
|
19106
19252
|
var TypePrimary$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), TypeTuple), function($skip, $loc, $0, $1, $2) {
|
|
@@ -19143,8 +19289,7 @@ var TypePrimary$9 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)
|
|
|
19143
19289
|
};
|
|
19144
19290
|
});
|
|
19145
19291
|
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) {
|
|
19146
|
-
if (!$4)
|
|
19147
|
-
return $skip;
|
|
19292
|
+
if (!$4) return $skip;
|
|
19148
19293
|
return {
|
|
19149
19294
|
type: "TypeParenthesized",
|
|
19150
19295
|
children: [$1, $2, $4, $6, $7]
|
|
@@ -19166,8 +19311,7 @@ var TypeTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll
|
|
|
19166
19311
|
var elements = $3;
|
|
19167
19312
|
var ws = $5;
|
|
19168
19313
|
var close = $6;
|
|
19169
|
-
if (!elements)
|
|
19170
|
-
return $skip;
|
|
19314
|
+
if (!elements) return $skip;
|
|
19171
19315
|
return {
|
|
19172
19316
|
type: "TypeTuple",
|
|
19173
19317
|
elements,
|
|
@@ -19182,8 +19326,7 @@ var TypeTupleContent$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeElementLis
|
|
|
19182
19326
|
var list = $1;
|
|
19183
19327
|
var delimiter = $2;
|
|
19184
19328
|
var nested = $3;
|
|
19185
|
-
if (!nested)
|
|
19186
|
-
return list;
|
|
19329
|
+
if (!nested) return list;
|
|
19187
19330
|
return [...list, delimiter, ...nested];
|
|
19188
19331
|
});
|
|
19189
19332
|
var TypeTupleContent$2 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, TypeElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
|
|
@@ -19194,8 +19337,7 @@ function TypeTupleContent(ctx, state2) {
|
|
|
19194
19337
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeTupleContent", TypeTupleContent$$);
|
|
19195
19338
|
}
|
|
19196
19339
|
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) {
|
|
19197
|
-
if ($2)
|
|
19198
|
-
return $2;
|
|
19340
|
+
if ($2) return $2;
|
|
19199
19341
|
return $skip;
|
|
19200
19342
|
});
|
|
19201
19343
|
function TypeElementListWithIndentedApplicationForbidden(ctx, state2) {
|
|
@@ -19207,8 +19349,7 @@ var TypeElementList$0 = (0, import_lib2.$T)((0, import_lib2.$S)(TypeBulletedTupl
|
|
|
19207
19349
|
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) {
|
|
19208
19350
|
var first = $2;
|
|
19209
19351
|
var rest = $3;
|
|
19210
|
-
if (!rest.length)
|
|
19211
|
-
return [first];
|
|
19352
|
+
if (!rest.length) return [first];
|
|
19212
19353
|
return [
|
|
19213
19354
|
append(first, rest[0][0])
|
|
19214
19355
|
].concat(
|
|
@@ -19274,13 +19415,10 @@ var NestedTypeElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeE
|
|
|
19274
19415
|
var list = $2;
|
|
19275
19416
|
var delimiter = $3;
|
|
19276
19417
|
const { length } = list;
|
|
19277
|
-
if (!length)
|
|
19278
|
-
return $skip;
|
|
19418
|
+
if (!length) return $skip;
|
|
19279
19419
|
return list.map((e, i) => {
|
|
19280
|
-
if (i === 0)
|
|
19281
|
-
|
|
19282
|
-
if (i === length - 1)
|
|
19283
|
-
e = append(e, delimiter);
|
|
19420
|
+
if (i === 0) e = prepend(indent, e);
|
|
19421
|
+
if (i === length - 1) e = append(e, delimiter);
|
|
19284
19422
|
return e;
|
|
19285
19423
|
});
|
|
19286
19424
|
});
|
|
@@ -19291,8 +19429,7 @@ var NestedTypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, imp
|
|
|
19291
19429
|
var open = $1;
|
|
19292
19430
|
var content = $3;
|
|
19293
19431
|
var close = $4;
|
|
19294
|
-
if (!content.length)
|
|
19295
|
-
return $skip;
|
|
19432
|
+
if (!content.length) return $skip;
|
|
19296
19433
|
content = content.flat();
|
|
19297
19434
|
const last = content[content.length - 1];
|
|
19298
19435
|
let children = Array.isArray(last) ? last : last?.children;
|
|
@@ -19316,8 +19453,7 @@ var TypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBra
|
|
|
19316
19453
|
var open = $1;
|
|
19317
19454
|
var content = $2;
|
|
19318
19455
|
var close = $3;
|
|
19319
|
-
if (!content)
|
|
19320
|
-
return $skip;
|
|
19456
|
+
if (!content) return $skip;
|
|
19321
19457
|
content = [
|
|
19322
19458
|
...trimFirstSpace(content[0]),
|
|
19323
19459
|
// replace first space with bracket
|
|
@@ -19352,11 +19488,9 @@ function NestedTypeBullet(ctx, state2) {
|
|
|
19352
19488
|
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) {
|
|
19353
19489
|
var bullet = $1;
|
|
19354
19490
|
var content = $2;
|
|
19355
|
-
if (!content)
|
|
19356
|
-
return $skip;
|
|
19491
|
+
if (!content) return $skip;
|
|
19357
19492
|
let [list, delimiter] = content;
|
|
19358
|
-
if (!list.length)
|
|
19359
|
-
return $skip;
|
|
19493
|
+
if (!list.length) return $skip;
|
|
19360
19494
|
list = list.slice();
|
|
19361
19495
|
list[0] = prepend(bullet, list[0]);
|
|
19362
19496
|
if (delimiter) {
|
|
@@ -19371,8 +19505,7 @@ function TypeBullet(ctx, state2) {
|
|
|
19371
19505
|
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) {
|
|
19372
19506
|
var t = $1;
|
|
19373
19507
|
var postfix = $2;
|
|
19374
|
-
if (!postfix)
|
|
19375
|
-
return t;
|
|
19508
|
+
if (!postfix) return t;
|
|
19376
19509
|
return prepend(
|
|
19377
19510
|
postfix[0],
|
|
19378
19511
|
expressionizeTypeIf([...postfix[1], $1, void 0])
|
|
@@ -19385,8 +19518,7 @@ var TypeConditional$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
19385
19518
|
return prepend($1, expressionizeTypeIf($3));
|
|
19386
19519
|
});
|
|
19387
19520
|
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) {
|
|
19388
|
-
if ($1.negated)
|
|
19389
|
-
return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
|
|
19521
|
+
if ($1.negated) return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
|
|
19390
19522
|
return $0;
|
|
19391
19523
|
});
|
|
19392
19524
|
var TypeConditional$2 = TypeBinary;
|
|
@@ -19412,14 +19544,12 @@ function TypeIfThenElse(ctx, state2) {
|
|
|
19412
19544
|
}
|
|
19413
19545
|
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) {
|
|
19414
19546
|
var condition = $4;
|
|
19415
|
-
if (!condition)
|
|
19416
|
-
return $skip;
|
|
19547
|
+
if (!condition) return $skip;
|
|
19417
19548
|
return [$1, condition];
|
|
19418
19549
|
});
|
|
19419
19550
|
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) {
|
|
19420
19551
|
var condition = $3;
|
|
19421
|
-
if (!condition)
|
|
19422
|
-
return $skip;
|
|
19552
|
+
if (!condition) return $skip;
|
|
19423
19553
|
return [$1, condition];
|
|
19424
19554
|
});
|
|
19425
19555
|
var TypeIfClause$$ = [TypeIfClause$0, TypeIfClause$1];
|
|
@@ -19438,8 +19568,7 @@ var TypeBlock$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$N)(EO
|
|
|
19438
19568
|
});
|
|
19439
19569
|
var TypeBlock$2 = NestedInterfaceBlock;
|
|
19440
19570
|
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) {
|
|
19441
|
-
if (!$2)
|
|
19442
|
-
return $skip;
|
|
19571
|
+
if (!$2) return $skip;
|
|
19443
19572
|
return $2;
|
|
19444
19573
|
});
|
|
19445
19574
|
var TypeBlock$$ = [TypeBlock$0, TypeBlock$1, TypeBlock$2, TypeBlock$3];
|
|
@@ -19479,8 +19608,7 @@ var TypeLiteral$1 = Literal;
|
|
|
19479
19608
|
var TypeLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "TypeLiteral /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1, $2) {
|
|
19480
19609
|
var sign = $1;
|
|
19481
19610
|
var num = $2;
|
|
19482
|
-
if (sign[0] === "+")
|
|
19483
|
-
return num;
|
|
19611
|
+
if (sign[0] === "+") return num;
|
|
19484
19612
|
return $0;
|
|
19485
19613
|
});
|
|
19486
19614
|
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) {
|
|
@@ -19596,8 +19724,7 @@ var ImplicitTypeArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeAppli
|
|
|
19596
19724
|
var args = $4;
|
|
19597
19725
|
var close = $5;
|
|
19598
19726
|
const last = args[args.length - 1];
|
|
19599
|
-
if (isComma(last))
|
|
19600
|
-
args = args.slice(0, -1);
|
|
19727
|
+
if (isComma(last)) args = args.slice(0, -1);
|
|
19601
19728
|
return {
|
|
19602
19729
|
type: "TypeArguments",
|
|
19603
19730
|
ts: true,
|
|
@@ -19651,8 +19778,7 @@ function TypeArgumentList(ctx, state2) {
|
|
|
19651
19778
|
}
|
|
19652
19779
|
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) {
|
|
19653
19780
|
var args = $2;
|
|
19654
|
-
if (!args.length)
|
|
19655
|
-
return $skip;
|
|
19781
|
+
if (!args.length) return $skip;
|
|
19656
19782
|
return args.flat();
|
|
19657
19783
|
});
|
|
19658
19784
|
function NestedTypeArgumentList(ctx, state2) {
|
|
@@ -19763,16 +19889,14 @@ function CivetPrologueContent(ctx, state2) {
|
|
|
19763
19889
|
}
|
|
19764
19890
|
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) {
|
|
19765
19891
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
19766
|
-
if (l)
|
|
19767
|
-
return l.toUpperCase();
|
|
19892
|
+
if (l) return l.toUpperCase();
|
|
19768
19893
|
return "";
|
|
19769
19894
|
});
|
|
19770
19895
|
let value = $3 ? $4 : $1 === "-" ? false : true;
|
|
19771
19896
|
switch (optionName) {
|
|
19772
19897
|
case "tab":
|
|
19773
19898
|
value = parseFloat(value);
|
|
19774
|
-
if (isNaN(value))
|
|
19775
|
-
value = 0;
|
|
19899
|
+
if (isNaN(value)) value = 0;
|
|
19776
19900
|
break;
|
|
19777
19901
|
case "globals":
|
|
19778
19902
|
case "symbols":
|
|
@@ -19961,144 +20085,126 @@ function InsertType(ctx, state2) {
|
|
|
19961
20085
|
return (0, import_lib2.$EVENT)(ctx, state2, "InsertType", InsertType$0);
|
|
19962
20086
|
}
|
|
19963
20087
|
var CoffeeBinaryExistentialEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBinaryExistentialEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19964
|
-
if (config.coffeeBinaryExistential)
|
|
19965
|
-
return;
|
|
20088
|
+
if (config.coffeeBinaryExistential) return;
|
|
19966
20089
|
return $skip;
|
|
19967
20090
|
});
|
|
19968
20091
|
function CoffeeBinaryExistentialEnabled(ctx, state2) {
|
|
19969
20092
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBinaryExistentialEnabled", CoffeeBinaryExistentialEnabled$0);
|
|
19970
20093
|
}
|
|
19971
20094
|
var CoffeeBooleansEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBooleansEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19972
|
-
if (config.coffeeBooleans)
|
|
19973
|
-
return;
|
|
20095
|
+
if (config.coffeeBooleans) return;
|
|
19974
20096
|
return $skip;
|
|
19975
20097
|
});
|
|
19976
20098
|
function CoffeeBooleansEnabled(ctx, state2) {
|
|
19977
20099
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBooleansEnabled", CoffeeBooleansEnabled$0);
|
|
19978
20100
|
}
|
|
19979
20101
|
var CoffeeClassesEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeClassesEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19980
|
-
if (config.coffeeClasses)
|
|
19981
|
-
return;
|
|
20102
|
+
if (config.coffeeClasses) return;
|
|
19982
20103
|
return $skip;
|
|
19983
20104
|
});
|
|
19984
20105
|
function CoffeeClassesEnabled(ctx, state2) {
|
|
19985
20106
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeClassesEnabled", CoffeeClassesEnabled$0);
|
|
19986
20107
|
}
|
|
19987
20108
|
var CoffeeCommentEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeCommentEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19988
|
-
if (config.coffeeComment)
|
|
19989
|
-
return;
|
|
20109
|
+
if (config.coffeeComment) return;
|
|
19990
20110
|
return $skip;
|
|
19991
20111
|
});
|
|
19992
20112
|
function CoffeeCommentEnabled(ctx, state2) {
|
|
19993
20113
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeCommentEnabled", CoffeeCommentEnabled$0);
|
|
19994
20114
|
}
|
|
19995
20115
|
var CoffeeDivEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDivEnabled ""'), function($skip, $loc, $0, $1) {
|
|
19996
|
-
if (config.coffeeDiv)
|
|
19997
|
-
return;
|
|
20116
|
+
if (config.coffeeDiv) return;
|
|
19998
20117
|
return $skip;
|
|
19999
20118
|
});
|
|
20000
20119
|
function CoffeeDivEnabled(ctx, state2) {
|
|
20001
20120
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDivEnabled", CoffeeDivEnabled$0);
|
|
20002
20121
|
}
|
|
20003
20122
|
var CoffeeDoEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDoEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20004
|
-
if (config.coffeeDo)
|
|
20005
|
-
return;
|
|
20123
|
+
if (config.coffeeDo) return;
|
|
20006
20124
|
return $skip;
|
|
20007
20125
|
});
|
|
20008
20126
|
function CoffeeDoEnabled(ctx, state2) {
|
|
20009
20127
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDoEnabled", CoffeeDoEnabled$0);
|
|
20010
20128
|
}
|
|
20011
20129
|
var CoffeeForLoopsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeForLoopsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20012
|
-
if (config.coffeeForLoops)
|
|
20013
|
-
return;
|
|
20130
|
+
if (config.coffeeForLoops) return;
|
|
20014
20131
|
return $skip;
|
|
20015
20132
|
});
|
|
20016
20133
|
function CoffeeForLoopsEnabled(ctx, state2) {
|
|
20017
20134
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeForLoopsEnabled", CoffeeForLoopsEnabled$0);
|
|
20018
20135
|
}
|
|
20019
20136
|
var CoffeeInterpolationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeInterpolationEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20020
|
-
if (config.coffeeInterpolation)
|
|
20021
|
-
return;
|
|
20137
|
+
if (config.coffeeInterpolation) return;
|
|
20022
20138
|
return $skip;
|
|
20023
20139
|
});
|
|
20024
20140
|
function CoffeeInterpolationEnabled(ctx, state2) {
|
|
20025
20141
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeInterpolationEnabled", CoffeeInterpolationEnabled$0);
|
|
20026
20142
|
}
|
|
20027
20143
|
var CoffeeIsntEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeIsntEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20028
|
-
if (config.coffeeIsnt)
|
|
20029
|
-
return;
|
|
20144
|
+
if (config.coffeeIsnt) return;
|
|
20030
20145
|
return $skip;
|
|
20031
20146
|
});
|
|
20032
20147
|
function CoffeeIsntEnabled(ctx, state2) {
|
|
20033
20148
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeIsntEnabled", CoffeeIsntEnabled$0);
|
|
20034
20149
|
}
|
|
20035
20150
|
var CoffeeJSXEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeJSXEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20036
|
-
if (config.coffeeJSX)
|
|
20037
|
-
return;
|
|
20151
|
+
if (config.coffeeJSX) return;
|
|
20038
20152
|
return $skip;
|
|
20039
20153
|
});
|
|
20040
20154
|
function CoffeeJSXEnabled(ctx, state2) {
|
|
20041
20155
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeJSXEnabled", CoffeeJSXEnabled$0);
|
|
20042
20156
|
}
|
|
20043
20157
|
var CoffeeLineContinuationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeLineContinuationEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20044
|
-
if (config.coffeeLineContinuation)
|
|
20045
|
-
return;
|
|
20158
|
+
if (config.coffeeLineContinuation) return;
|
|
20046
20159
|
return $skip;
|
|
20047
20160
|
});
|
|
20048
20161
|
function CoffeeLineContinuationEnabled(ctx, state2) {
|
|
20049
20162
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeLineContinuationEnabled", CoffeeLineContinuationEnabled$0);
|
|
20050
20163
|
}
|
|
20051
20164
|
var CoffeeNotEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeNotEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20052
|
-
if (config.coffeeNot)
|
|
20053
|
-
return;
|
|
20165
|
+
if (config.coffeeNot) return;
|
|
20054
20166
|
return $skip;
|
|
20055
20167
|
});
|
|
20056
20168
|
function CoffeeNotEnabled(ctx, state2) {
|
|
20057
20169
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeNotEnabled", CoffeeNotEnabled$0);
|
|
20058
20170
|
}
|
|
20059
20171
|
var CoffeeOfEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeOfEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20060
|
-
if (config.coffeeOf)
|
|
20061
|
-
return;
|
|
20172
|
+
if (config.coffeeOf) return;
|
|
20062
20173
|
return $skip;
|
|
20063
20174
|
});
|
|
20064
20175
|
function CoffeeOfEnabled(ctx, state2) {
|
|
20065
20176
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeOfEnabled", CoffeeOfEnabled$0);
|
|
20066
20177
|
}
|
|
20067
20178
|
var CoffeePrototypeEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeePrototypeEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20068
|
-
if (config.coffeePrototype)
|
|
20069
|
-
return;
|
|
20179
|
+
if (config.coffeePrototype) return;
|
|
20070
20180
|
return $skip;
|
|
20071
20181
|
});
|
|
20072
20182
|
function CoffeePrototypeEnabled(ctx, state2) {
|
|
20073
20183
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
|
|
20074
20184
|
}
|
|
20075
20185
|
var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20076
|
-
if (config.jsxCodeNested)
|
|
20077
|
-
return;
|
|
20186
|
+
if (config.jsxCodeNested) return;
|
|
20078
20187
|
return $skip;
|
|
20079
20188
|
});
|
|
20080
20189
|
function JSXCodeNestedEnabled(ctx, state2) {
|
|
20081
20190
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
|
|
20082
20191
|
}
|
|
20083
20192
|
var JSXCodeSameLineEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20084
|
-
if (config.jsxCodeSameLine)
|
|
20085
|
-
return;
|
|
20193
|
+
if (config.jsxCodeSameLine) return;
|
|
20086
20194
|
return $skip;
|
|
20087
20195
|
});
|
|
20088
20196
|
function JSXCodeSameLineEnabled(ctx, state2) {
|
|
20089
20197
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
|
|
20090
20198
|
}
|
|
20091
20199
|
var ObjectIsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
20092
|
-
if (config.objectIs)
|
|
20093
|
-
return;
|
|
20200
|
+
if (config.objectIs) return;
|
|
20094
20201
|
return $skip;
|
|
20095
20202
|
});
|
|
20096
20203
|
function ObjectIsEnabled(ctx, state2) {
|
|
20097
20204
|
return (0, import_lib2.$EVENT)(ctx, state2, "ObjectIsEnabled", ObjectIsEnabled$0);
|
|
20098
20205
|
}
|
|
20099
20206
|
var IsBare$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'IsBare ""'), function($skip, $loc, $0, $1) {
|
|
20100
|
-
if (config.iife || config.repl)
|
|
20101
|
-
return $skip;
|
|
20207
|
+
if (config.iife || config.repl) return $skip;
|
|
20102
20208
|
});
|
|
20103
20209
|
function IsBare(ctx, state2) {
|
|
20104
20210
|
return (0, import_lib2.$EVENT)(ctx, state2, "IsBare", IsBare$0);
|
|
@@ -20271,8 +20377,7 @@ function PopIndent(ctx, state2) {
|
|
|
20271
20377
|
}
|
|
20272
20378
|
var Nested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
|
|
20273
20379
|
var indent = $2;
|
|
20274
|
-
if (indent.level === state.currentIndent.level)
|
|
20275
|
-
return $0;
|
|
20380
|
+
if (indent.level === state.currentIndent.level) return $0;
|
|
20276
20381
|
if (config.verbose) {
|
|
20277
20382
|
console.log(`failing Nested: ${indent.level} does not match current indent level ${state.currentIndent.level}`);
|
|
20278
20383
|
}
|
|
@@ -20283,8 +20388,7 @@ function Nested(ctx, state2) {
|
|
|
20283
20388
|
}
|
|
20284
20389
|
var IndentedFurther$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
|
|
20285
20390
|
var indent = $2;
|
|
20286
|
-
if (indent.level > state.currentIndent.level)
|
|
20287
|
-
return $0;
|
|
20391
|
+
if (indent.level > state.currentIndent.level) return $0;
|
|
20288
20392
|
return $skip;
|
|
20289
20393
|
});
|
|
20290
20394
|
function IndentedFurther(ctx, state2) {
|
|
@@ -20292,8 +20396,7 @@ function IndentedFurther(ctx, state2) {
|
|
|
20292
20396
|
}
|
|
20293
20397
|
var IndentedAtLeast$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
|
|
20294
20398
|
var indent = $2;
|
|
20295
|
-
if (indent.level >= state.currentIndent.level)
|
|
20296
|
-
return $0;
|
|
20399
|
+
if (indent.level >= state.currentIndent.level) return $0;
|
|
20297
20400
|
return $skip;
|
|
20298
20401
|
});
|
|
20299
20402
|
function IndentedAtLeast(ctx, state2) {
|
|
@@ -20301,10 +20404,8 @@ function IndentedAtLeast(ctx, state2) {
|
|
|
20301
20404
|
}
|
|
20302
20405
|
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) {
|
|
20303
20406
|
const ws = [];
|
|
20304
|
-
if ($1)
|
|
20305
|
-
|
|
20306
|
-
if ($2)
|
|
20307
|
-
ws.push(...$2);
|
|
20407
|
+
if ($1) ws.push(...$1);
|
|
20408
|
+
if ($2) ws.push(...$2);
|
|
20308
20409
|
return ws.flat(Infinity).filter(Boolean);
|
|
20309
20410
|
});
|
|
20310
20411
|
function NotDedented(ctx, state2) {
|
|
@@ -20312,10 +20413,8 @@ function NotDedented(ctx, state2) {
|
|
|
20312
20413
|
}
|
|
20313
20414
|
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) {
|
|
20314
20415
|
const ws = [];
|
|
20315
|
-
if ($1)
|
|
20316
|
-
|
|
20317
|
-
if ($2)
|
|
20318
|
-
ws.push(...$2);
|
|
20416
|
+
if ($1) ws.push(...$1);
|
|
20417
|
+
if ($2) ws.push(...$2);
|
|
20319
20418
|
return ws.flat(Infinity).filter(Boolean);
|
|
20320
20419
|
});
|
|
20321
20420
|
function SameLineOrIndentedFurther(ctx, state2) {
|
|
@@ -20333,8 +20432,7 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
|
|
|
20333
20432
|
$loc,
|
|
20334
20433
|
level: state.currentIndent.level + 1
|
|
20335
20434
|
};
|
|
20336
|
-
if (config.verbose)
|
|
20337
|
-
console.log("pushing bonus indent", indent);
|
|
20435
|
+
if (config.verbose) console.log("pushing bonus indent", indent);
|
|
20338
20436
|
state.indentLevels.push(indent);
|
|
20339
20437
|
return indent;
|
|
20340
20438
|
});
|
|
@@ -20346,11 +20444,9 @@ var parser = function() {
|
|
|
20346
20444
|
let ctx = { expectation: "", fail };
|
|
20347
20445
|
return {
|
|
20348
20446
|
parse: (input, options = {}) => {
|
|
20349
|
-
if (typeof input !== "string")
|
|
20350
|
-
throw new Error("Input must be a string");
|
|
20447
|
+
if (typeof input !== "string") throw new Error("Input must be a string");
|
|
20351
20448
|
const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
20352
|
-
if (!parser2)
|
|
20353
|
-
throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
20449
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
20354
20450
|
const filename2 = options.filename || "<anonymous>";
|
|
20355
20451
|
reset();
|
|
20356
20452
|
Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
|
|
@@ -20481,9 +20577,9 @@ var wellKnownSymbols = [
|
|
|
20481
20577
|
"unscopables"
|
|
20482
20578
|
];
|
|
20483
20579
|
|
|
20484
|
-
// source
|
|
20485
|
-
var
|
|
20486
|
-
__export(
|
|
20580
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
|
|
20581
|
+
var sourcemap_civet_exports = {};
|
|
20582
|
+
__export(sourcemap_civet_exports, {
|
|
20487
20583
|
SourceMap: () => SourceMap,
|
|
20488
20584
|
base64Encode: () => base64Encode,
|
|
20489
20585
|
locationTable: () => locationTable,
|
|
@@ -20668,10 +20764,8 @@ var VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
|
|
|
20668
20764
|
var encodeVlq = function(value) {
|
|
20669
20765
|
let answer = "";
|
|
20670
20766
|
let ref1;
|
|
20671
|
-
if (value < 0)
|
|
20672
|
-
|
|
20673
|
-
else
|
|
20674
|
-
ref1 = 0;
|
|
20767
|
+
if (value < 0) ref1 = 1;
|
|
20768
|
+
else ref1 = 0;
|
|
20675
20769
|
const signBit = ref1;
|
|
20676
20770
|
let valueToEncode = (Math.abs(value) << 1) + signBit;
|
|
20677
20771
|
while (valueToEncode || !answer) {
|
|
@@ -20785,7 +20879,7 @@ var remapPosition = function(position, sourcemapLines) {
|
|
|
20785
20879
|
}
|
|
20786
20880
|
};
|
|
20787
20881
|
|
|
20788
|
-
// source
|
|
20882
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
|
|
20789
20883
|
var StateCache = class {
|
|
20790
20884
|
cache = /* @__PURE__ */ new Map();
|
|
20791
20885
|
get(key) {
|
|
@@ -20825,8 +20919,80 @@ var StateCache = class {
|
|
|
20825
20919
|
}
|
|
20826
20920
|
};
|
|
20827
20921
|
|
|
20828
|
-
// source
|
|
20829
|
-
var
|
|
20922
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\worker-pool.civet.jsx
|
|
20923
|
+
var WorkerPool = class {
|
|
20924
|
+
idle;
|
|
20925
|
+
spawned;
|
|
20926
|
+
jobId;
|
|
20927
|
+
callbacks;
|
|
20928
|
+
todo;
|
|
20929
|
+
threads;
|
|
20930
|
+
constructor(threads) {
|
|
20931
|
+
this.threads = threads;
|
|
20932
|
+
this.idle = [];
|
|
20933
|
+
this.spawned = 0;
|
|
20934
|
+
this.jobId = 0;
|
|
20935
|
+
this.callbacks = /* @__PURE__ */ new Map();
|
|
20936
|
+
this.todo = [];
|
|
20937
|
+
}
|
|
20938
|
+
async run(op, ...args) {
|
|
20939
|
+
const id = this.jobId++;
|
|
20940
|
+
return await new Promise(async (resolve2, reject) => {
|
|
20941
|
+
this.callbacks.set(id, { resolve: resolve2, reject });
|
|
20942
|
+
const job = { id, op, args };
|
|
20943
|
+
if (this.idle.length) {
|
|
20944
|
+
const worker = this.idle.shift();
|
|
20945
|
+
worker.ref();
|
|
20946
|
+
worker.postMessage(job);
|
|
20947
|
+
} else if (this.spawned < this.threads) {
|
|
20948
|
+
(await this.startWorker()).postMessage(job);
|
|
20949
|
+
} else {
|
|
20950
|
+
this.todo.push(job);
|
|
20951
|
+
}
|
|
20952
|
+
});
|
|
20953
|
+
}
|
|
20954
|
+
async startWorker() {
|
|
20955
|
+
this.spawned++;
|
|
20956
|
+
const { Worker } = await import("node:worker_threads");
|
|
20957
|
+
const path = (await import("node:path")).default;
|
|
20958
|
+
const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
|
|
20959
|
+
worker.on("message", (response) => {
|
|
20960
|
+
const callback = this.callbacks.get(response.id);
|
|
20961
|
+
this.callbacks.delete(response.id);
|
|
20962
|
+
if (response.error) {
|
|
20963
|
+
callback.reject(response.error);
|
|
20964
|
+
} else {
|
|
20965
|
+
callback.resolve(response.result);
|
|
20966
|
+
}
|
|
20967
|
+
if (this.spawned > this.threads) {
|
|
20968
|
+
this.spawned--;
|
|
20969
|
+
return worker.terminate();
|
|
20970
|
+
} else if (this.todo.length) {
|
|
20971
|
+
return worker.postMessage(this.todo.shift());
|
|
20972
|
+
} else {
|
|
20973
|
+
this.idle.push(worker);
|
|
20974
|
+
return worker.unref();
|
|
20975
|
+
}
|
|
20976
|
+
});
|
|
20977
|
+
worker.on("error", (error) => {
|
|
20978
|
+
return console.error("Civet worker failed:", error);
|
|
20979
|
+
});
|
|
20980
|
+
return worker;
|
|
20981
|
+
}
|
|
20982
|
+
setThreads(threads1) {
|
|
20983
|
+
this.threads = threads1;
|
|
20984
|
+
while (this.spawned > this.threads) {
|
|
20985
|
+
if (!this.idle.length) {
|
|
20986
|
+
return;
|
|
20987
|
+
}
|
|
20988
|
+
this.spawned--;
|
|
20989
|
+
this.idle.pop().terminate();
|
|
20990
|
+
}
|
|
20991
|
+
}
|
|
20992
|
+
};
|
|
20993
|
+
|
|
20994
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
|
|
20995
|
+
var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
|
|
20830
20996
|
var ParseErrors = class extends Error {
|
|
20831
20997
|
name = "ParseErrors";
|
|
20832
20998
|
errors;
|
|
@@ -20884,7 +21050,21 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
20884
21050
|
"RestoreNewlineBinaryOp",
|
|
20885
21051
|
"RestorePipeline"
|
|
20886
21052
|
]);
|
|
21053
|
+
var workerPool;
|
|
20887
21054
|
function compile(src, options) {
|
|
21055
|
+
if (!(process.env.CIVET_THREADS == 0)) {
|
|
21056
|
+
const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
|
|
21057
|
+
if (threads === 0) {
|
|
21058
|
+
workerPool?.setThreads(0);
|
|
21059
|
+
} else if (!isNaN(threads) && threads > 0 && !options.sync) {
|
|
21060
|
+
if (workerPool != null) {
|
|
21061
|
+
workerPool.setThreads(threads);
|
|
21062
|
+
} else {
|
|
21063
|
+
workerPool = new WorkerPool(threads);
|
|
21064
|
+
}
|
|
21065
|
+
return workerPool.run("compile", src, { ...options, threads: 0 });
|
|
21066
|
+
}
|
|
21067
|
+
}
|
|
20888
21068
|
if (!options) {
|
|
20889
21069
|
options = {};
|
|
20890
21070
|
} else {
|
|
@@ -20966,7 +21146,7 @@ ${counts}`;
|
|
|
20966
21146
|
}
|
|
20967
21147
|
if (options.sourceMap || options.inlineMap) {
|
|
20968
21148
|
options.sourceMap = SourceMap2(src);
|
|
20969
|
-
const code =
|
|
21149
|
+
const code = generate_civet_default(ast2, options);
|
|
20970
21150
|
checkErrors();
|
|
20971
21151
|
if (options.inlineMap) {
|
|
20972
21152
|
return SourceMap2.remap(code, options.sourceMap, filename2, filename2 + ".tsx");
|
|
@@ -20977,11 +21157,11 @@ ${counts}`;
|
|
|
20977
21157
|
};
|
|
20978
21158
|
}
|
|
20979
21159
|
}
|
|
20980
|
-
const result =
|
|
21160
|
+
const result = generate_civet_default(ast2, options);
|
|
20981
21161
|
if (options.errors?.length) {
|
|
20982
21162
|
delete options.errors;
|
|
20983
21163
|
options.sourceMap = SourceMap2(src);
|
|
20984
|
-
|
|
21164
|
+
generate_civet_default(ast2, options);
|
|
20985
21165
|
checkErrors();
|
|
20986
21166
|
}
|
|
20987
21167
|
return result;
|
|
@@ -21060,7 +21240,7 @@ var makeCache = function({ hits, trace } = {}) {
|
|
|
21060
21240
|
var isCompileError = function(err) {
|
|
21061
21241
|
return err instanceof import_lib2.ParseError || err instanceof ParseErrors;
|
|
21062
21242
|
};
|
|
21063
|
-
var
|
|
21243
|
+
var main_civet_default = { parse, parseProgram, ParseError: import_lib2.ParseError, ParseErrors, generate: generate_civet_default, sourcemap: sourcemap_civet_exports, SourceMap: SourceMap2, compile, isCompileError };
|
|
21064
21244
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21065
21245
|
0 && (module.exports = {
|
|
21066
21246
|
ParseError,
|