@danielx/civet 0.9.5 → 0.9.6
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 +10 -0
- package/dist/browser.js +152 -123
- package/dist/main.js +181 -124
- package/dist/main.mjs +181 -124
- 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,
|
|
@@ -3081,6 +3082,7 @@ function assignResults(node, collect) {
|
|
|
3081
3082
|
exp = exp.statement;
|
|
3082
3083
|
}
|
|
3083
3084
|
let ref6;
|
|
3085
|
+
let m1;
|
|
3084
3086
|
switch (exp.type) {
|
|
3085
3087
|
case "BreakStatement":
|
|
3086
3088
|
case "ContinueStatement":
|
|
@@ -3160,6 +3162,9 @@ function assignResults(node, collect) {
|
|
|
3160
3162
|
return;
|
|
3161
3163
|
}
|
|
3162
3164
|
case "PipelineExpression": {
|
|
3165
|
+
if (m1 = exp.children[1]?.type, m1 === "ReturnStatement" || m1 === "ThrowStatement") {
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3163
3168
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3164
3169
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3165
3170
|
exp.children.splice(semi2 + 1, 1 / 0, ...[collect(exp.children.slice(semi2 + 1))]);
|
|
@@ -3185,8 +3190,8 @@ function insertReturn(node) {
|
|
|
3185
3190
|
const last = node.expressions[node.expressions.length - 1];
|
|
3186
3191
|
insertReturn(last);
|
|
3187
3192
|
} else {
|
|
3188
|
-
let
|
|
3189
|
-
if (
|
|
3193
|
+
let m2;
|
|
3194
|
+
if (m2 = node.parent?.type, m2 === "CatchClause" || m2 === "WhenClause") {
|
|
3190
3195
|
node.expressions.push(["", wrapWithReturn(void 0, node)]);
|
|
3191
3196
|
}
|
|
3192
3197
|
}
|
|
@@ -3232,6 +3237,7 @@ function insertReturn(node) {
|
|
|
3232
3237
|
exp = exp.statement;
|
|
3233
3238
|
}
|
|
3234
3239
|
let ref11;
|
|
3240
|
+
let m3;
|
|
3235
3241
|
switch (exp.type) {
|
|
3236
3242
|
case "BreakStatement":
|
|
3237
3243
|
case "ContinueStatement":
|
|
@@ -3323,6 +3329,9 @@ function insertReturn(node) {
|
|
|
3323
3329
|
return;
|
|
3324
3330
|
}
|
|
3325
3331
|
case "PipelineExpression": {
|
|
3332
|
+
if (m3 = exp.children[1]?.type, m3 === "ReturnStatement" || m3 === "ThrowStatement") {
|
|
3333
|
+
return;
|
|
3334
|
+
}
|
|
3326
3335
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3327
3336
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3328
3337
|
exp.children.splice(semi2 + 1, 1 / 0, ...[wrapWithReturn(exp.children.slice(semi2 + 1))]);
|
|
@@ -3345,8 +3354,8 @@ function processBreakContinueWith(statement) {
|
|
|
3345
3354
|
)) {
|
|
3346
3355
|
if (control.with) {
|
|
3347
3356
|
if (control.label) {
|
|
3348
|
-
let
|
|
3349
|
-
if (!(
|
|
3357
|
+
let m4;
|
|
3358
|
+
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
3359
|
continue;
|
|
3351
3360
|
}
|
|
3352
3361
|
} else {
|
|
@@ -3567,8 +3576,8 @@ function iterationDefaultBody(statement) {
|
|
|
3567
3576
|
const reduction = statement.type === "ForStatement" && statement.reduction;
|
|
3568
3577
|
function fillBlock(expression) {
|
|
3569
3578
|
let ref15;
|
|
3570
|
-
let
|
|
3571
|
-
if (
|
|
3579
|
+
let m5;
|
|
3580
|
+
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
3581
|
block.expressions.pop();
|
|
3573
3582
|
}
|
|
3574
3583
|
block.expressions.push(expression);
|
|
@@ -3696,8 +3705,8 @@ function processParams(f) {
|
|
|
3696
3705
|
parameters.names.push(...rest.names || []);
|
|
3697
3706
|
rest.children.pop();
|
|
3698
3707
|
if (after.length) {
|
|
3699
|
-
let
|
|
3700
|
-
if (
|
|
3708
|
+
let m6;
|
|
3709
|
+
if (m6 = rest.binding.type, m6 === "ArrayBindingPattern" || m6 === "ObjectBindingPattern" || m6 === "NamedBindingPattern") {
|
|
3701
3710
|
parameters.parameters.push({
|
|
3702
3711
|
type: "Error",
|
|
3703
3712
|
message: "Non-end rest parameter cannot be binding pattern"
|
|
@@ -3839,8 +3848,8 @@ function processParams(f) {
|
|
|
3839
3848
|
const classExpressions = ancestor.body.expressions;
|
|
3840
3849
|
let index2 = findChildIndex(classExpressions, f);
|
|
3841
3850
|
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3842
|
-
let
|
|
3843
|
-
while (
|
|
3851
|
+
let m7;
|
|
3852
|
+
while (m7 = classExpressions[index2 - 1]?.[1], typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor") {
|
|
3844
3853
|
index2--;
|
|
3845
3854
|
}
|
|
3846
3855
|
const fStatement = classExpressions[index2];
|
|
@@ -5997,9 +6006,8 @@ function constructInvocation(fn, arg) {
|
|
|
5997
6006
|
if (lhs.type === "NewExpression") {
|
|
5998
6007
|
let { expression } = lhs;
|
|
5999
6008
|
expression = {
|
|
6000
|
-
...expression,
|
|
6001
6009
|
type: "CallExpression",
|
|
6002
|
-
children: [
|
|
6010
|
+
children: [expression, call]
|
|
6003
6011
|
};
|
|
6004
6012
|
return {
|
|
6005
6013
|
...lhs,
|
|
@@ -6052,23 +6060,22 @@ function constructPipeStep(fn, arg, returning) {
|
|
|
6052
6060
|
];
|
|
6053
6061
|
}
|
|
6054
6062
|
function processPipelineExpressions(statements) {
|
|
6055
|
-
gatherRecursiveAll(statements, (
|
|
6063
|
+
for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "PipelineExpression"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
|
|
6064
|
+
const s = ref1[i1];
|
|
6056
6065
|
const [ws, , body] = s.children;
|
|
6057
6066
|
let [, arg] = s.children;
|
|
6058
|
-
let i = 0;
|
|
6059
|
-
const l = body.length;
|
|
6060
6067
|
const children = [ws];
|
|
6061
6068
|
const comma = blockContainingStatement(s) ? ";" : ",";
|
|
6062
6069
|
let usingRef = null;
|
|
6063
|
-
for (let
|
|
6064
|
-
const
|
|
6065
|
-
const step = body[
|
|
6070
|
+
for (let i2 = 0, len1 = body.length; i2 < len1; i2++) {
|
|
6071
|
+
const i = i2;
|
|
6072
|
+
const step = body[i2];
|
|
6066
6073
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
6067
6074
|
const returns = pipe.token === "||>";
|
|
6068
6075
|
let ref, result, returning = returns ? arg : null;
|
|
6069
6076
|
if (pipe.token === "|>=") {
|
|
6070
6077
|
let initRef;
|
|
6071
|
-
if (
|
|
6078
|
+
if (i === 0) {
|
|
6072
6079
|
checkValidLHS(arg);
|
|
6073
6080
|
outer: switch (arg.type) {
|
|
6074
6081
|
case "MemberExpression": {
|
|
@@ -6117,7 +6124,7 @@ function processPipelineExpressions(statements) {
|
|
|
6117
6124
|
});
|
|
6118
6125
|
}
|
|
6119
6126
|
} else {
|
|
6120
|
-
if (
|
|
6127
|
+
if (i === 0) s.children = children;
|
|
6121
6128
|
}
|
|
6122
6129
|
if (returns && (ref = needsRef(arg))) {
|
|
6123
6130
|
usingRef = usingRef || ref;
|
|
@@ -6141,7 +6148,7 @@ function processPipelineExpressions(statements) {
|
|
|
6141
6148
|
returning
|
|
6142
6149
|
);
|
|
6143
6150
|
if (result.type === "ReturnStatement") {
|
|
6144
|
-
if (
|
|
6151
|
+
if (i < body.length - 1) {
|
|
6145
6152
|
result.children.push({
|
|
6146
6153
|
type: "Error",
|
|
6147
6154
|
message: "Can't continue a pipeline after returning"
|
|
@@ -6169,7 +6176,7 @@ function processPipelineExpressions(statements) {
|
|
|
6169
6176
|
};
|
|
6170
6177
|
}
|
|
6171
6178
|
children.push(arg);
|
|
6172
|
-
if (!children.some(($
|
|
6179
|
+
if (!children.some(($2) => $2?.type === "ReturnStatement") && children.some(($3) => $3 === ",")) {
|
|
6173
6180
|
const { parent } = s;
|
|
6174
6181
|
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
6175
6182
|
Object.assign(s, parenthesizedExpression, {
|
|
@@ -6177,8 +6184,8 @@ function processPipelineExpressions(statements) {
|
|
|
6177
6184
|
hoistDec: void 0
|
|
6178
6185
|
});
|
|
6179
6186
|
}
|
|
6180
|
-
|
|
6181
|
-
}
|
|
6187
|
+
addParentPointers(s, s.parent);
|
|
6188
|
+
}
|
|
6182
6189
|
}
|
|
6183
6190
|
|
|
6184
6191
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
|
|
@@ -7329,14 +7336,21 @@ function processCallMemberExpression(node) {
|
|
|
7329
7336
|
}
|
|
7330
7337
|
}
|
|
7331
7338
|
if (args.length) {
|
|
7332
|
-
|
|
7333
|
-
0,
|
|
7334
|
-
2,
|
|
7335
|
-
commaCount ? {
|
|
7339
|
+
if (commaCount) {
|
|
7340
|
+
children.splice(0, 2, {
|
|
7336
7341
|
type: "ParenthesizedExpression",
|
|
7337
|
-
children: ["(",
|
|
7338
|
-
|
|
7339
|
-
|
|
7342
|
+
children: ["(", call.children, ")"],
|
|
7343
|
+
expression: call.children
|
|
7344
|
+
});
|
|
7345
|
+
} else {
|
|
7346
|
+
const middle = call.children.slice(0 + 1, -1);
|
|
7347
|
+
let ref2;
|
|
7348
|
+
children.splice(0, 2, {
|
|
7349
|
+
type: "ParenthesizedExpression",
|
|
7350
|
+
expression: middle,
|
|
7351
|
+
children: [call.children[0], middle, (ref2 = call.children)[ref2.length - 1]]
|
|
7352
|
+
});
|
|
7353
|
+
}
|
|
7340
7354
|
if (children.length === 1) {
|
|
7341
7355
|
return children[0];
|
|
7342
7356
|
}
|
|
@@ -7419,14 +7433,14 @@ function processCallMemberExpression(node) {
|
|
|
7419
7433
|
});
|
|
7420
7434
|
}
|
|
7421
7435
|
}
|
|
7422
|
-
let
|
|
7436
|
+
let ref3;
|
|
7423
7437
|
const object = {
|
|
7424
7438
|
type: "ObjectExpression",
|
|
7425
7439
|
children: [
|
|
7426
7440
|
glob.object.children[0],
|
|
7427
7441
|
// {
|
|
7428
7442
|
...parts,
|
|
7429
|
-
(
|
|
7443
|
+
(ref3 = glob.object.children)[ref3.length - 1]
|
|
7430
7444
|
// whitespace and }
|
|
7431
7445
|
],
|
|
7432
7446
|
properties: parts
|
|
@@ -7487,7 +7501,7 @@ function processCallMemberExpression(node) {
|
|
|
7487
7501
|
})
|
|
7488
7502
|
]
|
|
7489
7503
|
});
|
|
7490
|
-
let
|
|
7504
|
+
let ref4;
|
|
7491
7505
|
return processCallMemberExpression({
|
|
7492
7506
|
// in case there are more
|
|
7493
7507
|
...node,
|
|
@@ -7501,7 +7515,7 @@ function processCallMemberExpression(node) {
|
|
|
7501
7515
|
glob.children[0],
|
|
7502
7516
|
// "[" token
|
|
7503
7517
|
call,
|
|
7504
|
-
(
|
|
7518
|
+
(ref4 = glob.children)[ref4.length - 1]
|
|
7505
7519
|
// "]" token
|
|
7506
7520
|
]
|
|
7507
7521
|
}),
|
|
@@ -7514,7 +7528,7 @@ function processCallMemberExpression(node) {
|
|
|
7514
7528
|
{ ...glob.children[0], token: ", " },
|
|
7515
7529
|
...glob.children.slice(1, -1)
|
|
7516
7530
|
];
|
|
7517
|
-
let
|
|
7531
|
+
let ref5;
|
|
7518
7532
|
const rsliceCall = makeNode({
|
|
7519
7533
|
type: "CallExpression",
|
|
7520
7534
|
implicit: true,
|
|
@@ -7526,7 +7540,7 @@ function processCallMemberExpression(node) {
|
|
|
7526
7540
|
children: [
|
|
7527
7541
|
"(",
|
|
7528
7542
|
args,
|
|
7529
|
-
(
|
|
7543
|
+
(ref5 = glob.children)[ref5.length - 1]
|
|
7530
7544
|
]
|
|
7531
7545
|
})
|
|
7532
7546
|
]
|
|
@@ -7611,8 +7625,8 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7611
7625
|
return { type: "Error", message: "cannot use `type` in dynamic import" };
|
|
7612
7626
|
} else {
|
|
7613
7627
|
const { source, binding } = specifier;
|
|
7614
|
-
let
|
|
7615
|
-
const delim = (
|
|
7628
|
+
let ref6;
|
|
7629
|
+
const delim = (ref6 = specifier.children)[ref6.length - 1];
|
|
7616
7630
|
return {
|
|
7617
7631
|
type: pattern ? "BindingProperty" : "Property",
|
|
7618
7632
|
name: source,
|
|
@@ -7622,7 +7636,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7622
7636
|
};
|
|
7623
7637
|
}
|
|
7624
7638
|
});
|
|
7625
|
-
let
|
|
7639
|
+
let ref7;
|
|
7626
7640
|
return {
|
|
7627
7641
|
type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
|
|
7628
7642
|
names: node.names,
|
|
@@ -7631,7 +7645,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7631
7645
|
node.children[0],
|
|
7632
7646
|
// {
|
|
7633
7647
|
properties,
|
|
7634
|
-
(
|
|
7648
|
+
(ref7 = node.children)[ref7.length - 1]
|
|
7635
7649
|
// }
|
|
7636
7650
|
]
|
|
7637
7651
|
};
|
|
@@ -7752,7 +7766,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7752
7766
|
);
|
|
7753
7767
|
}
|
|
7754
7768
|
function processAssignments(statements) {
|
|
7755
|
-
for (let
|
|
7769
|
+
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref8.length; i5 < len3; i5++) {
|
|
7756
7770
|
let extractAssignment = function(lhs) {
|
|
7757
7771
|
let expr = lhs;
|
|
7758
7772
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -7772,20 +7786,20 @@ function processAssignments(statements) {
|
|
|
7772
7786
|
;
|
|
7773
7787
|
return;
|
|
7774
7788
|
};
|
|
7775
|
-
const exp =
|
|
7789
|
+
const exp = ref8[i5];
|
|
7776
7790
|
checkValidLHS(exp.assigned);
|
|
7777
7791
|
const pre = [], post = [];
|
|
7778
|
-
let
|
|
7792
|
+
let ref9;
|
|
7779
7793
|
switch (exp.type) {
|
|
7780
7794
|
case "AssignmentExpression": {
|
|
7781
7795
|
if (!exp.lhs) {
|
|
7782
7796
|
continue;
|
|
7783
7797
|
}
|
|
7784
|
-
for (let
|
|
7785
|
-
const lhsPart =
|
|
7786
|
-
let
|
|
7787
|
-
if (
|
|
7788
|
-
const newLhs =
|
|
7798
|
+
for (let ref10 = exp.lhs, i6 = 0, len4 = ref10.length; i6 < len4; i6++) {
|
|
7799
|
+
const lhsPart = ref10[i6];
|
|
7800
|
+
let ref11;
|
|
7801
|
+
if (ref11 = extractAssignment(lhsPart[1])) {
|
|
7802
|
+
const newLhs = ref11;
|
|
7789
7803
|
lhsPart[1] = newLhs;
|
|
7790
7804
|
}
|
|
7791
7805
|
}
|
|
@@ -7793,8 +7807,8 @@ function processAssignments(statements) {
|
|
|
7793
7807
|
break;
|
|
7794
7808
|
}
|
|
7795
7809
|
case "UpdateExpression": {
|
|
7796
|
-
if (
|
|
7797
|
-
const newLhs =
|
|
7810
|
+
if (ref9 = extractAssignment(exp.assigned)) {
|
|
7811
|
+
const newLhs = ref9;
|
|
7798
7812
|
const i = exp.children.indexOf(exp.assigned);
|
|
7799
7813
|
exp.assigned = exp.children[i] = newLhs;
|
|
7800
7814
|
}
|
|
@@ -7826,22 +7840,22 @@ function processAssignments(statements) {
|
|
|
7826
7840
|
}
|
|
7827
7841
|
}
|
|
7828
7842
|
}
|
|
7829
|
-
for (let
|
|
7830
|
-
const exp =
|
|
7843
|
+
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref12.length; i7 < len5; i7++) {
|
|
7844
|
+
const exp = ref12[i7];
|
|
7831
7845
|
if (!(exp.names === null)) {
|
|
7832
7846
|
continue;
|
|
7833
7847
|
}
|
|
7834
7848
|
let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
|
|
7835
7849
|
let block;
|
|
7836
|
-
let
|
|
7837
|
-
if (blockContainingStatement(exp) && !(
|
|
7850
|
+
let ref13;
|
|
7851
|
+
if (blockContainingStatement(exp) && !(ref13 = $1[$1.length - 1])?.[ref13.length - 1]?.special) {
|
|
7838
7852
|
block = makeBlockFragment();
|
|
7839
|
-
let
|
|
7840
|
-
if (
|
|
7853
|
+
let ref14;
|
|
7854
|
+
if (ref14 = prependStatementExpressionBlock(
|
|
7841
7855
|
{ type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
|
|
7842
7856
|
block
|
|
7843
7857
|
)) {
|
|
7844
|
-
const ref =
|
|
7858
|
+
const ref = ref14;
|
|
7845
7859
|
exp.children = exp.children.map(($7) => $7 === $2 ? ref : $7);
|
|
7846
7860
|
$2 = ref;
|
|
7847
7861
|
} else {
|
|
@@ -8022,9 +8036,9 @@ function unchainOptionalMemberExpression(exp, ref, innerExp) {
|
|
|
8022
8036
|
}
|
|
8023
8037
|
j++;
|
|
8024
8038
|
}
|
|
8025
|
-
let
|
|
8026
|
-
if (
|
|
8027
|
-
const l =
|
|
8039
|
+
let ref15;
|
|
8040
|
+
if (ref15 = conditions.length) {
|
|
8041
|
+
const l = ref15;
|
|
8028
8042
|
const cs = flatJoin(conditions, " && ");
|
|
8029
8043
|
return {
|
|
8030
8044
|
...exp,
|
|
@@ -8060,8 +8074,8 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
8060
8074
|
}
|
|
8061
8075
|
function processTypes(node) {
|
|
8062
8076
|
const results1 = [];
|
|
8063
|
-
for (let
|
|
8064
|
-
const unary =
|
|
8077
|
+
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref16.length; i8 < len6; i8++) {
|
|
8078
|
+
const unary = ref16[i8];
|
|
8065
8079
|
let suffixIndex = unary.suffix.length - 1;
|
|
8066
8080
|
const results2 = [];
|
|
8067
8081
|
while (suffixIndex >= 0) {
|
|
@@ -8140,10 +8154,10 @@ function processTypes(node) {
|
|
|
8140
8154
|
const outer = unary.suffix.splice(suffixIndex + 1, Infinity);
|
|
8141
8155
|
const space = getTrimmingSpace(unary);
|
|
8142
8156
|
inplaceInsertTrimmingSpace(unary, "");
|
|
8143
|
-
let
|
|
8144
|
-
if (unary.suffix.length)
|
|
8145
|
-
else
|
|
8146
|
-
const t =
|
|
8157
|
+
let ref17;
|
|
8158
|
+
if (unary.suffix.length) ref17 = unary;
|
|
8159
|
+
else ref17 = unary.t;
|
|
8160
|
+
const t = ref17;
|
|
8147
8161
|
const arg = makeNode({
|
|
8148
8162
|
type: "TypeArgument",
|
|
8149
8163
|
ts: true,
|
|
@@ -8188,18 +8202,18 @@ function processTypes(node) {
|
|
|
8188
8202
|
return results1;
|
|
8189
8203
|
}
|
|
8190
8204
|
function processStatementExpressions(statements) {
|
|
8191
|
-
for (let
|
|
8192
|
-
const exp =
|
|
8205
|
+
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref18.length; i9 < len7; i9++) {
|
|
8206
|
+
const exp = ref18[i9];
|
|
8193
8207
|
const { maybe, statement } = exp;
|
|
8194
8208
|
if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
|
|
8195
8209
|
replaceNode(exp, statement);
|
|
8196
8210
|
continue;
|
|
8197
8211
|
}
|
|
8198
|
-
let
|
|
8212
|
+
let ref19;
|
|
8199
8213
|
switch (statement.type) {
|
|
8200
8214
|
case "IfStatement": {
|
|
8201
|
-
if (
|
|
8202
|
-
const expression =
|
|
8215
|
+
if (ref19 = expressionizeIfStatement(statement)) {
|
|
8216
|
+
const expression = ref19;
|
|
8203
8217
|
replaceNode(statement, expression, exp);
|
|
8204
8218
|
} else {
|
|
8205
8219
|
replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -8258,13 +8272,13 @@ function processNegativeIndexAccess(statements) {
|
|
|
8258
8272
|
});
|
|
8259
8273
|
}
|
|
8260
8274
|
function processFinallyClauses(statements) {
|
|
8261
|
-
for (let
|
|
8262
|
-
let f =
|
|
8263
|
-
let
|
|
8264
|
-
if (!((
|
|
8275
|
+
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref20.length; i10 < len8; i10++) {
|
|
8276
|
+
let f = ref20[i10];
|
|
8277
|
+
let ref21;
|
|
8278
|
+
if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
|
|
8265
8279
|
throw new Error("finally clause must be inside try statement or block");
|
|
8266
8280
|
}
|
|
8267
|
-
const { block, index } =
|
|
8281
|
+
const { block, index } = ref21;
|
|
8268
8282
|
const indent = block.expressions[index][0];
|
|
8269
8283
|
const expressions = block.expressions.slice(index + 1);
|
|
8270
8284
|
const t = makeNode({
|
|
@@ -8336,8 +8350,8 @@ function processBreaksContinues(statements) {
|
|
|
8336
8350
|
}
|
|
8337
8351
|
}
|
|
8338
8352
|
function processCoffeeClasses(statements) {
|
|
8339
|
-
for (let
|
|
8340
|
-
const ce =
|
|
8353
|
+
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref22.length; i11 < len9; i11++) {
|
|
8354
|
+
const ce = ref22[i11];
|
|
8341
8355
|
const { expressions } = ce.body;
|
|
8342
8356
|
const indent = expressions[0]?.[0] ?? "\n";
|
|
8343
8357
|
const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
|
|
@@ -8487,8 +8501,8 @@ async function processProgramAsync(root) {
|
|
|
8487
8501
|
function processRepl(root, rootIIFE) {
|
|
8488
8502
|
const topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0];
|
|
8489
8503
|
let i = 0;
|
|
8490
|
-
for (let
|
|
8491
|
-
const decl =
|
|
8504
|
+
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref23.length; i14 < len11; i14++) {
|
|
8505
|
+
const decl = ref23[i14];
|
|
8492
8506
|
if (!decl.names?.length) {
|
|
8493
8507
|
continue;
|
|
8494
8508
|
}
|
|
@@ -8501,8 +8515,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8501
8515
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
8502
8516
|
}
|
|
8503
8517
|
}
|
|
8504
|
-
for (let
|
|
8505
|
-
const func =
|
|
8518
|
+
for (let ref24 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref24.length; i15 < len12; i15++) {
|
|
8519
|
+
const func = ref24[i15];
|
|
8506
8520
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
8507
8521
|
if (func.parent === topBlock) {
|
|
8508
8522
|
replaceNode(func, void 0);
|
|
@@ -8514,8 +8528,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8514
8528
|
}
|
|
8515
8529
|
}
|
|
8516
8530
|
}
|
|
8517
|
-
for (let
|
|
8518
|
-
const classExp =
|
|
8531
|
+
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref25.length; i16 < len13; i16++) {
|
|
8532
|
+
const classExp = ref25[i16];
|
|
8519
8533
|
let m8;
|
|
8520
8534
|
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
8535
|
classExp.children.unshift(classExp.name, "=");
|
|
@@ -8526,8 +8540,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8526
8540
|
function processPlaceholders(statements) {
|
|
8527
8541
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
8528
8542
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
8529
|
-
for (let
|
|
8530
|
-
const exp =
|
|
8543
|
+
for (let ref26 = gatherRecursiveAll(statements, ($21) => $21.type === "Placeholder"), i17 = 0, len14 = ref26.length; i17 < len14; i17++) {
|
|
8544
|
+
const exp = ref26[i17];
|
|
8531
8545
|
let ancestor;
|
|
8532
8546
|
if (exp.subtype === ".") {
|
|
8533
8547
|
({ ancestor } = findAncestor(
|
|
@@ -8639,8 +8653,8 @@ function processPlaceholders(statements) {
|
|
|
8639
8653
|
for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
|
|
8640
8654
|
const placeholder = placeholders[i18];
|
|
8641
8655
|
typeSuffix ??= placeholder.typeSuffix;
|
|
8642
|
-
let
|
|
8643
|
-
(
|
|
8656
|
+
let ref27;
|
|
8657
|
+
(ref27 = placeholder.children)[ref27.length - 1] = ref;
|
|
8644
8658
|
}
|
|
8645
8659
|
const { parent } = ancestor;
|
|
8646
8660
|
const body = maybeUnwrap(ancestor);
|
|
@@ -8661,16 +8675,16 @@ function processPlaceholders(statements) {
|
|
|
8661
8675
|
}
|
|
8662
8676
|
case "PipelineExpression": {
|
|
8663
8677
|
const i = findChildIndex(parent, ancestor);
|
|
8664
|
-
let
|
|
8678
|
+
let ref28;
|
|
8665
8679
|
if (i === 1) {
|
|
8666
|
-
|
|
8680
|
+
ref28 = ancestor === parent.children[i];
|
|
8667
8681
|
} else if (i === 2) {
|
|
8668
|
-
|
|
8682
|
+
ref28 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
8669
8683
|
} else {
|
|
8670
|
-
|
|
8684
|
+
ref28 = void 0;
|
|
8671
8685
|
}
|
|
8672
8686
|
;
|
|
8673
|
-
outer =
|
|
8687
|
+
outer = ref28;
|
|
8674
8688
|
break;
|
|
8675
8689
|
}
|
|
8676
8690
|
case "AssignmentExpression":
|
|
@@ -8685,9 +8699,12 @@ function processPlaceholders(statements) {
|
|
|
8685
8699
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
8686
8700
|
}
|
|
8687
8701
|
replaceNode(ancestor, fnExp, parent);
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8702
|
+
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) {
|
|
8703
|
+
parent.parent.body = fnExp;
|
|
8704
|
+
}
|
|
8705
|
+
let ref29;
|
|
8706
|
+
if (ref29 = getTrimmingSpace(body)) {
|
|
8707
|
+
const ws = ref29;
|
|
8691
8708
|
inplaceInsertTrimmingSpace(body, "");
|
|
8692
8709
|
inplacePrepend(ws, fnExp);
|
|
8693
8710
|
}
|
|
@@ -8731,8 +8748,8 @@ function reorderBindingRestProperty(props) {
|
|
|
8731
8748
|
}
|
|
8732
8749
|
];
|
|
8733
8750
|
}
|
|
8734
|
-
let
|
|
8735
|
-
if (Array.isArray(rest.delim) && (
|
|
8751
|
+
let ref30;
|
|
8752
|
+
if (Array.isArray(rest.delim) && (ref30 = rest.delim)[ref30.length - 1]?.token === ",") {
|
|
8736
8753
|
rest.delim = rest.delim.slice(0, -1);
|
|
8737
8754
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
8738
8755
|
}
|
|
@@ -10920,24 +10937,27 @@ var PipelineHeadItem$$ = [PipelineHeadItem$0, PipelineHeadItem$1];
|
|
|
10920
10937
|
function PipelineHeadItem(ctx, state2) {
|
|
10921
10938
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineHeadItem", PipelineHeadItem$$);
|
|
10922
10939
|
}
|
|
10923
|
-
var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp,
|
|
10940
|
+
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
10941
|
return value[0];
|
|
10925
10942
|
});
|
|
10926
|
-
var PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
10943
|
+
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) {
|
|
10944
|
+
return { $loc, token: $1, type: "Yield" };
|
|
10945
|
+
});
|
|
10946
|
+
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
10947
|
return {
|
|
10928
10948
|
type: "Identifier",
|
|
10929
10949
|
children: [$1]
|
|
10930
10950
|
};
|
|
10931
10951
|
});
|
|
10932
|
-
var PipelineTailItem$
|
|
10952
|
+
var PipelineTailItem$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix, (0, import_lib2.$Q)(TypePostfix)), function($skip, $loc, $0, $1, $2) {
|
|
10933
10953
|
return makeAmpersandFunction({
|
|
10934
10954
|
body: [" ", $1, ...$2]
|
|
10935
10955
|
});
|
|
10936
10956
|
});
|
|
10937
|
-
var PipelineTailItem$
|
|
10957
|
+
var PipelineTailItem$4 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
|
|
10938
10958
|
return value[0];
|
|
10939
10959
|
});
|
|
10940
|
-
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3];
|
|
10960
|
+
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3, PipelineTailItem$4];
|
|
10941
10961
|
function PipelineTailItem(ctx, state2) {
|
|
10942
10962
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineTailItem", PipelineTailItem$$);
|
|
10943
10963
|
}
|
|
@@ -12688,13 +12708,17 @@ var FunctionExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionSign
|
|
|
12688
12708
|
block
|
|
12689
12709
|
};
|
|
12690
12710
|
});
|
|
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) {
|
|
12711
|
+
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
12712
|
var open = $2;
|
|
12693
|
-
var
|
|
12694
|
-
var
|
|
12713
|
+
var ws1 = $3;
|
|
12714
|
+
var op = $4;
|
|
12715
|
+
var ws2 = $5;
|
|
12716
|
+
var close = $6;
|
|
12695
12717
|
if (op.special && op.call && !op.negated) return op.call;
|
|
12718
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12719
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12696
12720
|
const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
|
|
12697
|
-
[
|
|
12721
|
+
[ws1, op, ws2, refB]
|
|
12698
12722
|
// BinaryOpRHS
|
|
12699
12723
|
]]);
|
|
12700
12724
|
const parameterList = [[refA, ","], refB];
|
|
@@ -12726,6 +12750,8 @@ var FunctionExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, N
|
|
|
12726
12750
|
var op = $4;
|
|
12727
12751
|
var ws2 = $5;
|
|
12728
12752
|
var close = $6;
|
|
12753
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12754
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12729
12755
|
const refB = makeRef("b");
|
|
12730
12756
|
const fn = makeAmpersandFunction({
|
|
12731
12757
|
ref: refB,
|
|
@@ -12792,6 +12818,8 @@ var FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, _
|
|
|
12792
12818
|
var ws2 = $6;
|
|
12793
12819
|
var rhs = $7;
|
|
12794
12820
|
var close = $8;
|
|
12821
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12822
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12795
12823
|
const refA = makeRef("a");
|
|
12796
12824
|
const fn = makeAmpersandFunction({
|
|
12797
12825
|
ref: refA,
|
|
@@ -12816,10 +12844,9 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12816
12844
|
var w = $3;
|
|
12817
12845
|
var decl = $4;
|
|
12818
12846
|
decl.names.forEach((name) => state.operators.set(name, behavior));
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
};
|
|
12847
|
+
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
12848
|
+
decl = prepend(trimFirstSpace(w), decl);
|
|
12849
|
+
return decl;
|
|
12823
12850
|
});
|
|
12824
12851
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
12825
12852
|
var signature = $1;
|
|
@@ -12840,11 +12867,16 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
12840
12867
|
var id = $3;
|
|
12841
12868
|
var behavior = $4;
|
|
12842
12869
|
var ids = $5;
|
|
12870
|
+
const children = [];
|
|
12843
12871
|
state.operators.set(id.name, behavior);
|
|
12844
|
-
|
|
12872
|
+
if (behavior?.error) children.push(behavior.error);
|
|
12873
|
+
ids.forEach(([, , id2, behavior2]) => {
|
|
12874
|
+
state.operators.set(id2.name, behavior2);
|
|
12875
|
+
if (behavior2?.error) children.push(behavior2.error);
|
|
12876
|
+
});
|
|
12845
12877
|
return {
|
|
12846
12878
|
id,
|
|
12847
|
-
children
|
|
12879
|
+
children
|
|
12848
12880
|
};
|
|
12849
12881
|
});
|
|
12850
12882
|
var OperatorDeclaration$$ = [OperatorDeclaration$0, OperatorDeclaration$1, OperatorDeclaration$2];
|
|
@@ -12882,7 +12914,7 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12882
12914
|
generator: !!generator.length
|
|
12883
12915
|
},
|
|
12884
12916
|
block: null,
|
|
12885
|
-
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
12917
|
+
children: [async, func, generator, w1, id, behavior?.error, w2, parameters, returnType],
|
|
12886
12918
|
behavior
|
|
12887
12919
|
};
|
|
12888
12920
|
});
|
|
@@ -12902,16 +12934,29 @@ function OperatorBehavior(ctx, state2) {
|
|
|
12902
12934
|
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
12935
|
var mod = $2;
|
|
12904
12936
|
var op = $5;
|
|
12905
|
-
let prec
|
|
12937
|
+
let prec, error;
|
|
12938
|
+
if (op.type === "Identifier") {
|
|
12939
|
+
if (state.operators.has(op.name)) {
|
|
12940
|
+
prec = state.operators.get(op.name).prec;
|
|
12941
|
+
} else {
|
|
12942
|
+
prec = precedenceCustomDefault;
|
|
12943
|
+
error = {
|
|
12944
|
+
type: "Error",
|
|
12945
|
+
message: `Precedence refers to unknown operator ${op.name}`
|
|
12946
|
+
};
|
|
12947
|
+
}
|
|
12948
|
+
} else {
|
|
12949
|
+
prec = getPrecedence(op[1]);
|
|
12950
|
+
}
|
|
12906
12951
|
switch (mod) {
|
|
12907
12952
|
case "tighter":
|
|
12908
|
-
prec +=
|
|
12953
|
+
prec += precedenceStep;
|
|
12909
12954
|
break;
|
|
12910
12955
|
case "looser":
|
|
12911
|
-
prec -=
|
|
12956
|
+
prec -= precedenceStep;
|
|
12912
12957
|
break;
|
|
12913
12958
|
}
|
|
12914
|
-
return { prec };
|
|
12959
|
+
return { prec, error };
|
|
12915
12960
|
});
|
|
12916
12961
|
function OperatorPrecedence(ctx, state2) {
|
|
12917
12962
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorPrecedence", OperatorPrecedence$0);
|
|
@@ -14749,6 +14794,7 @@ var BinaryOpSymbol$13 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L23, 'Bin
|
|
|
14749
14794
|
return {
|
|
14750
14795
|
$loc,
|
|
14751
14796
|
token: "instanceof",
|
|
14797
|
+
spaced: true,
|
|
14752
14798
|
relational: true,
|
|
14753
14799
|
special: true
|
|
14754
14800
|
};
|
|
@@ -14757,6 +14803,7 @@ var BinaryOpSymbol$14 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L84, 'Bin
|
|
|
14757
14803
|
return {
|
|
14758
14804
|
$loc,
|
|
14759
14805
|
token: "instanceof",
|
|
14806
|
+
spaced: true,
|
|
14760
14807
|
relational: true,
|
|
14761
14808
|
special: true,
|
|
14762
14809
|
negated: true
|
|
@@ -14832,6 +14879,7 @@ var BinaryOpSymbol$40 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
14832
14879
|
return {
|
|
14833
14880
|
$loc,
|
|
14834
14881
|
token: $1,
|
|
14882
|
+
spaced: true,
|
|
14835
14883
|
relational: true,
|
|
14836
14884
|
special: true
|
|
14837
14885
|
// for typeof shorthand
|
|
@@ -14934,6 +14982,7 @@ var CoffeeOfOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __,
|
|
|
14934
14982
|
return {
|
|
14935
14983
|
$loc,
|
|
14936
14984
|
token: "in",
|
|
14985
|
+
spaced: true,
|
|
14937
14986
|
special: true,
|
|
14938
14987
|
negated: true
|
|
14939
14988
|
};
|
|
@@ -14955,6 +15004,7 @@ var NotOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
|
|
|
14955
15004
|
return {
|
|
14956
15005
|
$loc,
|
|
14957
15006
|
token: "instanceof",
|
|
15007
|
+
spaced: true,
|
|
14958
15008
|
relational: true,
|
|
14959
15009
|
special: true,
|
|
14960
15010
|
negated: true
|
|
@@ -14964,6 +15014,7 @@ var NotOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(In), function($skip, $loc
|
|
|
14964
15014
|
return {
|
|
14965
15015
|
$loc,
|
|
14966
15016
|
token: "in",
|
|
15017
|
+
spaced: true,
|
|
14967
15018
|
special: true,
|
|
14968
15019
|
negated: true
|
|
14969
15020
|
};
|
|
@@ -16565,12 +16616,15 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16565
16616
|
var imports = $5;
|
|
16566
16617
|
var ws2 = $6;
|
|
16567
16618
|
var from = $7;
|
|
16619
|
+
const errors = [];
|
|
16620
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16568
16621
|
imports.specifiers.forEach((spec) => {
|
|
16569
16622
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16623
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16570
16624
|
});
|
|
16571
16625
|
return {
|
|
16572
16626
|
type: "ImportDeclaration",
|
|
16573
|
-
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
16627
|
+
children: [i, ...errors, trimFirstSpace(ws1), imports, ws2, from],
|
|
16574
16628
|
// omit $2 = Operator and $3 = OperatorBehavior
|
|
16575
16629
|
imports,
|
|
16576
16630
|
from
|
|
@@ -16613,12 +16667,15 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(ImpliedFromCl
|
|
|
16613
16667
|
var behavior = $6;
|
|
16614
16668
|
var ows = $7;
|
|
16615
16669
|
var imports = $8;
|
|
16670
|
+
const errors = [];
|
|
16671
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16616
16672
|
imports.specifiers.forEach((spec) => {
|
|
16617
16673
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16674
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16618
16675
|
});
|
|
16619
16676
|
return {
|
|
16620
16677
|
type: "ImportDeclaration",
|
|
16621
|
-
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
16678
|
+
children: [i, iws, ...errors, trimFirstSpace(ows), imports, fws, from],
|
|
16622
16679
|
// omit Operator and OperatorBehavior
|
|
16623
16680
|
imports,
|
|
16624
16681
|
from
|
|
@@ -16800,7 +16857,7 @@ var OperatorImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Mod
|
|
|
16800
16857
|
return {
|
|
16801
16858
|
binding,
|
|
16802
16859
|
behavior,
|
|
16803
|
-
children: [$1, $2, $4, $5, $6, $7]
|
|
16860
|
+
children: [$1, $2, $3?.error, $4, $5, $6, $7]
|
|
16804
16861
|
};
|
|
16805
16862
|
});
|
|
16806
16863
|
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 +16866,7 @@ var OperatorImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Imp
|
|
|
16809
16866
|
return {
|
|
16810
16867
|
binding,
|
|
16811
16868
|
behavior,
|
|
16812
|
-
children: [$1, $2, $4]
|
|
16869
|
+
children: [$1, $2, $3?.error, $4]
|
|
16813
16870
|
};
|
|
16814
16871
|
});
|
|
16815
16872
|
var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecifier$1];
|
|
@@ -17932,7 +17989,7 @@ function Import(ctx, state2) {
|
|
|
17932
17989
|
return (0, import_lib2.$EVENT)(ctx, state2, "Import", Import$0);
|
|
17933
17990
|
}
|
|
17934
17991
|
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 };
|
|
17992
|
+
return { $loc, token: $1, spaced: true };
|
|
17936
17993
|
});
|
|
17937
17994
|
function In(ctx, state2) {
|
|
17938
17995
|
return (0, import_lib2.$EVENT)(ctx, state2, "In", In$0);
|