@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.mjs
CHANGED
|
@@ -536,6 +536,7 @@ __export(lib_civet_exports, {
|
|
|
536
536
|
maybeRefAssignment: () => maybeRefAssignment,
|
|
537
537
|
modifyString: () => modifyString,
|
|
538
538
|
negateCondition: () => negateCondition,
|
|
539
|
+
precedenceCustomDefault: () => precedenceCustomDefault,
|
|
539
540
|
precedenceStep: () => precedenceStep,
|
|
540
541
|
prepend: () => prepend,
|
|
541
542
|
processAssignmentDeclaration: () => processAssignmentDeclaration,
|
|
@@ -1950,6 +1951,9 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1950
1951
|
ts: true,
|
|
1951
1952
|
children: [": unknown"]
|
|
1952
1953
|
};
|
|
1954
|
+
if (prop.initializer && !typeSuffix.optional) {
|
|
1955
|
+
typeSuffix.children.unshift(typeSuffix.optional = "?");
|
|
1956
|
+
}
|
|
1953
1957
|
switch (prop.type) {
|
|
1954
1958
|
case "BindingProperty": {
|
|
1955
1959
|
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
@@ -3081,6 +3085,7 @@ function assignResults(node, collect) {
|
|
|
3081
3085
|
exp = exp.statement;
|
|
3082
3086
|
}
|
|
3083
3087
|
let ref6;
|
|
3088
|
+
let m1;
|
|
3084
3089
|
switch (exp.type) {
|
|
3085
3090
|
case "BreakStatement":
|
|
3086
3091
|
case "ContinueStatement":
|
|
@@ -3160,6 +3165,9 @@ function assignResults(node, collect) {
|
|
|
3160
3165
|
return;
|
|
3161
3166
|
}
|
|
3162
3167
|
case "PipelineExpression": {
|
|
3168
|
+
if (m1 = exp.children[1]?.type, m1 === "ReturnStatement" || m1 === "ThrowStatement") {
|
|
3169
|
+
return;
|
|
3170
|
+
}
|
|
3163
3171
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3164
3172
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3165
3173
|
exp.children.splice(semi2 + 1, 1 / 0, ...[collect(exp.children.slice(semi2 + 1))]);
|
|
@@ -3185,8 +3193,8 @@ function insertReturn(node) {
|
|
|
3185
3193
|
const last = node.expressions[node.expressions.length - 1];
|
|
3186
3194
|
insertReturn(last);
|
|
3187
3195
|
} else {
|
|
3188
|
-
let
|
|
3189
|
-
if (
|
|
3196
|
+
let m2;
|
|
3197
|
+
if (m2 = node.parent?.type, m2 === "CatchClause" || m2 === "WhenClause") {
|
|
3190
3198
|
node.expressions.push(["", wrapWithReturn(void 0, node)]);
|
|
3191
3199
|
}
|
|
3192
3200
|
}
|
|
@@ -3232,6 +3240,7 @@ function insertReturn(node) {
|
|
|
3232
3240
|
exp = exp.statement;
|
|
3233
3241
|
}
|
|
3234
3242
|
let ref11;
|
|
3243
|
+
let m3;
|
|
3235
3244
|
switch (exp.type) {
|
|
3236
3245
|
case "BreakStatement":
|
|
3237
3246
|
case "ContinueStatement":
|
|
@@ -3323,6 +3332,9 @@ function insertReturn(node) {
|
|
|
3323
3332
|
return;
|
|
3324
3333
|
}
|
|
3325
3334
|
case "PipelineExpression": {
|
|
3335
|
+
if (m3 = exp.children[1]?.type, m3 === "ReturnStatement" || m3 === "ThrowStatement") {
|
|
3336
|
+
return;
|
|
3337
|
+
}
|
|
3326
3338
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3327
3339
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3328
3340
|
exp.children.splice(semi2 + 1, 1 / 0, ...[wrapWithReturn(exp.children.slice(semi2 + 1))]);
|
|
@@ -3345,8 +3357,8 @@ function processBreakContinueWith(statement) {
|
|
|
3345
3357
|
)) {
|
|
3346
3358
|
if (control.with) {
|
|
3347
3359
|
if (control.label) {
|
|
3348
|
-
let
|
|
3349
|
-
if (!(
|
|
3360
|
+
let m4;
|
|
3361
|
+
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)) {
|
|
3350
3362
|
continue;
|
|
3351
3363
|
}
|
|
3352
3364
|
} else {
|
|
@@ -3567,8 +3579,8 @@ function iterationDefaultBody(statement) {
|
|
|
3567
3579
|
const reduction = statement.type === "ForStatement" && statement.reduction;
|
|
3568
3580
|
function fillBlock(expression) {
|
|
3569
3581
|
let ref15;
|
|
3570
|
-
let
|
|
3571
|
-
if (
|
|
3582
|
+
let m5;
|
|
3583
|
+
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) {
|
|
3572
3584
|
block.expressions.pop();
|
|
3573
3585
|
}
|
|
3574
3586
|
block.expressions.push(expression);
|
|
@@ -3696,8 +3708,8 @@ function processParams(f) {
|
|
|
3696
3708
|
parameters.names.push(...rest.names || []);
|
|
3697
3709
|
rest.children.pop();
|
|
3698
3710
|
if (after.length) {
|
|
3699
|
-
let
|
|
3700
|
-
if (
|
|
3711
|
+
let m6;
|
|
3712
|
+
if (m6 = rest.binding.type, m6 === "ArrayBindingPattern" || m6 === "ObjectBindingPattern" || m6 === "NamedBindingPattern") {
|
|
3701
3713
|
parameters.parameters.push({
|
|
3702
3714
|
type: "Error",
|
|
3703
3715
|
message: "Non-end rest parameter cannot be binding pattern"
|
|
@@ -3839,8 +3851,8 @@ function processParams(f) {
|
|
|
3839
3851
|
const classExpressions = ancestor.body.expressions;
|
|
3840
3852
|
let index2 = findChildIndex(classExpressions, f);
|
|
3841
3853
|
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3842
|
-
let
|
|
3843
|
-
while (
|
|
3854
|
+
let m7;
|
|
3855
|
+
while (m7 = classExpressions[index2 - 1]?.[1], typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor") {
|
|
3844
3856
|
index2--;
|
|
3845
3857
|
}
|
|
3846
3858
|
const fStatement = classExpressions[index2];
|
|
@@ -5997,9 +6009,8 @@ function constructInvocation(fn, arg) {
|
|
|
5997
6009
|
if (lhs.type === "NewExpression") {
|
|
5998
6010
|
let { expression } = lhs;
|
|
5999
6011
|
expression = {
|
|
6000
|
-
...expression,
|
|
6001
6012
|
type: "CallExpression",
|
|
6002
|
-
children: [
|
|
6013
|
+
children: [expression, call]
|
|
6003
6014
|
};
|
|
6004
6015
|
return {
|
|
6005
6016
|
...lhs,
|
|
@@ -6052,23 +6063,22 @@ function constructPipeStep(fn, arg, returning) {
|
|
|
6052
6063
|
];
|
|
6053
6064
|
}
|
|
6054
6065
|
function processPipelineExpressions(statements) {
|
|
6055
|
-
gatherRecursiveAll(statements, (
|
|
6066
|
+
for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "PipelineExpression"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
|
|
6067
|
+
const s = ref1[i1];
|
|
6056
6068
|
const [ws, , body] = s.children;
|
|
6057
6069
|
let [, arg] = s.children;
|
|
6058
|
-
let i = 0;
|
|
6059
|
-
const l = body.length;
|
|
6060
6070
|
const children = [ws];
|
|
6061
6071
|
const comma = blockContainingStatement(s) ? ";" : ",";
|
|
6062
6072
|
let usingRef = null;
|
|
6063
|
-
for (let
|
|
6064
|
-
const
|
|
6065
|
-
const step = body[
|
|
6073
|
+
for (let i2 = 0, len1 = body.length; i2 < len1; i2++) {
|
|
6074
|
+
const i = i2;
|
|
6075
|
+
const step = body[i2];
|
|
6066
6076
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
6067
6077
|
const returns = pipe.token === "||>";
|
|
6068
6078
|
let ref, result, returning = returns ? arg : null;
|
|
6069
6079
|
if (pipe.token === "|>=") {
|
|
6070
6080
|
let initRef;
|
|
6071
|
-
if (
|
|
6081
|
+
if (i === 0) {
|
|
6072
6082
|
checkValidLHS(arg);
|
|
6073
6083
|
outer: switch (arg.type) {
|
|
6074
6084
|
case "MemberExpression": {
|
|
@@ -6117,7 +6127,7 @@ function processPipelineExpressions(statements) {
|
|
|
6117
6127
|
});
|
|
6118
6128
|
}
|
|
6119
6129
|
} else {
|
|
6120
|
-
if (
|
|
6130
|
+
if (i === 0) s.children = children;
|
|
6121
6131
|
}
|
|
6122
6132
|
if (returns && (ref = needsRef(arg))) {
|
|
6123
6133
|
usingRef = usingRef || ref;
|
|
@@ -6141,7 +6151,7 @@ function processPipelineExpressions(statements) {
|
|
|
6141
6151
|
returning
|
|
6142
6152
|
);
|
|
6143
6153
|
if (result.type === "ReturnStatement") {
|
|
6144
|
-
if (
|
|
6154
|
+
if (i < body.length - 1) {
|
|
6145
6155
|
result.children.push({
|
|
6146
6156
|
type: "Error",
|
|
6147
6157
|
message: "Can't continue a pipeline after returning"
|
|
@@ -6169,7 +6179,7 @@ function processPipelineExpressions(statements) {
|
|
|
6169
6179
|
};
|
|
6170
6180
|
}
|
|
6171
6181
|
children.push(arg);
|
|
6172
|
-
if (!children.some(($
|
|
6182
|
+
if (!children.some(($2) => $2?.type === "ReturnStatement") && children.some(($3) => $3 === ",")) {
|
|
6173
6183
|
const { parent } = s;
|
|
6174
6184
|
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
6175
6185
|
Object.assign(s, parenthesizedExpression, {
|
|
@@ -6177,8 +6187,8 @@ function processPipelineExpressions(statements) {
|
|
|
6177
6187
|
hoistDec: void 0
|
|
6178
6188
|
});
|
|
6179
6189
|
}
|
|
6180
|
-
|
|
6181
|
-
}
|
|
6190
|
+
addParentPointers(s, s.parent);
|
|
6191
|
+
}
|
|
6182
6192
|
}
|
|
6183
6193
|
|
|
6184
6194
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
|
|
@@ -7329,14 +7339,21 @@ function processCallMemberExpression(node) {
|
|
|
7329
7339
|
}
|
|
7330
7340
|
}
|
|
7331
7341
|
if (args.length) {
|
|
7332
|
-
|
|
7333
|
-
0,
|
|
7334
|
-
2,
|
|
7335
|
-
commaCount ? {
|
|
7342
|
+
if (commaCount) {
|
|
7343
|
+
children.splice(0, 2, {
|
|
7336
7344
|
type: "ParenthesizedExpression",
|
|
7337
|
-
children: ["(",
|
|
7338
|
-
|
|
7339
|
-
|
|
7345
|
+
children: ["(", call.children, ")"],
|
|
7346
|
+
expression: call.children
|
|
7347
|
+
});
|
|
7348
|
+
} else {
|
|
7349
|
+
const middle = call.children.slice(0 + 1, -1);
|
|
7350
|
+
let ref2;
|
|
7351
|
+
children.splice(0, 2, {
|
|
7352
|
+
type: "ParenthesizedExpression",
|
|
7353
|
+
expression: middle,
|
|
7354
|
+
children: [call.children[0], middle, (ref2 = call.children)[ref2.length - 1]]
|
|
7355
|
+
});
|
|
7356
|
+
}
|
|
7340
7357
|
if (children.length === 1) {
|
|
7341
7358
|
return children[0];
|
|
7342
7359
|
}
|
|
@@ -7419,14 +7436,14 @@ function processCallMemberExpression(node) {
|
|
|
7419
7436
|
});
|
|
7420
7437
|
}
|
|
7421
7438
|
}
|
|
7422
|
-
let
|
|
7439
|
+
let ref3;
|
|
7423
7440
|
const object = {
|
|
7424
7441
|
type: "ObjectExpression",
|
|
7425
7442
|
children: [
|
|
7426
7443
|
glob.object.children[0],
|
|
7427
7444
|
// {
|
|
7428
7445
|
...parts,
|
|
7429
|
-
(
|
|
7446
|
+
(ref3 = glob.object.children)[ref3.length - 1]
|
|
7430
7447
|
// whitespace and }
|
|
7431
7448
|
],
|
|
7432
7449
|
properties: parts
|
|
@@ -7487,7 +7504,7 @@ function processCallMemberExpression(node) {
|
|
|
7487
7504
|
})
|
|
7488
7505
|
]
|
|
7489
7506
|
});
|
|
7490
|
-
let
|
|
7507
|
+
let ref4;
|
|
7491
7508
|
return processCallMemberExpression({
|
|
7492
7509
|
// in case there are more
|
|
7493
7510
|
...node,
|
|
@@ -7501,7 +7518,7 @@ function processCallMemberExpression(node) {
|
|
|
7501
7518
|
glob.children[0],
|
|
7502
7519
|
// "[" token
|
|
7503
7520
|
call,
|
|
7504
|
-
(
|
|
7521
|
+
(ref4 = glob.children)[ref4.length - 1]
|
|
7505
7522
|
// "]" token
|
|
7506
7523
|
]
|
|
7507
7524
|
}),
|
|
@@ -7514,7 +7531,7 @@ function processCallMemberExpression(node) {
|
|
|
7514
7531
|
{ ...glob.children[0], token: ", " },
|
|
7515
7532
|
...glob.children.slice(1, -1)
|
|
7516
7533
|
];
|
|
7517
|
-
let
|
|
7534
|
+
let ref5;
|
|
7518
7535
|
const rsliceCall = makeNode({
|
|
7519
7536
|
type: "CallExpression",
|
|
7520
7537
|
implicit: true,
|
|
@@ -7526,7 +7543,7 @@ function processCallMemberExpression(node) {
|
|
|
7526
7543
|
children: [
|
|
7527
7544
|
"(",
|
|
7528
7545
|
args,
|
|
7529
|
-
(
|
|
7546
|
+
(ref5 = glob.children)[ref5.length - 1]
|
|
7530
7547
|
]
|
|
7531
7548
|
})
|
|
7532
7549
|
]
|
|
@@ -7611,8 +7628,8 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7611
7628
|
return { type: "Error", message: "cannot use `type` in dynamic import" };
|
|
7612
7629
|
} else {
|
|
7613
7630
|
const { source, binding } = specifier;
|
|
7614
|
-
let
|
|
7615
|
-
const delim = (
|
|
7631
|
+
let ref6;
|
|
7632
|
+
const delim = (ref6 = specifier.children)[ref6.length - 1];
|
|
7616
7633
|
return {
|
|
7617
7634
|
type: pattern ? "BindingProperty" : "Property",
|
|
7618
7635
|
name: source,
|
|
@@ -7622,7 +7639,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7622
7639
|
};
|
|
7623
7640
|
}
|
|
7624
7641
|
});
|
|
7625
|
-
let
|
|
7642
|
+
let ref7;
|
|
7626
7643
|
return {
|
|
7627
7644
|
type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
|
|
7628
7645
|
names: node.names,
|
|
@@ -7631,7 +7648,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7631
7648
|
node.children[0],
|
|
7632
7649
|
// {
|
|
7633
7650
|
properties,
|
|
7634
|
-
(
|
|
7651
|
+
(ref7 = node.children)[ref7.length - 1]
|
|
7635
7652
|
// }
|
|
7636
7653
|
]
|
|
7637
7654
|
};
|
|
@@ -7752,7 +7769,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7752
7769
|
);
|
|
7753
7770
|
}
|
|
7754
7771
|
function processAssignments(statements) {
|
|
7755
|
-
for (let
|
|
7772
|
+
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref8.length; i5 < len3; i5++) {
|
|
7756
7773
|
let extractAssignment = function(lhs) {
|
|
7757
7774
|
let expr = lhs;
|
|
7758
7775
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -7772,20 +7789,20 @@ function processAssignments(statements) {
|
|
|
7772
7789
|
;
|
|
7773
7790
|
return;
|
|
7774
7791
|
};
|
|
7775
|
-
const exp =
|
|
7792
|
+
const exp = ref8[i5];
|
|
7776
7793
|
checkValidLHS(exp.assigned);
|
|
7777
7794
|
const pre = [], post = [];
|
|
7778
|
-
let
|
|
7795
|
+
let ref9;
|
|
7779
7796
|
switch (exp.type) {
|
|
7780
7797
|
case "AssignmentExpression": {
|
|
7781
7798
|
if (!exp.lhs) {
|
|
7782
7799
|
continue;
|
|
7783
7800
|
}
|
|
7784
|
-
for (let
|
|
7785
|
-
const lhsPart =
|
|
7786
|
-
let
|
|
7787
|
-
if (
|
|
7788
|
-
const newLhs =
|
|
7801
|
+
for (let ref10 = exp.lhs, i6 = 0, len4 = ref10.length; i6 < len4; i6++) {
|
|
7802
|
+
const lhsPart = ref10[i6];
|
|
7803
|
+
let ref11;
|
|
7804
|
+
if (ref11 = extractAssignment(lhsPart[1])) {
|
|
7805
|
+
const newLhs = ref11;
|
|
7789
7806
|
lhsPart[1] = newLhs;
|
|
7790
7807
|
}
|
|
7791
7808
|
}
|
|
@@ -7793,8 +7810,8 @@ function processAssignments(statements) {
|
|
|
7793
7810
|
break;
|
|
7794
7811
|
}
|
|
7795
7812
|
case "UpdateExpression": {
|
|
7796
|
-
if (
|
|
7797
|
-
const newLhs =
|
|
7813
|
+
if (ref9 = extractAssignment(exp.assigned)) {
|
|
7814
|
+
const newLhs = ref9;
|
|
7798
7815
|
const i = exp.children.indexOf(exp.assigned);
|
|
7799
7816
|
exp.assigned = exp.children[i] = newLhs;
|
|
7800
7817
|
}
|
|
@@ -7826,22 +7843,22 @@ function processAssignments(statements) {
|
|
|
7826
7843
|
}
|
|
7827
7844
|
}
|
|
7828
7845
|
}
|
|
7829
|
-
for (let
|
|
7830
|
-
const exp =
|
|
7846
|
+
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref12.length; i7 < len5; i7++) {
|
|
7847
|
+
const exp = ref12[i7];
|
|
7831
7848
|
if (!(exp.names === null)) {
|
|
7832
7849
|
continue;
|
|
7833
7850
|
}
|
|
7834
7851
|
let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
|
|
7835
7852
|
let block;
|
|
7836
|
-
let
|
|
7837
|
-
if (blockContainingStatement(exp) && !(
|
|
7853
|
+
let ref13;
|
|
7854
|
+
if (blockContainingStatement(exp) && !(ref13 = $1[$1.length - 1])?.[ref13.length - 1]?.special) {
|
|
7838
7855
|
block = makeBlockFragment();
|
|
7839
|
-
let
|
|
7840
|
-
if (
|
|
7856
|
+
let ref14;
|
|
7857
|
+
if (ref14 = prependStatementExpressionBlock(
|
|
7841
7858
|
{ type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
|
|
7842
7859
|
block
|
|
7843
7860
|
)) {
|
|
7844
|
-
const ref =
|
|
7861
|
+
const ref = ref14;
|
|
7845
7862
|
exp.children = exp.children.map(($7) => $7 === $2 ? ref : $7);
|
|
7846
7863
|
$2 = ref;
|
|
7847
7864
|
} else {
|
|
@@ -8022,9 +8039,9 @@ function unchainOptionalMemberExpression(exp, ref, innerExp) {
|
|
|
8022
8039
|
}
|
|
8023
8040
|
j++;
|
|
8024
8041
|
}
|
|
8025
|
-
let
|
|
8026
|
-
if (
|
|
8027
|
-
const l =
|
|
8042
|
+
let ref15;
|
|
8043
|
+
if (ref15 = conditions.length) {
|
|
8044
|
+
const l = ref15;
|
|
8028
8045
|
const cs = flatJoin(conditions, " && ");
|
|
8029
8046
|
return {
|
|
8030
8047
|
...exp,
|
|
@@ -8060,8 +8077,8 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
8060
8077
|
}
|
|
8061
8078
|
function processTypes(node) {
|
|
8062
8079
|
const results1 = [];
|
|
8063
|
-
for (let
|
|
8064
|
-
const unary =
|
|
8080
|
+
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref16.length; i8 < len6; i8++) {
|
|
8081
|
+
const unary = ref16[i8];
|
|
8065
8082
|
let suffixIndex = unary.suffix.length - 1;
|
|
8066
8083
|
const results2 = [];
|
|
8067
8084
|
while (suffixIndex >= 0) {
|
|
@@ -8140,10 +8157,10 @@ function processTypes(node) {
|
|
|
8140
8157
|
const outer = unary.suffix.splice(suffixIndex + 1, Infinity);
|
|
8141
8158
|
const space = getTrimmingSpace(unary);
|
|
8142
8159
|
inplaceInsertTrimmingSpace(unary, "");
|
|
8143
|
-
let
|
|
8144
|
-
if (unary.suffix.length)
|
|
8145
|
-
else
|
|
8146
|
-
const t =
|
|
8160
|
+
let ref17;
|
|
8161
|
+
if (unary.suffix.length) ref17 = unary;
|
|
8162
|
+
else ref17 = unary.t;
|
|
8163
|
+
const t = ref17;
|
|
8147
8164
|
const arg = makeNode({
|
|
8148
8165
|
type: "TypeArgument",
|
|
8149
8166
|
ts: true,
|
|
@@ -8188,18 +8205,18 @@ function processTypes(node) {
|
|
|
8188
8205
|
return results1;
|
|
8189
8206
|
}
|
|
8190
8207
|
function processStatementExpressions(statements) {
|
|
8191
|
-
for (let
|
|
8192
|
-
const exp =
|
|
8208
|
+
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref18.length; i9 < len7; i9++) {
|
|
8209
|
+
const exp = ref18[i9];
|
|
8193
8210
|
const { maybe, statement } = exp;
|
|
8194
8211
|
if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
|
|
8195
8212
|
replaceNode(exp, statement);
|
|
8196
8213
|
continue;
|
|
8197
8214
|
}
|
|
8198
|
-
let
|
|
8215
|
+
let ref19;
|
|
8199
8216
|
switch (statement.type) {
|
|
8200
8217
|
case "IfStatement": {
|
|
8201
|
-
if (
|
|
8202
|
-
const expression =
|
|
8218
|
+
if (ref19 = expressionizeIfStatement(statement)) {
|
|
8219
|
+
const expression = ref19;
|
|
8203
8220
|
replaceNode(statement, expression, exp);
|
|
8204
8221
|
} else {
|
|
8205
8222
|
replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -8258,13 +8275,13 @@ function processNegativeIndexAccess(statements) {
|
|
|
8258
8275
|
});
|
|
8259
8276
|
}
|
|
8260
8277
|
function processFinallyClauses(statements) {
|
|
8261
|
-
for (let
|
|
8262
|
-
let f =
|
|
8263
|
-
let
|
|
8264
|
-
if (!((
|
|
8278
|
+
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref20.length; i10 < len8; i10++) {
|
|
8279
|
+
let f = ref20[i10];
|
|
8280
|
+
let ref21;
|
|
8281
|
+
if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
|
|
8265
8282
|
throw new Error("finally clause must be inside try statement or block");
|
|
8266
8283
|
}
|
|
8267
|
-
const { block, index } =
|
|
8284
|
+
const { block, index } = ref21;
|
|
8268
8285
|
const indent = block.expressions[index][0];
|
|
8269
8286
|
const expressions = block.expressions.slice(index + 1);
|
|
8270
8287
|
const t = makeNode({
|
|
@@ -8336,8 +8353,8 @@ function processBreaksContinues(statements) {
|
|
|
8336
8353
|
}
|
|
8337
8354
|
}
|
|
8338
8355
|
function processCoffeeClasses(statements) {
|
|
8339
|
-
for (let
|
|
8340
|
-
const ce =
|
|
8356
|
+
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref22.length; i11 < len9; i11++) {
|
|
8357
|
+
const ce = ref22[i11];
|
|
8341
8358
|
const { expressions } = ce.body;
|
|
8342
8359
|
const indent = expressions[0]?.[0] ?? "\n";
|
|
8343
8360
|
const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
|
|
@@ -8487,8 +8504,8 @@ async function processProgramAsync(root) {
|
|
|
8487
8504
|
function processRepl(root, rootIIFE) {
|
|
8488
8505
|
const topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0];
|
|
8489
8506
|
let i = 0;
|
|
8490
|
-
for (let
|
|
8491
|
-
const decl =
|
|
8507
|
+
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref23.length; i14 < len11; i14++) {
|
|
8508
|
+
const decl = ref23[i14];
|
|
8492
8509
|
if (!decl.names?.length) {
|
|
8493
8510
|
continue;
|
|
8494
8511
|
}
|
|
@@ -8501,8 +8518,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8501
8518
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
8502
8519
|
}
|
|
8503
8520
|
}
|
|
8504
|
-
for (let
|
|
8505
|
-
const func =
|
|
8521
|
+
for (let ref24 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref24.length; i15 < len12; i15++) {
|
|
8522
|
+
const func = ref24[i15];
|
|
8506
8523
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
8507
8524
|
if (func.parent === topBlock) {
|
|
8508
8525
|
replaceNode(func, void 0);
|
|
@@ -8514,8 +8531,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8514
8531
|
}
|
|
8515
8532
|
}
|
|
8516
8533
|
}
|
|
8517
|
-
for (let
|
|
8518
|
-
const classExp =
|
|
8534
|
+
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref25.length; i16 < len13; i16++) {
|
|
8535
|
+
const classExp = ref25[i16];
|
|
8519
8536
|
let m8;
|
|
8520
8537
|
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)) {
|
|
8521
8538
|
classExp.children.unshift(classExp.name, "=");
|
|
@@ -8526,8 +8543,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8526
8543
|
function processPlaceholders(statements) {
|
|
8527
8544
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
8528
8545
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
8529
|
-
for (let
|
|
8530
|
-
const exp =
|
|
8546
|
+
for (let ref26 = gatherRecursiveAll(statements, ($21) => $21.type === "Placeholder"), i17 = 0, len14 = ref26.length; i17 < len14; i17++) {
|
|
8547
|
+
const exp = ref26[i17];
|
|
8531
8548
|
let ancestor;
|
|
8532
8549
|
if (exp.subtype === ".") {
|
|
8533
8550
|
({ ancestor } = findAncestor(
|
|
@@ -8639,8 +8656,8 @@ function processPlaceholders(statements) {
|
|
|
8639
8656
|
for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
|
|
8640
8657
|
const placeholder = placeholders[i18];
|
|
8641
8658
|
typeSuffix ??= placeholder.typeSuffix;
|
|
8642
|
-
let
|
|
8643
|
-
(
|
|
8659
|
+
let ref27;
|
|
8660
|
+
(ref27 = placeholder.children)[ref27.length - 1] = ref;
|
|
8644
8661
|
}
|
|
8645
8662
|
const { parent } = ancestor;
|
|
8646
8663
|
const body = maybeUnwrap(ancestor);
|
|
@@ -8661,16 +8678,16 @@ function processPlaceholders(statements) {
|
|
|
8661
8678
|
}
|
|
8662
8679
|
case "PipelineExpression": {
|
|
8663
8680
|
const i = findChildIndex(parent, ancestor);
|
|
8664
|
-
let
|
|
8681
|
+
let ref28;
|
|
8665
8682
|
if (i === 1) {
|
|
8666
|
-
|
|
8683
|
+
ref28 = ancestor === parent.children[i];
|
|
8667
8684
|
} else if (i === 2) {
|
|
8668
|
-
|
|
8685
|
+
ref28 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
8669
8686
|
} else {
|
|
8670
|
-
|
|
8687
|
+
ref28 = void 0;
|
|
8671
8688
|
}
|
|
8672
8689
|
;
|
|
8673
|
-
outer =
|
|
8690
|
+
outer = ref28;
|
|
8674
8691
|
break;
|
|
8675
8692
|
}
|
|
8676
8693
|
case "AssignmentExpression":
|
|
@@ -8685,9 +8702,12 @@ function processPlaceholders(statements) {
|
|
|
8685
8702
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
8686
8703
|
}
|
|
8687
8704
|
replaceNode(ancestor, fnExp, parent);
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8705
|
+
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) {
|
|
8706
|
+
parent.parent.body = fnExp;
|
|
8707
|
+
}
|
|
8708
|
+
let ref29;
|
|
8709
|
+
if (ref29 = getTrimmingSpace(body)) {
|
|
8710
|
+
const ws = ref29;
|
|
8691
8711
|
inplaceInsertTrimmingSpace(body, "");
|
|
8692
8712
|
inplacePrepend(ws, fnExp);
|
|
8693
8713
|
}
|
|
@@ -8731,8 +8751,8 @@ function reorderBindingRestProperty(props) {
|
|
|
8731
8751
|
}
|
|
8732
8752
|
];
|
|
8733
8753
|
}
|
|
8734
|
-
let
|
|
8735
|
-
if (Array.isArray(rest.delim) && (
|
|
8754
|
+
let ref30;
|
|
8755
|
+
if (Array.isArray(rest.delim) && (ref30 = rest.delim)[ref30.length - 1]?.token === ",") {
|
|
8736
8756
|
rest.delim = rest.delim.slice(0, -1);
|
|
8737
8757
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
8738
8758
|
}
|
|
@@ -8950,6 +8970,7 @@ var grammar = {
|
|
|
8950
8970
|
ExplicitPropertyGlob,
|
|
8951
8971
|
PropertyGlob,
|
|
8952
8972
|
PropertyBind,
|
|
8973
|
+
PropertyBindExplicitArguments,
|
|
8953
8974
|
SuperProperty,
|
|
8954
8975
|
MetaProperty,
|
|
8955
8976
|
ReturnValue,
|
|
@@ -10483,13 +10504,19 @@ var IsLike$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Is, (0, import_lib2.$E)(
|
|
|
10483
10504
|
function IsLike(ctx, state2) {
|
|
10484
10505
|
return (0, import_lib2.$EVENT)(ctx, state2, "IsLike", IsLike$0);
|
|
10485
10506
|
}
|
|
10486
|
-
var WRHS$0 = (0, import_lib2.$
|
|
10507
|
+
var WRHS$0 = (0, import_lib2.$T)((0, import_lib2.$S)(NestedBulletedArray), function(value) {
|
|
10508
|
+
return [void 0, value[0]];
|
|
10509
|
+
});
|
|
10510
|
+
var WRHS$1 = (0, import_lib2.$T)((0, import_lib2.$S)(NestedImplicitObjectLiteral), function(value) {
|
|
10511
|
+
return [void 0, value[0]];
|
|
10512
|
+
});
|
|
10513
|
+
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) {
|
|
10487
10514
|
var wrhs = $2;
|
|
10488
10515
|
if (!wrhs) return $skip;
|
|
10489
10516
|
return wrhs;
|
|
10490
10517
|
});
|
|
10491
|
-
var WRHS$
|
|
10492
|
-
var WRHS$$ = [WRHS$0, WRHS$1];
|
|
10518
|
+
var WRHS$3 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS);
|
|
10519
|
+
var WRHS$$ = [WRHS$0, WRHS$1, WRHS$2, WRHS$3];
|
|
10493
10520
|
function WRHS(ctx, state2) {
|
|
10494
10521
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "WRHS", WRHS$$);
|
|
10495
10522
|
}
|
|
@@ -10628,11 +10655,13 @@ var NWTypePostfix$$ = [NWTypePostfix$0, NWTypePostfix$1, NWTypePostfix$2];
|
|
|
10628
10655
|
function NWTypePostfix(ctx, state2) {
|
|
10629
10656
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NWTypePostfix", NWTypePostfix$$);
|
|
10630
10657
|
}
|
|
10631
|
-
var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressionSymbol, UnaryWithoutParenthesizedAssignment), function($skip, $loc, $0, $1, $2) {
|
|
10658
|
+
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) {
|
|
10659
|
+
var symbol = $1;
|
|
10660
|
+
var assigned = $3;
|
|
10632
10661
|
return {
|
|
10633
10662
|
type: "UpdateExpression",
|
|
10634
|
-
assigned
|
|
10635
|
-
children:
|
|
10663
|
+
assigned,
|
|
10664
|
+
children: [symbol, assigned]
|
|
10636
10665
|
};
|
|
10637
10666
|
});
|
|
10638
10667
|
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) {
|
|
@@ -10920,24 +10949,27 @@ var PipelineHeadItem$$ = [PipelineHeadItem$0, PipelineHeadItem$1];
|
|
|
10920
10949
|
function PipelineHeadItem(ctx, state2) {
|
|
10921
10950
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineHeadItem", PipelineHeadItem$$);
|
|
10922
10951
|
}
|
|
10923
|
-
var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp,
|
|
10952
|
+
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) {
|
|
10924
10953
|
return value[0];
|
|
10925
10954
|
});
|
|
10926
|
-
var PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
10955
|
+
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) {
|
|
10956
|
+
return { $loc, token: $1, type: "Yield" };
|
|
10957
|
+
});
|
|
10958
|
+
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) {
|
|
10927
10959
|
return {
|
|
10928
10960
|
type: "Identifier",
|
|
10929
10961
|
children: [$1]
|
|
10930
10962
|
};
|
|
10931
10963
|
});
|
|
10932
|
-
var PipelineTailItem$
|
|
10964
|
+
var PipelineTailItem$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix, (0, import_lib2.$Q)(TypePostfix)), function($skip, $loc, $0, $1, $2) {
|
|
10933
10965
|
return makeAmpersandFunction({
|
|
10934
10966
|
body: [" ", $1, ...$2]
|
|
10935
10967
|
});
|
|
10936
10968
|
});
|
|
10937
|
-
var PipelineTailItem$
|
|
10969
|
+
var PipelineTailItem$4 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
|
|
10938
10970
|
return value[0];
|
|
10939
10971
|
});
|
|
10940
|
-
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3];
|
|
10972
|
+
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3, PipelineTailItem$4];
|
|
10941
10973
|
function PipelineTailItem(ctx, state2) {
|
|
10942
10974
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineTailItem", PipelineTailItem$$);
|
|
10943
10975
|
}
|
|
@@ -12002,6 +12034,23 @@ var PropertyBind$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E
|
|
|
12002
12034
|
function PropertyBind(ctx, state2) {
|
|
12003
12035
|
return (0, import_lib2.$EVENT)(ctx, state2, "PropertyBind", PropertyBind$0);
|
|
12004
12036
|
}
|
|
12037
|
+
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) {
|
|
12038
|
+
var modifier = $1;
|
|
12039
|
+
var dot = $3;
|
|
12040
|
+
var id = $4;
|
|
12041
|
+
var args = $5;
|
|
12042
|
+
return {
|
|
12043
|
+
type: "PropertyBind",
|
|
12044
|
+
name: id.name,
|
|
12045
|
+
children: [modifier, dot, id],
|
|
12046
|
+
// omit `@` from children
|
|
12047
|
+
args: args?.children.slice(1, -1) ?? []
|
|
12048
|
+
// remove the parens from the arg list, or give an empty list
|
|
12049
|
+
};
|
|
12050
|
+
});
|
|
12051
|
+
function PropertyBindExplicitArguments(ctx, state2) {
|
|
12052
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "PropertyBindExplicitArguments", PropertyBindExplicitArguments$0);
|
|
12053
|
+
}
|
|
12005
12054
|
var SuperProperty$0 = (0, import_lib2.$S)(Super, MemberBracketContent);
|
|
12006
12055
|
var SuperProperty$1 = (0, import_lib2.$S)(Super, (0, import_lib2.$N)(PropertyAccessModifier), PropertyAccess);
|
|
12007
12056
|
var SuperProperty$$ = [SuperProperty$0, SuperProperty$1];
|
|
@@ -12688,13 +12737,17 @@ var FunctionExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionSign
|
|
|
12688
12737
|
block
|
|
12689
12738
|
};
|
|
12690
12739
|
});
|
|
12691
|
-
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) {
|
|
12740
|
+
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) {
|
|
12692
12741
|
var open = $2;
|
|
12693
|
-
var
|
|
12694
|
-
var
|
|
12742
|
+
var ws1 = $3;
|
|
12743
|
+
var op = $4;
|
|
12744
|
+
var ws2 = $5;
|
|
12745
|
+
var close = $6;
|
|
12695
12746
|
if (op.special && op.call && !op.negated) return op.call;
|
|
12747
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12748
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12696
12749
|
const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
|
|
12697
|
-
[
|
|
12750
|
+
[ws1, op, ws2, refB]
|
|
12698
12751
|
// BinaryOpRHS
|
|
12699
12752
|
]]);
|
|
12700
12753
|
const parameterList = [[refA, ","], refB];
|
|
@@ -12726,6 +12779,8 @@ var FunctionExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, N
|
|
|
12726
12779
|
var op = $4;
|
|
12727
12780
|
var ws2 = $5;
|
|
12728
12781
|
var close = $6;
|
|
12782
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12783
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12729
12784
|
const refB = makeRef("b");
|
|
12730
12785
|
const fn = makeAmpersandFunction({
|
|
12731
12786
|
ref: refB,
|
|
@@ -12792,6 +12847,8 @@ var FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, _
|
|
|
12792
12847
|
var ws2 = $6;
|
|
12793
12848
|
var rhs = $7;
|
|
12794
12849
|
var close = $8;
|
|
12850
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12851
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12795
12852
|
const refA = makeRef("a");
|
|
12796
12853
|
const fn = makeAmpersandFunction({
|
|
12797
12854
|
ref: refA,
|
|
@@ -12816,10 +12873,9 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12816
12873
|
var w = $3;
|
|
12817
12874
|
var decl = $4;
|
|
12818
12875
|
decl.names.forEach((name) => state.operators.set(name, behavior));
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
};
|
|
12876
|
+
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
12877
|
+
decl = prepend(trimFirstSpace(w), decl);
|
|
12878
|
+
return decl;
|
|
12823
12879
|
});
|
|
12824
12880
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
12825
12881
|
var signature = $1;
|
|
@@ -12840,11 +12896,16 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
12840
12896
|
var id = $3;
|
|
12841
12897
|
var behavior = $4;
|
|
12842
12898
|
var ids = $5;
|
|
12899
|
+
const children = [];
|
|
12843
12900
|
state.operators.set(id.name, behavior);
|
|
12844
|
-
|
|
12901
|
+
if (behavior?.error) children.push(behavior.error);
|
|
12902
|
+
ids.forEach(([, , id2, behavior2]) => {
|
|
12903
|
+
state.operators.set(id2.name, behavior2);
|
|
12904
|
+
if (behavior2?.error) children.push(behavior2.error);
|
|
12905
|
+
});
|
|
12845
12906
|
return {
|
|
12846
12907
|
id,
|
|
12847
|
-
children
|
|
12908
|
+
children
|
|
12848
12909
|
};
|
|
12849
12910
|
});
|
|
12850
12911
|
var OperatorDeclaration$$ = [OperatorDeclaration$0, OperatorDeclaration$1, OperatorDeclaration$2];
|
|
@@ -12882,7 +12943,7 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12882
12943
|
generator: !!generator.length
|
|
12883
12944
|
},
|
|
12884
12945
|
block: null,
|
|
12885
|
-
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
12946
|
+
children: [async, func, generator, w1, id, behavior?.error, w2, parameters, returnType],
|
|
12886
12947
|
behavior
|
|
12887
12948
|
};
|
|
12888
12949
|
});
|
|
@@ -12902,16 +12963,29 @@ function OperatorBehavior(ctx, state2) {
|
|
|
12902
12963
|
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) {
|
|
12903
12964
|
var mod = $2;
|
|
12904
12965
|
var op = $5;
|
|
12905
|
-
let prec
|
|
12966
|
+
let prec, error;
|
|
12967
|
+
if (op.type === "Identifier") {
|
|
12968
|
+
if (state.operators.has(op.name)) {
|
|
12969
|
+
prec = state.operators.get(op.name).prec;
|
|
12970
|
+
} else {
|
|
12971
|
+
prec = precedenceCustomDefault;
|
|
12972
|
+
error = {
|
|
12973
|
+
type: "Error",
|
|
12974
|
+
message: `Precedence refers to unknown operator ${op.name}`
|
|
12975
|
+
};
|
|
12976
|
+
}
|
|
12977
|
+
} else {
|
|
12978
|
+
prec = getPrecedence(op[1]);
|
|
12979
|
+
}
|
|
12906
12980
|
switch (mod) {
|
|
12907
12981
|
case "tighter":
|
|
12908
|
-
prec +=
|
|
12982
|
+
prec += precedenceStep;
|
|
12909
12983
|
break;
|
|
12910
12984
|
case "looser":
|
|
12911
|
-
prec -=
|
|
12985
|
+
prec -= precedenceStep;
|
|
12912
12986
|
break;
|
|
12913
12987
|
}
|
|
12914
|
-
return { prec };
|
|
12988
|
+
return { prec, error };
|
|
12915
12989
|
});
|
|
12916
12990
|
function OperatorPrecedence(ctx, state2) {
|
|
12917
12991
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorPrecedence", OperatorPrecedence$0);
|
|
@@ -14749,6 +14823,7 @@ var BinaryOpSymbol$13 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L23, 'Bin
|
|
|
14749
14823
|
return {
|
|
14750
14824
|
$loc,
|
|
14751
14825
|
token: "instanceof",
|
|
14826
|
+
spaced: true,
|
|
14752
14827
|
relational: true,
|
|
14753
14828
|
special: true
|
|
14754
14829
|
};
|
|
@@ -14757,6 +14832,7 @@ var BinaryOpSymbol$14 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L84, 'Bin
|
|
|
14757
14832
|
return {
|
|
14758
14833
|
$loc,
|
|
14759
14834
|
token: "instanceof",
|
|
14835
|
+
spaced: true,
|
|
14760
14836
|
relational: true,
|
|
14761
14837
|
special: true,
|
|
14762
14838
|
negated: true
|
|
@@ -14832,6 +14908,7 @@ var BinaryOpSymbol$40 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
14832
14908
|
return {
|
|
14833
14909
|
$loc,
|
|
14834
14910
|
token: $1,
|
|
14911
|
+
spaced: true,
|
|
14835
14912
|
relational: true,
|
|
14836
14913
|
special: true
|
|
14837
14914
|
// for typeof shorthand
|
|
@@ -14934,6 +15011,7 @@ var CoffeeOfOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __,
|
|
|
14934
15011
|
return {
|
|
14935
15012
|
$loc,
|
|
14936
15013
|
token: "in",
|
|
15014
|
+
spaced: true,
|
|
14937
15015
|
special: true,
|
|
14938
15016
|
negated: true
|
|
14939
15017
|
};
|
|
@@ -14955,6 +15033,7 @@ var NotOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
|
|
|
14955
15033
|
return {
|
|
14956
15034
|
$loc,
|
|
14957
15035
|
token: "instanceof",
|
|
15036
|
+
spaced: true,
|
|
14958
15037
|
relational: true,
|
|
14959
15038
|
special: true,
|
|
14960
15039
|
negated: true
|
|
@@ -14964,6 +15043,7 @@ var NotOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(In), function($skip, $loc
|
|
|
14964
15043
|
return {
|
|
14965
15044
|
$loc,
|
|
14966
15045
|
token: "in",
|
|
15046
|
+
spaced: true,
|
|
14967
15047
|
special: true,
|
|
14968
15048
|
negated: true
|
|
14969
15049
|
};
|
|
@@ -16477,31 +16557,27 @@ var Debugger$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPEC
|
|
|
16477
16557
|
function Debugger(ctx, state2) {
|
|
16478
16558
|
return (0, import_lib2.$EVENT)(ctx, state2, "Debugger", Debugger$0);
|
|
16479
16559
|
}
|
|
16480
|
-
var MaybeNestedNonPipelineExpression$0 = NestedBulletedArray
|
|
16481
|
-
var
|
|
16482
|
-
var
|
|
16483
|
-
var expression = $2;
|
|
16484
|
-
var trailing = $4;
|
|
16560
|
+
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) {
|
|
16561
|
+
var expression = $4;
|
|
16562
|
+
var trailing = $6;
|
|
16485
16563
|
if (!expression) return $skip;
|
|
16486
16564
|
if (!trailing) return expression;
|
|
16487
16565
|
return [expression, trailing];
|
|
16488
16566
|
});
|
|
16489
|
-
var MaybeNestedNonPipelineExpression$
|
|
16490
|
-
var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1
|
|
16567
|
+
var MaybeNestedNonPipelineExpression$1 = NonPipelineExpression;
|
|
16568
|
+
var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1];
|
|
16491
16569
|
function MaybeNestedNonPipelineExpression(ctx, state2) {
|
|
16492
16570
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
|
|
16493
16571
|
}
|
|
16494
|
-
var MaybeNestedPostfixedExpression$0 = NestedBulletedArray
|
|
16495
|
-
var
|
|
16496
|
-
var
|
|
16497
|
-
var expression = $2;
|
|
16498
|
-
var trailing = $4;
|
|
16572
|
+
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) {
|
|
16573
|
+
var expression = $4;
|
|
16574
|
+
var trailing = $6;
|
|
16499
16575
|
if (!expression) return $skip;
|
|
16500
16576
|
if (!trailing) return expression;
|
|
16501
16577
|
return [expression, trailing];
|
|
16502
16578
|
});
|
|
16503
|
-
var MaybeNestedPostfixedExpression$
|
|
16504
|
-
var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1
|
|
16579
|
+
var MaybeNestedPostfixedExpression$1 = PostfixedExpression;
|
|
16580
|
+
var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1];
|
|
16505
16581
|
function MaybeNestedPostfixedExpression(ctx, state2) {
|
|
16506
16582
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
|
|
16507
16583
|
}
|
|
@@ -16516,17 +16592,15 @@ var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing
|
|
|
16516
16592
|
function NestedPostfixedExpressionNoTrailing(ctx, state2) {
|
|
16517
16593
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedPostfixedExpressionNoTrailing", NestedPostfixedExpressionNoTrailing$$);
|
|
16518
16594
|
}
|
|
16519
|
-
var MaybeNestedExpression$0 = NestedBulletedArray
|
|
16520
|
-
var
|
|
16521
|
-
var
|
|
16522
|
-
var expression = $2;
|
|
16523
|
-
var trailing = $4;
|
|
16595
|
+
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) {
|
|
16596
|
+
var expression = $4;
|
|
16597
|
+
var trailing = $6;
|
|
16524
16598
|
if (!expression) return $skip;
|
|
16525
16599
|
if (!trailing) return expression;
|
|
16526
16600
|
return [expression, trailing];
|
|
16527
16601
|
});
|
|
16528
|
-
var MaybeNestedExpression$
|
|
16529
|
-
var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1
|
|
16602
|
+
var MaybeNestedExpression$1 = Expression;
|
|
16603
|
+
var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1];
|
|
16530
16604
|
function MaybeNestedExpression(ctx, state2) {
|
|
16531
16605
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
|
|
16532
16606
|
}
|
|
@@ -16565,12 +16639,15 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16565
16639
|
var imports = $5;
|
|
16566
16640
|
var ws2 = $6;
|
|
16567
16641
|
var from = $7;
|
|
16642
|
+
const errors = [];
|
|
16643
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16568
16644
|
imports.specifiers.forEach((spec) => {
|
|
16569
16645
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16646
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16570
16647
|
});
|
|
16571
16648
|
return {
|
|
16572
16649
|
type: "ImportDeclaration",
|
|
16573
|
-
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
16650
|
+
children: [i, ...errors, trimFirstSpace(ws1), imports, ws2, from],
|
|
16574
16651
|
// omit $2 = Operator and $3 = OperatorBehavior
|
|
16575
16652
|
imports,
|
|
16576
16653
|
from
|
|
@@ -16613,12 +16690,15 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(ImpliedFromCl
|
|
|
16613
16690
|
var behavior = $6;
|
|
16614
16691
|
var ows = $7;
|
|
16615
16692
|
var imports = $8;
|
|
16693
|
+
const errors = [];
|
|
16694
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16616
16695
|
imports.specifiers.forEach((spec) => {
|
|
16617
16696
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16697
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16618
16698
|
});
|
|
16619
16699
|
return {
|
|
16620
16700
|
type: "ImportDeclaration",
|
|
16621
|
-
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
16701
|
+
children: [i, iws, ...errors, trimFirstSpace(ows), imports, fws, from],
|
|
16622
16702
|
// omit Operator and OperatorBehavior
|
|
16623
16703
|
imports,
|
|
16624
16704
|
from
|
|
@@ -16800,7 +16880,7 @@ var OperatorImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Mod
|
|
|
16800
16880
|
return {
|
|
16801
16881
|
binding,
|
|
16802
16882
|
behavior,
|
|
16803
|
-
children: [$1, $2, $4, $5, $6, $7]
|
|
16883
|
+
children: [$1, $2, $3?.error, $4, $5, $6, $7]
|
|
16804
16884
|
};
|
|
16805
16885
|
});
|
|
16806
16886
|
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) {
|
|
@@ -16809,7 +16889,7 @@ var OperatorImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Imp
|
|
|
16809
16889
|
return {
|
|
16810
16890
|
binding,
|
|
16811
16891
|
behavior,
|
|
16812
|
-
children: [$1, $2, $4]
|
|
16892
|
+
children: [$1, $2, $3?.error, $4]
|
|
16813
16893
|
};
|
|
16814
16894
|
});
|
|
16815
16895
|
var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecifier$1];
|
|
@@ -17932,7 +18012,7 @@ function Import(ctx, state2) {
|
|
|
17932
18012
|
return (0, import_lib2.$EVENT)(ctx, state2, "Import", Import$0);
|
|
17933
18013
|
}
|
|
17934
18014
|
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) {
|
|
17935
|
-
return { $loc, token: $1 };
|
|
18015
|
+
return { $loc, token: $1, spaced: true };
|
|
17936
18016
|
});
|
|
17937
18017
|
function In(ctx, state2) {
|
|
17938
18018
|
return (0, import_lib2.$EVENT)(ctx, state2, "In", In$0);
|
|
@@ -18792,7 +18872,7 @@ var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
|
|
|
18792
18872
|
});
|
|
18793
18873
|
var InlineJSXMemberExpressionRest$1 = PropertyAccess;
|
|
18794
18874
|
var InlineJSXMemberExpressionRest$2 = PropertyGlob;
|
|
18795
|
-
var InlineJSXMemberExpressionRest$3 =
|
|
18875
|
+
var InlineJSXMemberExpressionRest$3 = PropertyBindExplicitArguments;
|
|
18796
18876
|
var InlineJSXMemberExpressionRest$4 = NonNullAssertion;
|
|
18797
18877
|
var InlineJSXMemberExpressionRest$$ = [InlineJSXMemberExpressionRest$0, InlineJSXMemberExpressionRest$1, InlineJSXMemberExpressionRest$2, InlineJSXMemberExpressionRest$3, InlineJSXMemberExpressionRest$4];
|
|
18798
18878
|
function InlineJSXMemberExpressionRest(ctx, state2) {
|