@danielx/civet 0.9.5 → 0.9.7
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 +16 -0
- package/dist/browser.js +188 -139
- package/dist/main.js +232 -152
- package/dist/main.mjs +232 -152
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -555,6 +555,7 @@ __export(lib_civet_exports, {
|
|
|
555
555
|
maybeRefAssignment: () => maybeRefAssignment,
|
|
556
556
|
modifyString: () => modifyString,
|
|
557
557
|
negateCondition: () => negateCondition,
|
|
558
|
+
precedenceCustomDefault: () => precedenceCustomDefault,
|
|
558
559
|
precedenceStep: () => precedenceStep,
|
|
559
560
|
prepend: () => prepend,
|
|
560
561
|
processAssignmentDeclaration: () => processAssignmentDeclaration,
|
|
@@ -1969,6 +1970,9 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1969
1970
|
ts: true,
|
|
1970
1971
|
children: [": unknown"]
|
|
1971
1972
|
};
|
|
1973
|
+
if (prop.initializer && !typeSuffix.optional) {
|
|
1974
|
+
typeSuffix.children.unshift(typeSuffix.optional = "?");
|
|
1975
|
+
}
|
|
1972
1976
|
switch (prop.type) {
|
|
1973
1977
|
case "BindingProperty": {
|
|
1974
1978
|
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
@@ -3100,6 +3104,7 @@ function assignResults(node, collect) {
|
|
|
3100
3104
|
exp = exp.statement;
|
|
3101
3105
|
}
|
|
3102
3106
|
let ref6;
|
|
3107
|
+
let m1;
|
|
3103
3108
|
switch (exp.type) {
|
|
3104
3109
|
case "BreakStatement":
|
|
3105
3110
|
case "ContinueStatement":
|
|
@@ -3179,6 +3184,9 @@ function assignResults(node, collect) {
|
|
|
3179
3184
|
return;
|
|
3180
3185
|
}
|
|
3181
3186
|
case "PipelineExpression": {
|
|
3187
|
+
if (m1 = exp.children[1]?.type, m1 === "ReturnStatement" || m1 === "ThrowStatement") {
|
|
3188
|
+
return;
|
|
3189
|
+
}
|
|
3182
3190
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3183
3191
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3184
3192
|
exp.children.splice(semi2 + 1, 1 / 0, ...[collect(exp.children.slice(semi2 + 1))]);
|
|
@@ -3204,8 +3212,8 @@ function insertReturn(node) {
|
|
|
3204
3212
|
const last = node.expressions[node.expressions.length - 1];
|
|
3205
3213
|
insertReturn(last);
|
|
3206
3214
|
} else {
|
|
3207
|
-
let
|
|
3208
|
-
if (
|
|
3215
|
+
let m2;
|
|
3216
|
+
if (m2 = node.parent?.type, m2 === "CatchClause" || m2 === "WhenClause") {
|
|
3209
3217
|
node.expressions.push(["", wrapWithReturn(void 0, node)]);
|
|
3210
3218
|
}
|
|
3211
3219
|
}
|
|
@@ -3251,6 +3259,7 @@ function insertReturn(node) {
|
|
|
3251
3259
|
exp = exp.statement;
|
|
3252
3260
|
}
|
|
3253
3261
|
let ref11;
|
|
3262
|
+
let m3;
|
|
3254
3263
|
switch (exp.type) {
|
|
3255
3264
|
case "BreakStatement":
|
|
3256
3265
|
case "ContinueStatement":
|
|
@@ -3342,6 +3351,9 @@ function insertReturn(node) {
|
|
|
3342
3351
|
return;
|
|
3343
3352
|
}
|
|
3344
3353
|
case "PipelineExpression": {
|
|
3354
|
+
if (m3 = exp.children[1]?.type, m3 === "ReturnStatement" || m3 === "ThrowStatement") {
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3345
3357
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3346
3358
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3347
3359
|
exp.children.splice(semi2 + 1, 1 / 0, ...[wrapWithReturn(exp.children.slice(semi2 + 1))]);
|
|
@@ -3364,8 +3376,8 @@ function processBreakContinueWith(statement) {
|
|
|
3364
3376
|
)) {
|
|
3365
3377
|
if (control.with) {
|
|
3366
3378
|
if (control.label) {
|
|
3367
|
-
let
|
|
3368
|
-
if (!(
|
|
3379
|
+
let m4;
|
|
3380
|
+
if (!(m4 = statement.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "LabelledStatement" && "label" in m4 && typeof m4.label === "object" && m4.label != null && "name" in m4.label && m4.label.name === control.label.name)) {
|
|
3369
3381
|
continue;
|
|
3370
3382
|
}
|
|
3371
3383
|
} else {
|
|
@@ -3586,8 +3598,8 @@ function iterationDefaultBody(statement) {
|
|
|
3586
3598
|
const reduction = statement.type === "ForStatement" && statement.reduction;
|
|
3587
3599
|
function fillBlock(expression) {
|
|
3588
3600
|
let ref15;
|
|
3589
|
-
let
|
|
3590
|
-
if (
|
|
3601
|
+
let m5;
|
|
3602
|
+
if (m5 = (ref15 = block.expressions)[ref15.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] === "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === true) {
|
|
3591
3603
|
block.expressions.pop();
|
|
3592
3604
|
}
|
|
3593
3605
|
block.expressions.push(expression);
|
|
@@ -3715,8 +3727,8 @@ function processParams(f) {
|
|
|
3715
3727
|
parameters.names.push(...rest.names || []);
|
|
3716
3728
|
rest.children.pop();
|
|
3717
3729
|
if (after.length) {
|
|
3718
|
-
let
|
|
3719
|
-
if (
|
|
3730
|
+
let m6;
|
|
3731
|
+
if (m6 = rest.binding.type, m6 === "ArrayBindingPattern" || m6 === "ObjectBindingPattern" || m6 === "NamedBindingPattern") {
|
|
3720
3732
|
parameters.parameters.push({
|
|
3721
3733
|
type: "Error",
|
|
3722
3734
|
message: "Non-end rest parameter cannot be binding pattern"
|
|
@@ -3858,8 +3870,8 @@ function processParams(f) {
|
|
|
3858
3870
|
const classExpressions = ancestor.body.expressions;
|
|
3859
3871
|
let index2 = findChildIndex(classExpressions, f);
|
|
3860
3872
|
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3861
|
-
let
|
|
3862
|
-
while (
|
|
3873
|
+
let m7;
|
|
3874
|
+
while (m7 = classExpressions[index2 - 1]?.[1], typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor") {
|
|
3863
3875
|
index2--;
|
|
3864
3876
|
}
|
|
3865
3877
|
const fStatement = classExpressions[index2];
|
|
@@ -6016,9 +6028,8 @@ function constructInvocation(fn, arg) {
|
|
|
6016
6028
|
if (lhs.type === "NewExpression") {
|
|
6017
6029
|
let { expression } = lhs;
|
|
6018
6030
|
expression = {
|
|
6019
|
-
...expression,
|
|
6020
6031
|
type: "CallExpression",
|
|
6021
|
-
children: [
|
|
6032
|
+
children: [expression, call]
|
|
6022
6033
|
};
|
|
6023
6034
|
return {
|
|
6024
6035
|
...lhs,
|
|
@@ -6071,23 +6082,22 @@ function constructPipeStep(fn, arg, returning) {
|
|
|
6071
6082
|
];
|
|
6072
6083
|
}
|
|
6073
6084
|
function processPipelineExpressions(statements) {
|
|
6074
|
-
gatherRecursiveAll(statements, (
|
|
6085
|
+
for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "PipelineExpression"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
|
|
6086
|
+
const s = ref1[i1];
|
|
6075
6087
|
const [ws, , body] = s.children;
|
|
6076
6088
|
let [, arg] = s.children;
|
|
6077
|
-
let i = 0;
|
|
6078
|
-
const l = body.length;
|
|
6079
6089
|
const children = [ws];
|
|
6080
6090
|
const comma = blockContainingStatement(s) ? ";" : ",";
|
|
6081
6091
|
let usingRef = null;
|
|
6082
|
-
for (let
|
|
6083
|
-
const
|
|
6084
|
-
const step = body[
|
|
6092
|
+
for (let i2 = 0, len1 = body.length; i2 < len1; i2++) {
|
|
6093
|
+
const i = i2;
|
|
6094
|
+
const step = body[i2];
|
|
6085
6095
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
6086
6096
|
const returns = pipe.token === "||>";
|
|
6087
6097
|
let ref, result, returning = returns ? arg : null;
|
|
6088
6098
|
if (pipe.token === "|>=") {
|
|
6089
6099
|
let initRef;
|
|
6090
|
-
if (
|
|
6100
|
+
if (i === 0) {
|
|
6091
6101
|
checkValidLHS(arg);
|
|
6092
6102
|
outer: switch (arg.type) {
|
|
6093
6103
|
case "MemberExpression": {
|
|
@@ -6136,7 +6146,7 @@ function processPipelineExpressions(statements) {
|
|
|
6136
6146
|
});
|
|
6137
6147
|
}
|
|
6138
6148
|
} else {
|
|
6139
|
-
if (
|
|
6149
|
+
if (i === 0) s.children = children;
|
|
6140
6150
|
}
|
|
6141
6151
|
if (returns && (ref = needsRef(arg))) {
|
|
6142
6152
|
usingRef = usingRef || ref;
|
|
@@ -6160,7 +6170,7 @@ function processPipelineExpressions(statements) {
|
|
|
6160
6170
|
returning
|
|
6161
6171
|
);
|
|
6162
6172
|
if (result.type === "ReturnStatement") {
|
|
6163
|
-
if (
|
|
6173
|
+
if (i < body.length - 1) {
|
|
6164
6174
|
result.children.push({
|
|
6165
6175
|
type: "Error",
|
|
6166
6176
|
message: "Can't continue a pipeline after returning"
|
|
@@ -6188,7 +6198,7 @@ function processPipelineExpressions(statements) {
|
|
|
6188
6198
|
};
|
|
6189
6199
|
}
|
|
6190
6200
|
children.push(arg);
|
|
6191
|
-
if (!children.some(($
|
|
6201
|
+
if (!children.some(($2) => $2?.type === "ReturnStatement") && children.some(($3) => $3 === ",")) {
|
|
6192
6202
|
const { parent } = s;
|
|
6193
6203
|
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
6194
6204
|
Object.assign(s, parenthesizedExpression, {
|
|
@@ -6196,8 +6206,8 @@ function processPipelineExpressions(statements) {
|
|
|
6196
6206
|
hoistDec: void 0
|
|
6197
6207
|
});
|
|
6198
6208
|
}
|
|
6199
|
-
|
|
6200
|
-
}
|
|
6209
|
+
addParentPointers(s, s.parent);
|
|
6210
|
+
}
|
|
6201
6211
|
}
|
|
6202
6212
|
|
|
6203
6213
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
|
|
@@ -7348,14 +7358,21 @@ function processCallMemberExpression(node) {
|
|
|
7348
7358
|
}
|
|
7349
7359
|
}
|
|
7350
7360
|
if (args.length) {
|
|
7351
|
-
|
|
7352
|
-
0,
|
|
7353
|
-
2,
|
|
7354
|
-
commaCount ? {
|
|
7361
|
+
if (commaCount) {
|
|
7362
|
+
children.splice(0, 2, {
|
|
7355
7363
|
type: "ParenthesizedExpression",
|
|
7356
|
-
children: ["(",
|
|
7357
|
-
|
|
7358
|
-
|
|
7364
|
+
children: ["(", call.children, ")"],
|
|
7365
|
+
expression: call.children
|
|
7366
|
+
});
|
|
7367
|
+
} else {
|
|
7368
|
+
const middle = call.children.slice(0 + 1, -1);
|
|
7369
|
+
let ref2;
|
|
7370
|
+
children.splice(0, 2, {
|
|
7371
|
+
type: "ParenthesizedExpression",
|
|
7372
|
+
expression: middle,
|
|
7373
|
+
children: [call.children[0], middle, (ref2 = call.children)[ref2.length - 1]]
|
|
7374
|
+
});
|
|
7375
|
+
}
|
|
7359
7376
|
if (children.length === 1) {
|
|
7360
7377
|
return children[0];
|
|
7361
7378
|
}
|
|
@@ -7438,14 +7455,14 @@ function processCallMemberExpression(node) {
|
|
|
7438
7455
|
});
|
|
7439
7456
|
}
|
|
7440
7457
|
}
|
|
7441
|
-
let
|
|
7458
|
+
let ref3;
|
|
7442
7459
|
const object = {
|
|
7443
7460
|
type: "ObjectExpression",
|
|
7444
7461
|
children: [
|
|
7445
7462
|
glob.object.children[0],
|
|
7446
7463
|
// {
|
|
7447
7464
|
...parts,
|
|
7448
|
-
(
|
|
7465
|
+
(ref3 = glob.object.children)[ref3.length - 1]
|
|
7449
7466
|
// whitespace and }
|
|
7450
7467
|
],
|
|
7451
7468
|
properties: parts
|
|
@@ -7506,7 +7523,7 @@ function processCallMemberExpression(node) {
|
|
|
7506
7523
|
})
|
|
7507
7524
|
]
|
|
7508
7525
|
});
|
|
7509
|
-
let
|
|
7526
|
+
let ref4;
|
|
7510
7527
|
return processCallMemberExpression({
|
|
7511
7528
|
// in case there are more
|
|
7512
7529
|
...node,
|
|
@@ -7520,7 +7537,7 @@ function processCallMemberExpression(node) {
|
|
|
7520
7537
|
glob.children[0],
|
|
7521
7538
|
// "[" token
|
|
7522
7539
|
call,
|
|
7523
|
-
(
|
|
7540
|
+
(ref4 = glob.children)[ref4.length - 1]
|
|
7524
7541
|
// "]" token
|
|
7525
7542
|
]
|
|
7526
7543
|
}),
|
|
@@ -7533,7 +7550,7 @@ function processCallMemberExpression(node) {
|
|
|
7533
7550
|
{ ...glob.children[0], token: ", " },
|
|
7534
7551
|
...glob.children.slice(1, -1)
|
|
7535
7552
|
];
|
|
7536
|
-
let
|
|
7553
|
+
let ref5;
|
|
7537
7554
|
const rsliceCall = makeNode({
|
|
7538
7555
|
type: "CallExpression",
|
|
7539
7556
|
implicit: true,
|
|
@@ -7545,7 +7562,7 @@ function processCallMemberExpression(node) {
|
|
|
7545
7562
|
children: [
|
|
7546
7563
|
"(",
|
|
7547
7564
|
args,
|
|
7548
|
-
(
|
|
7565
|
+
(ref5 = glob.children)[ref5.length - 1]
|
|
7549
7566
|
]
|
|
7550
7567
|
})
|
|
7551
7568
|
]
|
|
@@ -7630,8 +7647,8 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7630
7647
|
return { type: "Error", message: "cannot use `type` in dynamic import" };
|
|
7631
7648
|
} else {
|
|
7632
7649
|
const { source, binding } = specifier;
|
|
7633
|
-
let
|
|
7634
|
-
const delim = (
|
|
7650
|
+
let ref6;
|
|
7651
|
+
const delim = (ref6 = specifier.children)[ref6.length - 1];
|
|
7635
7652
|
return {
|
|
7636
7653
|
type: pattern ? "BindingProperty" : "Property",
|
|
7637
7654
|
name: source,
|
|
@@ -7641,7 +7658,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7641
7658
|
};
|
|
7642
7659
|
}
|
|
7643
7660
|
});
|
|
7644
|
-
let
|
|
7661
|
+
let ref7;
|
|
7645
7662
|
return {
|
|
7646
7663
|
type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
|
|
7647
7664
|
names: node.names,
|
|
@@ -7650,7 +7667,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7650
7667
|
node.children[0],
|
|
7651
7668
|
// {
|
|
7652
7669
|
properties,
|
|
7653
|
-
(
|
|
7670
|
+
(ref7 = node.children)[ref7.length - 1]
|
|
7654
7671
|
// }
|
|
7655
7672
|
]
|
|
7656
7673
|
};
|
|
@@ -7771,7 +7788,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7771
7788
|
);
|
|
7772
7789
|
}
|
|
7773
7790
|
function processAssignments(statements) {
|
|
7774
|
-
for (let
|
|
7791
|
+
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref8.length; i5 < len3; i5++) {
|
|
7775
7792
|
let extractAssignment = function(lhs) {
|
|
7776
7793
|
let expr = lhs;
|
|
7777
7794
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -7791,20 +7808,20 @@ function processAssignments(statements) {
|
|
|
7791
7808
|
;
|
|
7792
7809
|
return;
|
|
7793
7810
|
};
|
|
7794
|
-
const exp =
|
|
7811
|
+
const exp = ref8[i5];
|
|
7795
7812
|
checkValidLHS(exp.assigned);
|
|
7796
7813
|
const pre = [], post = [];
|
|
7797
|
-
let
|
|
7814
|
+
let ref9;
|
|
7798
7815
|
switch (exp.type) {
|
|
7799
7816
|
case "AssignmentExpression": {
|
|
7800
7817
|
if (!exp.lhs) {
|
|
7801
7818
|
continue;
|
|
7802
7819
|
}
|
|
7803
|
-
for (let
|
|
7804
|
-
const lhsPart =
|
|
7805
|
-
let
|
|
7806
|
-
if (
|
|
7807
|
-
const newLhs =
|
|
7820
|
+
for (let ref10 = exp.lhs, i6 = 0, len4 = ref10.length; i6 < len4; i6++) {
|
|
7821
|
+
const lhsPart = ref10[i6];
|
|
7822
|
+
let ref11;
|
|
7823
|
+
if (ref11 = extractAssignment(lhsPart[1])) {
|
|
7824
|
+
const newLhs = ref11;
|
|
7808
7825
|
lhsPart[1] = newLhs;
|
|
7809
7826
|
}
|
|
7810
7827
|
}
|
|
@@ -7812,8 +7829,8 @@ function processAssignments(statements) {
|
|
|
7812
7829
|
break;
|
|
7813
7830
|
}
|
|
7814
7831
|
case "UpdateExpression": {
|
|
7815
|
-
if (
|
|
7816
|
-
const newLhs =
|
|
7832
|
+
if (ref9 = extractAssignment(exp.assigned)) {
|
|
7833
|
+
const newLhs = ref9;
|
|
7817
7834
|
const i = exp.children.indexOf(exp.assigned);
|
|
7818
7835
|
exp.assigned = exp.children[i] = newLhs;
|
|
7819
7836
|
}
|
|
@@ -7845,22 +7862,22 @@ function processAssignments(statements) {
|
|
|
7845
7862
|
}
|
|
7846
7863
|
}
|
|
7847
7864
|
}
|
|
7848
|
-
for (let
|
|
7849
|
-
const exp =
|
|
7865
|
+
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref12.length; i7 < len5; i7++) {
|
|
7866
|
+
const exp = ref12[i7];
|
|
7850
7867
|
if (!(exp.names === null)) {
|
|
7851
7868
|
continue;
|
|
7852
7869
|
}
|
|
7853
7870
|
let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
|
|
7854
7871
|
let block;
|
|
7855
|
-
let
|
|
7856
|
-
if (blockContainingStatement(exp) && !(
|
|
7872
|
+
let ref13;
|
|
7873
|
+
if (blockContainingStatement(exp) && !(ref13 = $1[$1.length - 1])?.[ref13.length - 1]?.special) {
|
|
7857
7874
|
block = makeBlockFragment();
|
|
7858
|
-
let
|
|
7859
|
-
if (
|
|
7875
|
+
let ref14;
|
|
7876
|
+
if (ref14 = prependStatementExpressionBlock(
|
|
7860
7877
|
{ type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
|
|
7861
7878
|
block
|
|
7862
7879
|
)) {
|
|
7863
|
-
const ref =
|
|
7880
|
+
const ref = ref14;
|
|
7864
7881
|
exp.children = exp.children.map(($7) => $7 === $2 ? ref : $7);
|
|
7865
7882
|
$2 = ref;
|
|
7866
7883
|
} else {
|
|
@@ -8041,9 +8058,9 @@ function unchainOptionalMemberExpression(exp, ref, innerExp) {
|
|
|
8041
8058
|
}
|
|
8042
8059
|
j++;
|
|
8043
8060
|
}
|
|
8044
|
-
let
|
|
8045
|
-
if (
|
|
8046
|
-
const l =
|
|
8061
|
+
let ref15;
|
|
8062
|
+
if (ref15 = conditions.length) {
|
|
8063
|
+
const l = ref15;
|
|
8047
8064
|
const cs = flatJoin(conditions, " && ");
|
|
8048
8065
|
return {
|
|
8049
8066
|
...exp,
|
|
@@ -8079,8 +8096,8 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
8079
8096
|
}
|
|
8080
8097
|
function processTypes(node) {
|
|
8081
8098
|
const results1 = [];
|
|
8082
|
-
for (let
|
|
8083
|
-
const unary =
|
|
8099
|
+
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref16.length; i8 < len6; i8++) {
|
|
8100
|
+
const unary = ref16[i8];
|
|
8084
8101
|
let suffixIndex = unary.suffix.length - 1;
|
|
8085
8102
|
const results2 = [];
|
|
8086
8103
|
while (suffixIndex >= 0) {
|
|
@@ -8159,10 +8176,10 @@ function processTypes(node) {
|
|
|
8159
8176
|
const outer = unary.suffix.splice(suffixIndex + 1, Infinity);
|
|
8160
8177
|
const space = getTrimmingSpace(unary);
|
|
8161
8178
|
inplaceInsertTrimmingSpace(unary, "");
|
|
8162
|
-
let
|
|
8163
|
-
if (unary.suffix.length)
|
|
8164
|
-
else
|
|
8165
|
-
const t =
|
|
8179
|
+
let ref17;
|
|
8180
|
+
if (unary.suffix.length) ref17 = unary;
|
|
8181
|
+
else ref17 = unary.t;
|
|
8182
|
+
const t = ref17;
|
|
8166
8183
|
const arg = makeNode({
|
|
8167
8184
|
type: "TypeArgument",
|
|
8168
8185
|
ts: true,
|
|
@@ -8207,18 +8224,18 @@ function processTypes(node) {
|
|
|
8207
8224
|
return results1;
|
|
8208
8225
|
}
|
|
8209
8226
|
function processStatementExpressions(statements) {
|
|
8210
|
-
for (let
|
|
8211
|
-
const exp =
|
|
8227
|
+
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref18.length; i9 < len7; i9++) {
|
|
8228
|
+
const exp = ref18[i9];
|
|
8212
8229
|
const { maybe, statement } = exp;
|
|
8213
8230
|
if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
|
|
8214
8231
|
replaceNode(exp, statement);
|
|
8215
8232
|
continue;
|
|
8216
8233
|
}
|
|
8217
|
-
let
|
|
8234
|
+
let ref19;
|
|
8218
8235
|
switch (statement.type) {
|
|
8219
8236
|
case "IfStatement": {
|
|
8220
|
-
if (
|
|
8221
|
-
const expression =
|
|
8237
|
+
if (ref19 = expressionizeIfStatement(statement)) {
|
|
8238
|
+
const expression = ref19;
|
|
8222
8239
|
replaceNode(statement, expression, exp);
|
|
8223
8240
|
} else {
|
|
8224
8241
|
replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -8277,13 +8294,13 @@ function processNegativeIndexAccess(statements) {
|
|
|
8277
8294
|
});
|
|
8278
8295
|
}
|
|
8279
8296
|
function processFinallyClauses(statements) {
|
|
8280
|
-
for (let
|
|
8281
|
-
let f =
|
|
8282
|
-
let
|
|
8283
|
-
if (!((
|
|
8297
|
+
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref20.length; i10 < len8; i10++) {
|
|
8298
|
+
let f = ref20[i10];
|
|
8299
|
+
let ref21;
|
|
8300
|
+
if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
|
|
8284
8301
|
throw new Error("finally clause must be inside try statement or block");
|
|
8285
8302
|
}
|
|
8286
|
-
const { block, index } =
|
|
8303
|
+
const { block, index } = ref21;
|
|
8287
8304
|
const indent = block.expressions[index][0];
|
|
8288
8305
|
const expressions = block.expressions.slice(index + 1);
|
|
8289
8306
|
const t = makeNode({
|
|
@@ -8355,8 +8372,8 @@ function processBreaksContinues(statements) {
|
|
|
8355
8372
|
}
|
|
8356
8373
|
}
|
|
8357
8374
|
function processCoffeeClasses(statements) {
|
|
8358
|
-
for (let
|
|
8359
|
-
const ce =
|
|
8375
|
+
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref22.length; i11 < len9; i11++) {
|
|
8376
|
+
const ce = ref22[i11];
|
|
8360
8377
|
const { expressions } = ce.body;
|
|
8361
8378
|
const indent = expressions[0]?.[0] ?? "\n";
|
|
8362
8379
|
const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
|
|
@@ -8506,8 +8523,8 @@ async function processProgramAsync(root) {
|
|
|
8506
8523
|
function processRepl(root, rootIIFE) {
|
|
8507
8524
|
const topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0];
|
|
8508
8525
|
let i = 0;
|
|
8509
|
-
for (let
|
|
8510
|
-
const decl =
|
|
8526
|
+
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref23.length; i14 < len11; i14++) {
|
|
8527
|
+
const decl = ref23[i14];
|
|
8511
8528
|
if (!decl.names?.length) {
|
|
8512
8529
|
continue;
|
|
8513
8530
|
}
|
|
@@ -8520,8 +8537,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8520
8537
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
8521
8538
|
}
|
|
8522
8539
|
}
|
|
8523
|
-
for (let
|
|
8524
|
-
const func =
|
|
8540
|
+
for (let ref24 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref24.length; i15 < len12; i15++) {
|
|
8541
|
+
const func = ref24[i15];
|
|
8525
8542
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
8526
8543
|
if (func.parent === topBlock) {
|
|
8527
8544
|
replaceNode(func, void 0);
|
|
@@ -8533,8 +8550,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8533
8550
|
}
|
|
8534
8551
|
}
|
|
8535
8552
|
}
|
|
8536
|
-
for (let
|
|
8537
|
-
const classExp =
|
|
8553
|
+
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref25.length; i16 < len13; i16++) {
|
|
8554
|
+
const classExp = ref25[i16];
|
|
8538
8555
|
let m8;
|
|
8539
8556
|
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)) {
|
|
8540
8557
|
classExp.children.unshift(classExp.name, "=");
|
|
@@ -8545,8 +8562,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8545
8562
|
function processPlaceholders(statements) {
|
|
8546
8563
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
8547
8564
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
8548
|
-
for (let
|
|
8549
|
-
const exp =
|
|
8565
|
+
for (let ref26 = gatherRecursiveAll(statements, ($21) => $21.type === "Placeholder"), i17 = 0, len14 = ref26.length; i17 < len14; i17++) {
|
|
8566
|
+
const exp = ref26[i17];
|
|
8550
8567
|
let ancestor;
|
|
8551
8568
|
if (exp.subtype === ".") {
|
|
8552
8569
|
({ ancestor } = findAncestor(
|
|
@@ -8658,8 +8675,8 @@ function processPlaceholders(statements) {
|
|
|
8658
8675
|
for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
|
|
8659
8676
|
const placeholder = placeholders[i18];
|
|
8660
8677
|
typeSuffix ??= placeholder.typeSuffix;
|
|
8661
|
-
let
|
|
8662
|
-
(
|
|
8678
|
+
let ref27;
|
|
8679
|
+
(ref27 = placeholder.children)[ref27.length - 1] = ref;
|
|
8663
8680
|
}
|
|
8664
8681
|
const { parent } = ancestor;
|
|
8665
8682
|
const body = maybeUnwrap(ancestor);
|
|
@@ -8680,16 +8697,16 @@ function processPlaceholders(statements) {
|
|
|
8680
8697
|
}
|
|
8681
8698
|
case "PipelineExpression": {
|
|
8682
8699
|
const i = findChildIndex(parent, ancestor);
|
|
8683
|
-
let
|
|
8700
|
+
let ref28;
|
|
8684
8701
|
if (i === 1) {
|
|
8685
|
-
|
|
8702
|
+
ref28 = ancestor === parent.children[i];
|
|
8686
8703
|
} else if (i === 2) {
|
|
8687
|
-
|
|
8704
|
+
ref28 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
8688
8705
|
} else {
|
|
8689
|
-
|
|
8706
|
+
ref28 = void 0;
|
|
8690
8707
|
}
|
|
8691
8708
|
;
|
|
8692
|
-
outer =
|
|
8709
|
+
outer = ref28;
|
|
8693
8710
|
break;
|
|
8694
8711
|
}
|
|
8695
8712
|
case "AssignmentExpression":
|
|
@@ -8704,9 +8721,12 @@ function processPlaceholders(statements) {
|
|
|
8704
8721
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
8705
8722
|
}
|
|
8706
8723
|
replaceNode(ancestor, fnExp, parent);
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8724
|
+
if (typeof parent === "object" && parent != null && "type" in parent && parent.type === "BlockStatement" && "parent" in parent && typeof parent.parent === "object" && parent.parent != null && "type" in parent.parent && parent.parent.type === "ArrowFunction" && "ampersandBlock" in parent.parent && parent.parent.ampersandBlock === true && "body" in parent.parent && parent.parent.body === body) {
|
|
8725
|
+
parent.parent.body = fnExp;
|
|
8726
|
+
}
|
|
8727
|
+
let ref29;
|
|
8728
|
+
if (ref29 = getTrimmingSpace(body)) {
|
|
8729
|
+
const ws = ref29;
|
|
8710
8730
|
inplaceInsertTrimmingSpace(body, "");
|
|
8711
8731
|
inplacePrepend(ws, fnExp);
|
|
8712
8732
|
}
|
|
@@ -8750,8 +8770,8 @@ function reorderBindingRestProperty(props) {
|
|
|
8750
8770
|
}
|
|
8751
8771
|
];
|
|
8752
8772
|
}
|
|
8753
|
-
let
|
|
8754
|
-
if (Array.isArray(rest.delim) && (
|
|
8773
|
+
let ref30;
|
|
8774
|
+
if (Array.isArray(rest.delim) && (ref30 = rest.delim)[ref30.length - 1]?.token === ",") {
|
|
8755
8775
|
rest.delim = rest.delim.slice(0, -1);
|
|
8756
8776
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
8757
8777
|
}
|
|
@@ -8969,6 +8989,7 @@ var grammar = {
|
|
|
8969
8989
|
ExplicitPropertyGlob,
|
|
8970
8990
|
PropertyGlob,
|
|
8971
8991
|
PropertyBind,
|
|
8992
|
+
PropertyBindExplicitArguments,
|
|
8972
8993
|
SuperProperty,
|
|
8973
8994
|
MetaProperty,
|
|
8974
8995
|
ReturnValue,
|
|
@@ -10502,13 +10523,19 @@ var IsLike$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Is, (0, import_lib2.$E)(
|
|
|
10502
10523
|
function IsLike(ctx, state2) {
|
|
10503
10524
|
return (0, import_lib2.$EVENT)(ctx, state2, "IsLike", IsLike$0);
|
|
10504
10525
|
}
|
|
10505
|
-
var WRHS$0 = (0, import_lib2.$
|
|
10526
|
+
var WRHS$0 = (0, import_lib2.$T)((0, import_lib2.$S)(NestedBulletedArray), function(value) {
|
|
10527
|
+
return [void 0, value[0]];
|
|
10528
|
+
});
|
|
10529
|
+
var WRHS$1 = (0, import_lib2.$T)((0, import_lib2.$S)(NestedImplicitObjectLiteral), function(value) {
|
|
10530
|
+
return [void 0, value[0]];
|
|
10531
|
+
});
|
|
10532
|
+
var WRHS$2 = (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) {
|
|
10506
10533
|
var wrhs = $2;
|
|
10507
10534
|
if (!wrhs) return $skip;
|
|
10508
10535
|
return wrhs;
|
|
10509
10536
|
});
|
|
10510
|
-
var WRHS$
|
|
10511
|
-
var WRHS$$ = [WRHS$0, WRHS$1];
|
|
10537
|
+
var WRHS$3 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS);
|
|
10538
|
+
var WRHS$$ = [WRHS$0, WRHS$1, WRHS$2, WRHS$3];
|
|
10512
10539
|
function WRHS(ctx, state2) {
|
|
10513
10540
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "WRHS", WRHS$$);
|
|
10514
10541
|
}
|
|
@@ -10647,11 +10674,13 @@ var NWTypePostfix$$ = [NWTypePostfix$0, NWTypePostfix$1, NWTypePostfix$2];
|
|
|
10647
10674
|
function NWTypePostfix(ctx, state2) {
|
|
10648
10675
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NWTypePostfix", NWTypePostfix$$);
|
|
10649
10676
|
}
|
|
10650
|
-
var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressionSymbol, UnaryWithoutParenthesizedAssignment), function($skip, $loc, $0, $1, $2) {
|
|
10677
|
+
var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressionSymbol, (0, import_lib2.$N)(Whitespace), UnaryWithoutParenthesizedAssignment), function($skip, $loc, $0, $1, $2, $3) {
|
|
10678
|
+
var symbol = $1;
|
|
10679
|
+
var assigned = $3;
|
|
10651
10680
|
return {
|
|
10652
10681
|
type: "UpdateExpression",
|
|
10653
|
-
assigned
|
|
10654
|
-
children:
|
|
10682
|
+
assigned,
|
|
10683
|
+
children: [symbol, assigned]
|
|
10655
10684
|
};
|
|
10656
10685
|
});
|
|
10657
10686
|
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) {
|
|
@@ -10939,24 +10968,27 @@ var PipelineHeadItem$$ = [PipelineHeadItem$0, PipelineHeadItem$1];
|
|
|
10939
10968
|
function PipelineHeadItem(ctx, state2) {
|
|
10940
10969
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineHeadItem", PipelineHeadItem$$);
|
|
10941
10970
|
}
|
|
10942
|
-
var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp,
|
|
10971
|
+
var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp, Return, Throw), (0, import_lib2.$N)(AccessStart), (0, import_lib2.$N)(MaybeParenNestedExpression)), function(value) {
|
|
10943
10972
|
return value[0];
|
|
10944
10973
|
});
|
|
10945
|
-
var PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
10974
|
+
var PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$TEXT)((0, import_lib2.$S)(Yield, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), Star)))), (0, import_lib2.$N)(AccessStart), (0, import_lib2.$N)(MaybeParenNestedExpression)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10975
|
+
return { $loc, token: $1, type: "Yield" };
|
|
10976
|
+
});
|
|
10977
|
+
var PipelineTailItem$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L15, 'PipelineTailItem "import"'), (0, import_lib2.$N)(AccessStart)), function($skip, $loc, $0, $1, $2) {
|
|
10946
10978
|
return {
|
|
10947
10979
|
type: "Identifier",
|
|
10948
10980
|
children: [$1]
|
|
10949
10981
|
};
|
|
10950
10982
|
});
|
|
10951
|
-
var PipelineTailItem$
|
|
10983
|
+
var PipelineTailItem$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix, (0, import_lib2.$Q)(TypePostfix)), function($skip, $loc, $0, $1, $2) {
|
|
10952
10984
|
return makeAmpersandFunction({
|
|
10953
10985
|
body: [" ", $1, ...$2]
|
|
10954
10986
|
});
|
|
10955
10987
|
});
|
|
10956
|
-
var PipelineTailItem$
|
|
10988
|
+
var PipelineTailItem$4 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
|
|
10957
10989
|
return value[0];
|
|
10958
10990
|
});
|
|
10959
|
-
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3];
|
|
10991
|
+
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3, PipelineTailItem$4];
|
|
10960
10992
|
function PipelineTailItem(ctx, state2) {
|
|
10961
10993
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineTailItem", PipelineTailItem$$);
|
|
10962
10994
|
}
|
|
@@ -12021,6 +12053,23 @@ var PropertyBind$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E
|
|
|
12021
12053
|
function PropertyBind(ctx, state2) {
|
|
12022
12054
|
return (0, import_lib2.$EVENT)(ctx, state2, "PropertyBind", PropertyBind$0);
|
|
12023
12055
|
}
|
|
12056
|
+
var PropertyBindExplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(PropertyAccessModifier), At, OptionalDot, (0, import_lib2.$C)(IdentifierName, PrivateIdentifier), (0, import_lib2.$E)(ExplicitArguments)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12057
|
+
var modifier = $1;
|
|
12058
|
+
var dot = $3;
|
|
12059
|
+
var id = $4;
|
|
12060
|
+
var args = $5;
|
|
12061
|
+
return {
|
|
12062
|
+
type: "PropertyBind",
|
|
12063
|
+
name: id.name,
|
|
12064
|
+
children: [modifier, dot, id],
|
|
12065
|
+
// omit `@` from children
|
|
12066
|
+
args: args?.children.slice(1, -1) ?? []
|
|
12067
|
+
// remove the parens from the arg list, or give an empty list
|
|
12068
|
+
};
|
|
12069
|
+
});
|
|
12070
|
+
function PropertyBindExplicitArguments(ctx, state2) {
|
|
12071
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "PropertyBindExplicitArguments", PropertyBindExplicitArguments$0);
|
|
12072
|
+
}
|
|
12024
12073
|
var SuperProperty$0 = (0, import_lib2.$S)(Super, MemberBracketContent);
|
|
12025
12074
|
var SuperProperty$1 = (0, import_lib2.$S)(Super, (0, import_lib2.$N)(PropertyAccessModifier), PropertyAccess);
|
|
12026
12075
|
var SuperProperty$$ = [SuperProperty$0, SuperProperty$1];
|
|
@@ -12707,13 +12756,17 @@ var FunctionExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionSign
|
|
|
12707
12756
|
block
|
|
12708
12757
|
};
|
|
12709
12758
|
});
|
|
12710
|
-
var FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(ArrowFunction), OpenParen, BinaryOp, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12759
|
+
var FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(ArrowFunction), OpenParen, __, BinaryOp, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12711
12760
|
var open = $2;
|
|
12712
|
-
var
|
|
12713
|
-
var
|
|
12761
|
+
var ws1 = $3;
|
|
12762
|
+
var op = $4;
|
|
12763
|
+
var ws2 = $5;
|
|
12764
|
+
var close = $6;
|
|
12714
12765
|
if (op.special && op.call && !op.negated) return op.call;
|
|
12766
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12767
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12715
12768
|
const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
|
|
12716
|
-
[
|
|
12769
|
+
[ws1, op, ws2, refB]
|
|
12717
12770
|
// BinaryOpRHS
|
|
12718
12771
|
]]);
|
|
12719
12772
|
const parameterList = [[refA, ","], refB];
|
|
@@ -12745,6 +12798,8 @@ var FunctionExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, N
|
|
|
12745
12798
|
var op = $4;
|
|
12746
12799
|
var ws2 = $5;
|
|
12747
12800
|
var close = $6;
|
|
12801
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12802
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12748
12803
|
const refB = makeRef("b");
|
|
12749
12804
|
const fn = makeAmpersandFunction({
|
|
12750
12805
|
ref: refB,
|
|
@@ -12811,6 +12866,8 @@ var FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, _
|
|
|
12811
12866
|
var ws2 = $6;
|
|
12812
12867
|
var rhs = $7;
|
|
12813
12868
|
var close = $8;
|
|
12869
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12870
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12814
12871
|
const refA = makeRef("a");
|
|
12815
12872
|
const fn = makeAmpersandFunction({
|
|
12816
12873
|
ref: refA,
|
|
@@ -12835,10 +12892,9 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12835
12892
|
var w = $3;
|
|
12836
12893
|
var decl = $4;
|
|
12837
12894
|
decl.names.forEach((name) => state.operators.set(name, behavior));
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
};
|
|
12895
|
+
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
12896
|
+
decl = prepend(trimFirstSpace(w), decl);
|
|
12897
|
+
return decl;
|
|
12842
12898
|
});
|
|
12843
12899
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
12844
12900
|
var signature = $1;
|
|
@@ -12859,11 +12915,16 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
12859
12915
|
var id = $3;
|
|
12860
12916
|
var behavior = $4;
|
|
12861
12917
|
var ids = $5;
|
|
12918
|
+
const children = [];
|
|
12862
12919
|
state.operators.set(id.name, behavior);
|
|
12863
|
-
|
|
12920
|
+
if (behavior?.error) children.push(behavior.error);
|
|
12921
|
+
ids.forEach(([, , id2, behavior2]) => {
|
|
12922
|
+
state.operators.set(id2.name, behavior2);
|
|
12923
|
+
if (behavior2?.error) children.push(behavior2.error);
|
|
12924
|
+
});
|
|
12864
12925
|
return {
|
|
12865
12926
|
id,
|
|
12866
|
-
children
|
|
12927
|
+
children
|
|
12867
12928
|
};
|
|
12868
12929
|
});
|
|
12869
12930
|
var OperatorDeclaration$$ = [OperatorDeclaration$0, OperatorDeclaration$1, OperatorDeclaration$2];
|
|
@@ -12901,7 +12962,7 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12901
12962
|
generator: !!generator.length
|
|
12902
12963
|
},
|
|
12903
12964
|
block: null,
|
|
12904
|
-
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
12965
|
+
children: [async, func, generator, w1, id, behavior?.error, w2, parameters, returnType],
|
|
12905
12966
|
behavior
|
|
12906
12967
|
};
|
|
12907
12968
|
});
|
|
@@ -12921,16 +12982,29 @@ function OperatorBehavior(ctx, state2) {
|
|
|
12921
12982
|
var OperatorPrecedence$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$C)((0, import_lib2.$EXPECT)($L27, 'OperatorPrecedence "tighter"'), (0, import_lib2.$EXPECT)($L28, 'OperatorPrecedence "looser"'), (0, import_lib2.$EXPECT)($L29, 'OperatorPrecedence "same"')), NonIdContinue, (0, import_lib2.$E)(_), (0, import_lib2.$C)(Identifier, (0, import_lib2.$S)(OpenParen, BinaryOp, CloseParen))), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12922
12983
|
var mod = $2;
|
|
12923
12984
|
var op = $5;
|
|
12924
|
-
let prec
|
|
12985
|
+
let prec, error;
|
|
12986
|
+
if (op.type === "Identifier") {
|
|
12987
|
+
if (state.operators.has(op.name)) {
|
|
12988
|
+
prec = state.operators.get(op.name).prec;
|
|
12989
|
+
} else {
|
|
12990
|
+
prec = precedenceCustomDefault;
|
|
12991
|
+
error = {
|
|
12992
|
+
type: "Error",
|
|
12993
|
+
message: `Precedence refers to unknown operator ${op.name}`
|
|
12994
|
+
};
|
|
12995
|
+
}
|
|
12996
|
+
} else {
|
|
12997
|
+
prec = getPrecedence(op[1]);
|
|
12998
|
+
}
|
|
12925
12999
|
switch (mod) {
|
|
12926
13000
|
case "tighter":
|
|
12927
|
-
prec +=
|
|
13001
|
+
prec += precedenceStep;
|
|
12928
13002
|
break;
|
|
12929
13003
|
case "looser":
|
|
12930
|
-
prec -=
|
|
13004
|
+
prec -= precedenceStep;
|
|
12931
13005
|
break;
|
|
12932
13006
|
}
|
|
12933
|
-
return { prec };
|
|
13007
|
+
return { prec, error };
|
|
12934
13008
|
});
|
|
12935
13009
|
function OperatorPrecedence(ctx, state2) {
|
|
12936
13010
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorPrecedence", OperatorPrecedence$0);
|
|
@@ -14768,6 +14842,7 @@ var BinaryOpSymbol$13 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L23, 'Bin
|
|
|
14768
14842
|
return {
|
|
14769
14843
|
$loc,
|
|
14770
14844
|
token: "instanceof",
|
|
14845
|
+
spaced: true,
|
|
14771
14846
|
relational: true,
|
|
14772
14847
|
special: true
|
|
14773
14848
|
};
|
|
@@ -14776,6 +14851,7 @@ var BinaryOpSymbol$14 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L84, 'Bin
|
|
|
14776
14851
|
return {
|
|
14777
14852
|
$loc,
|
|
14778
14853
|
token: "instanceof",
|
|
14854
|
+
spaced: true,
|
|
14779
14855
|
relational: true,
|
|
14780
14856
|
special: true,
|
|
14781
14857
|
negated: true
|
|
@@ -14851,6 +14927,7 @@ var BinaryOpSymbol$40 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
14851
14927
|
return {
|
|
14852
14928
|
$loc,
|
|
14853
14929
|
token: $1,
|
|
14930
|
+
spaced: true,
|
|
14854
14931
|
relational: true,
|
|
14855
14932
|
special: true
|
|
14856
14933
|
// for typeof shorthand
|
|
@@ -14953,6 +15030,7 @@ var CoffeeOfOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __,
|
|
|
14953
15030
|
return {
|
|
14954
15031
|
$loc,
|
|
14955
15032
|
token: "in",
|
|
15033
|
+
spaced: true,
|
|
14956
15034
|
special: true,
|
|
14957
15035
|
negated: true
|
|
14958
15036
|
};
|
|
@@ -14974,6 +15052,7 @@ var NotOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
|
|
|
14974
15052
|
return {
|
|
14975
15053
|
$loc,
|
|
14976
15054
|
token: "instanceof",
|
|
15055
|
+
spaced: true,
|
|
14977
15056
|
relational: true,
|
|
14978
15057
|
special: true,
|
|
14979
15058
|
negated: true
|
|
@@ -14983,6 +15062,7 @@ var NotOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(In), function($skip, $loc
|
|
|
14983
15062
|
return {
|
|
14984
15063
|
$loc,
|
|
14985
15064
|
token: "in",
|
|
15065
|
+
spaced: true,
|
|
14986
15066
|
special: true,
|
|
14987
15067
|
negated: true
|
|
14988
15068
|
};
|
|
@@ -16496,31 +16576,27 @@ var Debugger$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPEC
|
|
|
16496
16576
|
function Debugger(ctx, state2) {
|
|
16497
16577
|
return (0, import_lib2.$EVENT)(ctx, state2, "Debugger", Debugger$0);
|
|
16498
16578
|
}
|
|
16499
|
-
var MaybeNestedNonPipelineExpression$0 = NestedBulletedArray
|
|
16500
|
-
var
|
|
16501
|
-
var
|
|
16502
|
-
var expression = $2;
|
|
16503
|
-
var trailing = $4;
|
|
16579
|
+
var MaybeNestedNonPipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), 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, $5, $6) {
|
|
16580
|
+
var expression = $4;
|
|
16581
|
+
var trailing = $6;
|
|
16504
16582
|
if (!expression) return $skip;
|
|
16505
16583
|
if (!trailing) return expression;
|
|
16506
16584
|
return [expression, trailing];
|
|
16507
16585
|
});
|
|
16508
|
-
var MaybeNestedNonPipelineExpression$
|
|
16509
|
-
var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1
|
|
16586
|
+
var MaybeNestedNonPipelineExpression$1 = NonPipelineExpression;
|
|
16587
|
+
var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1];
|
|
16510
16588
|
function MaybeNestedNonPipelineExpression(ctx, state2) {
|
|
16511
16589
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
|
|
16512
16590
|
}
|
|
16513
|
-
var MaybeNestedPostfixedExpression$0 = NestedBulletedArray
|
|
16514
|
-
var
|
|
16515
|
-
var
|
|
16516
|
-
var expression = $2;
|
|
16517
|
-
var trailing = $4;
|
|
16591
|
+
var MaybeNestedPostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), 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, $5, $6) {
|
|
16592
|
+
var expression = $4;
|
|
16593
|
+
var trailing = $6;
|
|
16518
16594
|
if (!expression) return $skip;
|
|
16519
16595
|
if (!trailing) return expression;
|
|
16520
16596
|
return [expression, trailing];
|
|
16521
16597
|
});
|
|
16522
|
-
var MaybeNestedPostfixedExpression$
|
|
16523
|
-
var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1
|
|
16598
|
+
var MaybeNestedPostfixedExpression$1 = PostfixedExpression;
|
|
16599
|
+
var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1];
|
|
16524
16600
|
function MaybeNestedPostfixedExpression(ctx, state2) {
|
|
16525
16601
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
|
|
16526
16602
|
}
|
|
@@ -16535,17 +16611,15 @@ var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing
|
|
|
16535
16611
|
function NestedPostfixedExpressionNoTrailing(ctx, state2) {
|
|
16536
16612
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedPostfixedExpressionNoTrailing", NestedPostfixedExpressionNoTrailing$$);
|
|
16537
16613
|
}
|
|
16538
|
-
var MaybeNestedExpression$0 = NestedBulletedArray
|
|
16539
|
-
var
|
|
16540
|
-
var
|
|
16541
|
-
var expression = $2;
|
|
16542
|
-
var trailing = $4;
|
|
16614
|
+
var MaybeNestedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), 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, $5, $6) {
|
|
16615
|
+
var expression = $4;
|
|
16616
|
+
var trailing = $6;
|
|
16543
16617
|
if (!expression) return $skip;
|
|
16544
16618
|
if (!trailing) return expression;
|
|
16545
16619
|
return [expression, trailing];
|
|
16546
16620
|
});
|
|
16547
|
-
var MaybeNestedExpression$
|
|
16548
|
-
var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1
|
|
16621
|
+
var MaybeNestedExpression$1 = Expression;
|
|
16622
|
+
var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1];
|
|
16549
16623
|
function MaybeNestedExpression(ctx, state2) {
|
|
16550
16624
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
|
|
16551
16625
|
}
|
|
@@ -16584,12 +16658,15 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16584
16658
|
var imports = $5;
|
|
16585
16659
|
var ws2 = $6;
|
|
16586
16660
|
var from = $7;
|
|
16661
|
+
const errors = [];
|
|
16662
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16587
16663
|
imports.specifiers.forEach((spec) => {
|
|
16588
16664
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16665
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16589
16666
|
});
|
|
16590
16667
|
return {
|
|
16591
16668
|
type: "ImportDeclaration",
|
|
16592
|
-
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
16669
|
+
children: [i, ...errors, trimFirstSpace(ws1), imports, ws2, from],
|
|
16593
16670
|
// omit $2 = Operator and $3 = OperatorBehavior
|
|
16594
16671
|
imports,
|
|
16595
16672
|
from
|
|
@@ -16632,12 +16709,15 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(ImpliedFromCl
|
|
|
16632
16709
|
var behavior = $6;
|
|
16633
16710
|
var ows = $7;
|
|
16634
16711
|
var imports = $8;
|
|
16712
|
+
const errors = [];
|
|
16713
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16635
16714
|
imports.specifiers.forEach((spec) => {
|
|
16636
16715
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16716
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16637
16717
|
});
|
|
16638
16718
|
return {
|
|
16639
16719
|
type: "ImportDeclaration",
|
|
16640
|
-
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
16720
|
+
children: [i, iws, ...errors, trimFirstSpace(ows), imports, fws, from],
|
|
16641
16721
|
// omit Operator and OperatorBehavior
|
|
16642
16722
|
imports,
|
|
16643
16723
|
from
|
|
@@ -16819,7 +16899,7 @@ var OperatorImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Mod
|
|
|
16819
16899
|
return {
|
|
16820
16900
|
binding,
|
|
16821
16901
|
behavior,
|
|
16822
|
-
children: [$1, $2, $4, $5, $6, $7]
|
|
16902
|
+
children: [$1, $2, $3?.error, $4, $5, $6, $7]
|
|
16823
16903
|
};
|
|
16824
16904
|
});
|
|
16825
16905
|
var OperatorImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, ImportedBinding, (0, import_lib2.$E)(OperatorBehavior), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
@@ -16828,7 +16908,7 @@ var OperatorImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Imp
|
|
|
16828
16908
|
return {
|
|
16829
16909
|
binding,
|
|
16830
16910
|
behavior,
|
|
16831
|
-
children: [$1, $2, $4]
|
|
16911
|
+
children: [$1, $2, $3?.error, $4]
|
|
16832
16912
|
};
|
|
16833
16913
|
});
|
|
16834
16914
|
var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecifier$1];
|
|
@@ -17951,7 +18031,7 @@ function Import(ctx, state2) {
|
|
|
17951
18031
|
return (0, import_lib2.$EVENT)(ctx, state2, "Import", Import$0);
|
|
17952
18032
|
}
|
|
17953
18033
|
var In$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L180, 'In "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
17954
|
-
return { $loc, token: $1 };
|
|
18034
|
+
return { $loc, token: $1, spaced: true };
|
|
17955
18035
|
});
|
|
17956
18036
|
function In(ctx, state2) {
|
|
17957
18037
|
return (0, import_lib2.$EVENT)(ctx, state2, "In", In$0);
|
|
@@ -18811,7 +18891,7 @@ var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
|
|
|
18811
18891
|
});
|
|
18812
18892
|
var InlineJSXMemberExpressionRest$1 = PropertyAccess;
|
|
18813
18893
|
var InlineJSXMemberExpressionRest$2 = PropertyGlob;
|
|
18814
|
-
var InlineJSXMemberExpressionRest$3 =
|
|
18894
|
+
var InlineJSXMemberExpressionRest$3 = PropertyBindExplicitArguments;
|
|
18815
18895
|
var InlineJSXMemberExpressionRest$4 = NonNullAssertion;
|
|
18816
18896
|
var InlineJSXMemberExpressionRest$$ = [InlineJSXMemberExpressionRest$0, InlineJSXMemberExpressionRest$1, InlineJSXMemberExpressionRest$2, InlineJSXMemberExpressionRest$3, InlineJSXMemberExpressionRest$4];
|
|
18817
18897
|
function InlineJSXMemberExpressionRest(ctx, state2) {
|