@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.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,
|
|
@@ -3100,6 +3101,7 @@ function assignResults(node, collect) {
|
|
|
3100
3101
|
exp = exp.statement;
|
|
3101
3102
|
}
|
|
3102
3103
|
let ref6;
|
|
3104
|
+
let m1;
|
|
3103
3105
|
switch (exp.type) {
|
|
3104
3106
|
case "BreakStatement":
|
|
3105
3107
|
case "ContinueStatement":
|
|
@@ -3179,6 +3181,9 @@ function assignResults(node, collect) {
|
|
|
3179
3181
|
return;
|
|
3180
3182
|
}
|
|
3181
3183
|
case "PipelineExpression": {
|
|
3184
|
+
if (m1 = exp.children[1]?.type, m1 === "ReturnStatement" || m1 === "ThrowStatement") {
|
|
3185
|
+
return;
|
|
3186
|
+
}
|
|
3182
3187
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3183
3188
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3184
3189
|
exp.children.splice(semi2 + 1, 1 / 0, ...[collect(exp.children.slice(semi2 + 1))]);
|
|
@@ -3204,8 +3209,8 @@ function insertReturn(node) {
|
|
|
3204
3209
|
const last = node.expressions[node.expressions.length - 1];
|
|
3205
3210
|
insertReturn(last);
|
|
3206
3211
|
} else {
|
|
3207
|
-
let
|
|
3208
|
-
if (
|
|
3212
|
+
let m2;
|
|
3213
|
+
if (m2 = node.parent?.type, m2 === "CatchClause" || m2 === "WhenClause") {
|
|
3209
3214
|
node.expressions.push(["", wrapWithReturn(void 0, node)]);
|
|
3210
3215
|
}
|
|
3211
3216
|
}
|
|
@@ -3251,6 +3256,7 @@ function insertReturn(node) {
|
|
|
3251
3256
|
exp = exp.statement;
|
|
3252
3257
|
}
|
|
3253
3258
|
let ref11;
|
|
3259
|
+
let m3;
|
|
3254
3260
|
switch (exp.type) {
|
|
3255
3261
|
case "BreakStatement":
|
|
3256
3262
|
case "ContinueStatement":
|
|
@@ -3342,6 +3348,9 @@ function insertReturn(node) {
|
|
|
3342
3348
|
return;
|
|
3343
3349
|
}
|
|
3344
3350
|
case "PipelineExpression": {
|
|
3351
|
+
if (m3 = exp.children[1]?.type, m3 === "ReturnStatement" || m3 === "ThrowStatement") {
|
|
3352
|
+
return;
|
|
3353
|
+
}
|
|
3345
3354
|
const semi2 = exp.children.lastIndexOf(";");
|
|
3346
3355
|
if (0 <= semi2 && semi2 < exp.children.length - 1) {
|
|
3347
3356
|
exp.children.splice(semi2 + 1, 1 / 0, ...[wrapWithReturn(exp.children.slice(semi2 + 1))]);
|
|
@@ -3364,8 +3373,8 @@ function processBreakContinueWith(statement) {
|
|
|
3364
3373
|
)) {
|
|
3365
3374
|
if (control.with) {
|
|
3366
3375
|
if (control.label) {
|
|
3367
|
-
let
|
|
3368
|
-
if (!(
|
|
3376
|
+
let m4;
|
|
3377
|
+
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
3378
|
continue;
|
|
3370
3379
|
}
|
|
3371
3380
|
} else {
|
|
@@ -3586,8 +3595,8 @@ function iterationDefaultBody(statement) {
|
|
|
3586
3595
|
const reduction = statement.type === "ForStatement" && statement.reduction;
|
|
3587
3596
|
function fillBlock(expression) {
|
|
3588
3597
|
let ref15;
|
|
3589
|
-
let
|
|
3590
|
-
if (
|
|
3598
|
+
let m5;
|
|
3599
|
+
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
3600
|
block.expressions.pop();
|
|
3592
3601
|
}
|
|
3593
3602
|
block.expressions.push(expression);
|
|
@@ -3715,8 +3724,8 @@ function processParams(f) {
|
|
|
3715
3724
|
parameters.names.push(...rest.names || []);
|
|
3716
3725
|
rest.children.pop();
|
|
3717
3726
|
if (after.length) {
|
|
3718
|
-
let
|
|
3719
|
-
if (
|
|
3727
|
+
let m6;
|
|
3728
|
+
if (m6 = rest.binding.type, m6 === "ArrayBindingPattern" || m6 === "ObjectBindingPattern" || m6 === "NamedBindingPattern") {
|
|
3720
3729
|
parameters.parameters.push({
|
|
3721
3730
|
type: "Error",
|
|
3722
3731
|
message: "Non-end rest parameter cannot be binding pattern"
|
|
@@ -3858,8 +3867,8 @@ function processParams(f) {
|
|
|
3858
3867
|
const classExpressions = ancestor.body.expressions;
|
|
3859
3868
|
let index2 = findChildIndex(classExpressions, f);
|
|
3860
3869
|
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3861
|
-
let
|
|
3862
|
-
while (
|
|
3870
|
+
let m7;
|
|
3871
|
+
while (m7 = classExpressions[index2 - 1]?.[1], typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor") {
|
|
3863
3872
|
index2--;
|
|
3864
3873
|
}
|
|
3865
3874
|
const fStatement = classExpressions[index2];
|
|
@@ -6016,9 +6025,8 @@ function constructInvocation(fn, arg) {
|
|
|
6016
6025
|
if (lhs.type === "NewExpression") {
|
|
6017
6026
|
let { expression } = lhs;
|
|
6018
6027
|
expression = {
|
|
6019
|
-
...expression,
|
|
6020
6028
|
type: "CallExpression",
|
|
6021
|
-
children: [
|
|
6029
|
+
children: [expression, call]
|
|
6022
6030
|
};
|
|
6023
6031
|
return {
|
|
6024
6032
|
...lhs,
|
|
@@ -6071,23 +6079,22 @@ function constructPipeStep(fn, arg, returning) {
|
|
|
6071
6079
|
];
|
|
6072
6080
|
}
|
|
6073
6081
|
function processPipelineExpressions(statements) {
|
|
6074
|
-
gatherRecursiveAll(statements, (
|
|
6082
|
+
for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "PipelineExpression"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
|
|
6083
|
+
const s = ref1[i1];
|
|
6075
6084
|
const [ws, , body] = s.children;
|
|
6076
6085
|
let [, arg] = s.children;
|
|
6077
|
-
let i = 0;
|
|
6078
|
-
const l = body.length;
|
|
6079
6086
|
const children = [ws];
|
|
6080
6087
|
const comma = blockContainingStatement(s) ? ";" : ",";
|
|
6081
6088
|
let usingRef = null;
|
|
6082
|
-
for (let
|
|
6083
|
-
const
|
|
6084
|
-
const step = body[
|
|
6089
|
+
for (let i2 = 0, len1 = body.length; i2 < len1; i2++) {
|
|
6090
|
+
const i = i2;
|
|
6091
|
+
const step = body[i2];
|
|
6085
6092
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
6086
6093
|
const returns = pipe.token === "||>";
|
|
6087
6094
|
let ref, result, returning = returns ? arg : null;
|
|
6088
6095
|
if (pipe.token === "|>=") {
|
|
6089
6096
|
let initRef;
|
|
6090
|
-
if (
|
|
6097
|
+
if (i === 0) {
|
|
6091
6098
|
checkValidLHS(arg);
|
|
6092
6099
|
outer: switch (arg.type) {
|
|
6093
6100
|
case "MemberExpression": {
|
|
@@ -6136,7 +6143,7 @@ function processPipelineExpressions(statements) {
|
|
|
6136
6143
|
});
|
|
6137
6144
|
}
|
|
6138
6145
|
} else {
|
|
6139
|
-
if (
|
|
6146
|
+
if (i === 0) s.children = children;
|
|
6140
6147
|
}
|
|
6141
6148
|
if (returns && (ref = needsRef(arg))) {
|
|
6142
6149
|
usingRef = usingRef || ref;
|
|
@@ -6160,7 +6167,7 @@ function processPipelineExpressions(statements) {
|
|
|
6160
6167
|
returning
|
|
6161
6168
|
);
|
|
6162
6169
|
if (result.type === "ReturnStatement") {
|
|
6163
|
-
if (
|
|
6170
|
+
if (i < body.length - 1) {
|
|
6164
6171
|
result.children.push({
|
|
6165
6172
|
type: "Error",
|
|
6166
6173
|
message: "Can't continue a pipeline after returning"
|
|
@@ -6188,7 +6195,7 @@ function processPipelineExpressions(statements) {
|
|
|
6188
6195
|
};
|
|
6189
6196
|
}
|
|
6190
6197
|
children.push(arg);
|
|
6191
|
-
if (!children.some(($
|
|
6198
|
+
if (!children.some(($2) => $2?.type === "ReturnStatement") && children.some(($3) => $3 === ",")) {
|
|
6192
6199
|
const { parent } = s;
|
|
6193
6200
|
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
6194
6201
|
Object.assign(s, parenthesizedExpression, {
|
|
@@ -6196,8 +6203,8 @@ function processPipelineExpressions(statements) {
|
|
|
6196
6203
|
hoistDec: void 0
|
|
6197
6204
|
});
|
|
6198
6205
|
}
|
|
6199
|
-
|
|
6200
|
-
}
|
|
6206
|
+
addParentPointers(s, s.parent);
|
|
6207
|
+
}
|
|
6201
6208
|
}
|
|
6202
6209
|
|
|
6203
6210
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
|
|
@@ -7348,14 +7355,21 @@ function processCallMemberExpression(node) {
|
|
|
7348
7355
|
}
|
|
7349
7356
|
}
|
|
7350
7357
|
if (args.length) {
|
|
7351
|
-
|
|
7352
|
-
0,
|
|
7353
|
-
2,
|
|
7354
|
-
commaCount ? {
|
|
7358
|
+
if (commaCount) {
|
|
7359
|
+
children.splice(0, 2, {
|
|
7355
7360
|
type: "ParenthesizedExpression",
|
|
7356
|
-
children: ["(",
|
|
7357
|
-
|
|
7358
|
-
|
|
7361
|
+
children: ["(", call.children, ")"],
|
|
7362
|
+
expression: call.children
|
|
7363
|
+
});
|
|
7364
|
+
} else {
|
|
7365
|
+
const middle = call.children.slice(0 + 1, -1);
|
|
7366
|
+
let ref2;
|
|
7367
|
+
children.splice(0, 2, {
|
|
7368
|
+
type: "ParenthesizedExpression",
|
|
7369
|
+
expression: middle,
|
|
7370
|
+
children: [call.children[0], middle, (ref2 = call.children)[ref2.length - 1]]
|
|
7371
|
+
});
|
|
7372
|
+
}
|
|
7359
7373
|
if (children.length === 1) {
|
|
7360
7374
|
return children[0];
|
|
7361
7375
|
}
|
|
@@ -7438,14 +7452,14 @@ function processCallMemberExpression(node) {
|
|
|
7438
7452
|
});
|
|
7439
7453
|
}
|
|
7440
7454
|
}
|
|
7441
|
-
let
|
|
7455
|
+
let ref3;
|
|
7442
7456
|
const object = {
|
|
7443
7457
|
type: "ObjectExpression",
|
|
7444
7458
|
children: [
|
|
7445
7459
|
glob.object.children[0],
|
|
7446
7460
|
// {
|
|
7447
7461
|
...parts,
|
|
7448
|
-
(
|
|
7462
|
+
(ref3 = glob.object.children)[ref3.length - 1]
|
|
7449
7463
|
// whitespace and }
|
|
7450
7464
|
],
|
|
7451
7465
|
properties: parts
|
|
@@ -7506,7 +7520,7 @@ function processCallMemberExpression(node) {
|
|
|
7506
7520
|
})
|
|
7507
7521
|
]
|
|
7508
7522
|
});
|
|
7509
|
-
let
|
|
7523
|
+
let ref4;
|
|
7510
7524
|
return processCallMemberExpression({
|
|
7511
7525
|
// in case there are more
|
|
7512
7526
|
...node,
|
|
@@ -7520,7 +7534,7 @@ function processCallMemberExpression(node) {
|
|
|
7520
7534
|
glob.children[0],
|
|
7521
7535
|
// "[" token
|
|
7522
7536
|
call,
|
|
7523
|
-
(
|
|
7537
|
+
(ref4 = glob.children)[ref4.length - 1]
|
|
7524
7538
|
// "]" token
|
|
7525
7539
|
]
|
|
7526
7540
|
}),
|
|
@@ -7533,7 +7547,7 @@ function processCallMemberExpression(node) {
|
|
|
7533
7547
|
{ ...glob.children[0], token: ", " },
|
|
7534
7548
|
...glob.children.slice(1, -1)
|
|
7535
7549
|
];
|
|
7536
|
-
let
|
|
7550
|
+
let ref5;
|
|
7537
7551
|
const rsliceCall = makeNode({
|
|
7538
7552
|
type: "CallExpression",
|
|
7539
7553
|
implicit: true,
|
|
@@ -7545,7 +7559,7 @@ function processCallMemberExpression(node) {
|
|
|
7545
7559
|
children: [
|
|
7546
7560
|
"(",
|
|
7547
7561
|
args,
|
|
7548
|
-
(
|
|
7562
|
+
(ref5 = glob.children)[ref5.length - 1]
|
|
7549
7563
|
]
|
|
7550
7564
|
})
|
|
7551
7565
|
]
|
|
@@ -7630,8 +7644,8 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7630
7644
|
return { type: "Error", message: "cannot use `type` in dynamic import" };
|
|
7631
7645
|
} else {
|
|
7632
7646
|
const { source, binding } = specifier;
|
|
7633
|
-
let
|
|
7634
|
-
const delim = (
|
|
7647
|
+
let ref6;
|
|
7648
|
+
const delim = (ref6 = specifier.children)[ref6.length - 1];
|
|
7635
7649
|
return {
|
|
7636
7650
|
type: pattern ? "BindingProperty" : "Property",
|
|
7637
7651
|
name: source,
|
|
@@ -7641,7 +7655,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7641
7655
|
};
|
|
7642
7656
|
}
|
|
7643
7657
|
});
|
|
7644
|
-
let
|
|
7658
|
+
let ref7;
|
|
7645
7659
|
return {
|
|
7646
7660
|
type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
|
|
7647
7661
|
names: node.names,
|
|
@@ -7650,7 +7664,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
7650
7664
|
node.children[0],
|
|
7651
7665
|
// {
|
|
7652
7666
|
properties,
|
|
7653
|
-
(
|
|
7667
|
+
(ref7 = node.children)[ref7.length - 1]
|
|
7654
7668
|
// }
|
|
7655
7669
|
]
|
|
7656
7670
|
};
|
|
@@ -7771,7 +7785,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7771
7785
|
);
|
|
7772
7786
|
}
|
|
7773
7787
|
function processAssignments(statements) {
|
|
7774
|
-
for (let
|
|
7788
|
+
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref8.length; i5 < len3; i5++) {
|
|
7775
7789
|
let extractAssignment = function(lhs) {
|
|
7776
7790
|
let expr = lhs;
|
|
7777
7791
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -7791,20 +7805,20 @@ function processAssignments(statements) {
|
|
|
7791
7805
|
;
|
|
7792
7806
|
return;
|
|
7793
7807
|
};
|
|
7794
|
-
const exp =
|
|
7808
|
+
const exp = ref8[i5];
|
|
7795
7809
|
checkValidLHS(exp.assigned);
|
|
7796
7810
|
const pre = [], post = [];
|
|
7797
|
-
let
|
|
7811
|
+
let ref9;
|
|
7798
7812
|
switch (exp.type) {
|
|
7799
7813
|
case "AssignmentExpression": {
|
|
7800
7814
|
if (!exp.lhs) {
|
|
7801
7815
|
continue;
|
|
7802
7816
|
}
|
|
7803
|
-
for (let
|
|
7804
|
-
const lhsPart =
|
|
7805
|
-
let
|
|
7806
|
-
if (
|
|
7807
|
-
const newLhs =
|
|
7817
|
+
for (let ref10 = exp.lhs, i6 = 0, len4 = ref10.length; i6 < len4; i6++) {
|
|
7818
|
+
const lhsPart = ref10[i6];
|
|
7819
|
+
let ref11;
|
|
7820
|
+
if (ref11 = extractAssignment(lhsPart[1])) {
|
|
7821
|
+
const newLhs = ref11;
|
|
7808
7822
|
lhsPart[1] = newLhs;
|
|
7809
7823
|
}
|
|
7810
7824
|
}
|
|
@@ -7812,8 +7826,8 @@ function processAssignments(statements) {
|
|
|
7812
7826
|
break;
|
|
7813
7827
|
}
|
|
7814
7828
|
case "UpdateExpression": {
|
|
7815
|
-
if (
|
|
7816
|
-
const newLhs =
|
|
7829
|
+
if (ref9 = extractAssignment(exp.assigned)) {
|
|
7830
|
+
const newLhs = ref9;
|
|
7817
7831
|
const i = exp.children.indexOf(exp.assigned);
|
|
7818
7832
|
exp.assigned = exp.children[i] = newLhs;
|
|
7819
7833
|
}
|
|
@@ -7845,22 +7859,22 @@ function processAssignments(statements) {
|
|
|
7845
7859
|
}
|
|
7846
7860
|
}
|
|
7847
7861
|
}
|
|
7848
|
-
for (let
|
|
7849
|
-
const exp =
|
|
7862
|
+
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref12.length; i7 < len5; i7++) {
|
|
7863
|
+
const exp = ref12[i7];
|
|
7850
7864
|
if (!(exp.names === null)) {
|
|
7851
7865
|
continue;
|
|
7852
7866
|
}
|
|
7853
7867
|
let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
|
|
7854
7868
|
let block;
|
|
7855
|
-
let
|
|
7856
|
-
if (blockContainingStatement(exp) && !(
|
|
7869
|
+
let ref13;
|
|
7870
|
+
if (blockContainingStatement(exp) && !(ref13 = $1[$1.length - 1])?.[ref13.length - 1]?.special) {
|
|
7857
7871
|
block = makeBlockFragment();
|
|
7858
|
-
let
|
|
7859
|
-
if (
|
|
7872
|
+
let ref14;
|
|
7873
|
+
if (ref14 = prependStatementExpressionBlock(
|
|
7860
7874
|
{ type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
|
|
7861
7875
|
block
|
|
7862
7876
|
)) {
|
|
7863
|
-
const ref =
|
|
7877
|
+
const ref = ref14;
|
|
7864
7878
|
exp.children = exp.children.map(($7) => $7 === $2 ? ref : $7);
|
|
7865
7879
|
$2 = ref;
|
|
7866
7880
|
} else {
|
|
@@ -8041,9 +8055,9 @@ function unchainOptionalMemberExpression(exp, ref, innerExp) {
|
|
|
8041
8055
|
}
|
|
8042
8056
|
j++;
|
|
8043
8057
|
}
|
|
8044
|
-
let
|
|
8045
|
-
if (
|
|
8046
|
-
const l =
|
|
8058
|
+
let ref15;
|
|
8059
|
+
if (ref15 = conditions.length) {
|
|
8060
|
+
const l = ref15;
|
|
8047
8061
|
const cs = flatJoin(conditions, " && ");
|
|
8048
8062
|
return {
|
|
8049
8063
|
...exp,
|
|
@@ -8079,8 +8093,8 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
8079
8093
|
}
|
|
8080
8094
|
function processTypes(node) {
|
|
8081
8095
|
const results1 = [];
|
|
8082
|
-
for (let
|
|
8083
|
-
const unary =
|
|
8096
|
+
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref16.length; i8 < len6; i8++) {
|
|
8097
|
+
const unary = ref16[i8];
|
|
8084
8098
|
let suffixIndex = unary.suffix.length - 1;
|
|
8085
8099
|
const results2 = [];
|
|
8086
8100
|
while (suffixIndex >= 0) {
|
|
@@ -8159,10 +8173,10 @@ function processTypes(node) {
|
|
|
8159
8173
|
const outer = unary.suffix.splice(suffixIndex + 1, Infinity);
|
|
8160
8174
|
const space = getTrimmingSpace(unary);
|
|
8161
8175
|
inplaceInsertTrimmingSpace(unary, "");
|
|
8162
|
-
let
|
|
8163
|
-
if (unary.suffix.length)
|
|
8164
|
-
else
|
|
8165
|
-
const t =
|
|
8176
|
+
let ref17;
|
|
8177
|
+
if (unary.suffix.length) ref17 = unary;
|
|
8178
|
+
else ref17 = unary.t;
|
|
8179
|
+
const t = ref17;
|
|
8166
8180
|
const arg = makeNode({
|
|
8167
8181
|
type: "TypeArgument",
|
|
8168
8182
|
ts: true,
|
|
@@ -8207,18 +8221,18 @@ function processTypes(node) {
|
|
|
8207
8221
|
return results1;
|
|
8208
8222
|
}
|
|
8209
8223
|
function processStatementExpressions(statements) {
|
|
8210
|
-
for (let
|
|
8211
|
-
const exp =
|
|
8224
|
+
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref18.length; i9 < len7; i9++) {
|
|
8225
|
+
const exp = ref18[i9];
|
|
8212
8226
|
const { maybe, statement } = exp;
|
|
8213
8227
|
if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
|
|
8214
8228
|
replaceNode(exp, statement);
|
|
8215
8229
|
continue;
|
|
8216
8230
|
}
|
|
8217
|
-
let
|
|
8231
|
+
let ref19;
|
|
8218
8232
|
switch (statement.type) {
|
|
8219
8233
|
case "IfStatement": {
|
|
8220
|
-
if (
|
|
8221
|
-
const expression =
|
|
8234
|
+
if (ref19 = expressionizeIfStatement(statement)) {
|
|
8235
|
+
const expression = ref19;
|
|
8222
8236
|
replaceNode(statement, expression, exp);
|
|
8223
8237
|
} else {
|
|
8224
8238
|
replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -8277,13 +8291,13 @@ function processNegativeIndexAccess(statements) {
|
|
|
8277
8291
|
});
|
|
8278
8292
|
}
|
|
8279
8293
|
function processFinallyClauses(statements) {
|
|
8280
|
-
for (let
|
|
8281
|
-
let f =
|
|
8282
|
-
let
|
|
8283
|
-
if (!((
|
|
8294
|
+
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref20.length; i10 < len8; i10++) {
|
|
8295
|
+
let f = ref20[i10];
|
|
8296
|
+
let ref21;
|
|
8297
|
+
if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
|
|
8284
8298
|
throw new Error("finally clause must be inside try statement or block");
|
|
8285
8299
|
}
|
|
8286
|
-
const { block, index } =
|
|
8300
|
+
const { block, index } = ref21;
|
|
8287
8301
|
const indent = block.expressions[index][0];
|
|
8288
8302
|
const expressions = block.expressions.slice(index + 1);
|
|
8289
8303
|
const t = makeNode({
|
|
@@ -8355,8 +8369,8 @@ function processBreaksContinues(statements) {
|
|
|
8355
8369
|
}
|
|
8356
8370
|
}
|
|
8357
8371
|
function processCoffeeClasses(statements) {
|
|
8358
|
-
for (let
|
|
8359
|
-
const ce =
|
|
8372
|
+
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref22.length; i11 < len9; i11++) {
|
|
8373
|
+
const ce = ref22[i11];
|
|
8360
8374
|
const { expressions } = ce.body;
|
|
8361
8375
|
const indent = expressions[0]?.[0] ?? "\n";
|
|
8362
8376
|
const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
|
|
@@ -8506,8 +8520,8 @@ async function processProgramAsync(root) {
|
|
|
8506
8520
|
function processRepl(root, rootIIFE) {
|
|
8507
8521
|
const topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0];
|
|
8508
8522
|
let i = 0;
|
|
8509
|
-
for (let
|
|
8510
|
-
const decl =
|
|
8523
|
+
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref23.length; i14 < len11; i14++) {
|
|
8524
|
+
const decl = ref23[i14];
|
|
8511
8525
|
if (!decl.names?.length) {
|
|
8512
8526
|
continue;
|
|
8513
8527
|
}
|
|
@@ -8520,8 +8534,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8520
8534
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
8521
8535
|
}
|
|
8522
8536
|
}
|
|
8523
|
-
for (let
|
|
8524
|
-
const func =
|
|
8537
|
+
for (let ref24 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref24.length; i15 < len12; i15++) {
|
|
8538
|
+
const func = ref24[i15];
|
|
8525
8539
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
8526
8540
|
if (func.parent === topBlock) {
|
|
8527
8541
|
replaceNode(func, void 0);
|
|
@@ -8533,8 +8547,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8533
8547
|
}
|
|
8534
8548
|
}
|
|
8535
8549
|
}
|
|
8536
|
-
for (let
|
|
8537
|
-
const classExp =
|
|
8550
|
+
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref25.length; i16 < len13; i16++) {
|
|
8551
|
+
const classExp = ref25[i16];
|
|
8538
8552
|
let m8;
|
|
8539
8553
|
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
8554
|
classExp.children.unshift(classExp.name, "=");
|
|
@@ -8545,8 +8559,8 @@ function processRepl(root, rootIIFE) {
|
|
|
8545
8559
|
function processPlaceholders(statements) {
|
|
8546
8560
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
8547
8561
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
8548
|
-
for (let
|
|
8549
|
-
const exp =
|
|
8562
|
+
for (let ref26 = gatherRecursiveAll(statements, ($21) => $21.type === "Placeholder"), i17 = 0, len14 = ref26.length; i17 < len14; i17++) {
|
|
8563
|
+
const exp = ref26[i17];
|
|
8550
8564
|
let ancestor;
|
|
8551
8565
|
if (exp.subtype === ".") {
|
|
8552
8566
|
({ ancestor } = findAncestor(
|
|
@@ -8658,8 +8672,8 @@ function processPlaceholders(statements) {
|
|
|
8658
8672
|
for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
|
|
8659
8673
|
const placeholder = placeholders[i18];
|
|
8660
8674
|
typeSuffix ??= placeholder.typeSuffix;
|
|
8661
|
-
let
|
|
8662
|
-
(
|
|
8675
|
+
let ref27;
|
|
8676
|
+
(ref27 = placeholder.children)[ref27.length - 1] = ref;
|
|
8663
8677
|
}
|
|
8664
8678
|
const { parent } = ancestor;
|
|
8665
8679
|
const body = maybeUnwrap(ancestor);
|
|
@@ -8680,16 +8694,16 @@ function processPlaceholders(statements) {
|
|
|
8680
8694
|
}
|
|
8681
8695
|
case "PipelineExpression": {
|
|
8682
8696
|
const i = findChildIndex(parent, ancestor);
|
|
8683
|
-
let
|
|
8697
|
+
let ref28;
|
|
8684
8698
|
if (i === 1) {
|
|
8685
|
-
|
|
8699
|
+
ref28 = ancestor === parent.children[i];
|
|
8686
8700
|
} else if (i === 2) {
|
|
8687
|
-
|
|
8701
|
+
ref28 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
8688
8702
|
} else {
|
|
8689
|
-
|
|
8703
|
+
ref28 = void 0;
|
|
8690
8704
|
}
|
|
8691
8705
|
;
|
|
8692
|
-
outer =
|
|
8706
|
+
outer = ref28;
|
|
8693
8707
|
break;
|
|
8694
8708
|
}
|
|
8695
8709
|
case "AssignmentExpression":
|
|
@@ -8704,9 +8718,12 @@ function processPlaceholders(statements) {
|
|
|
8704
8718
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
8705
8719
|
}
|
|
8706
8720
|
replaceNode(ancestor, fnExp, parent);
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8721
|
+
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) {
|
|
8722
|
+
parent.parent.body = fnExp;
|
|
8723
|
+
}
|
|
8724
|
+
let ref29;
|
|
8725
|
+
if (ref29 = getTrimmingSpace(body)) {
|
|
8726
|
+
const ws = ref29;
|
|
8710
8727
|
inplaceInsertTrimmingSpace(body, "");
|
|
8711
8728
|
inplacePrepend(ws, fnExp);
|
|
8712
8729
|
}
|
|
@@ -8750,8 +8767,8 @@ function reorderBindingRestProperty(props) {
|
|
|
8750
8767
|
}
|
|
8751
8768
|
];
|
|
8752
8769
|
}
|
|
8753
|
-
let
|
|
8754
|
-
if (Array.isArray(rest.delim) && (
|
|
8770
|
+
let ref30;
|
|
8771
|
+
if (Array.isArray(rest.delim) && (ref30 = rest.delim)[ref30.length - 1]?.token === ",") {
|
|
8755
8772
|
rest.delim = rest.delim.slice(0, -1);
|
|
8756
8773
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
8757
8774
|
}
|
|
@@ -10939,24 +10956,27 @@ var PipelineHeadItem$$ = [PipelineHeadItem$0, PipelineHeadItem$1];
|
|
|
10939
10956
|
function PipelineHeadItem(ctx, state2) {
|
|
10940
10957
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineHeadItem", PipelineHeadItem$$);
|
|
10941
10958
|
}
|
|
10942
|
-
var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp,
|
|
10959
|
+
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
10960
|
return value[0];
|
|
10944
10961
|
});
|
|
10945
|
-
var PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
|
|
10962
|
+
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) {
|
|
10963
|
+
return { $loc, token: $1, type: "Yield" };
|
|
10964
|
+
});
|
|
10965
|
+
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
10966
|
return {
|
|
10947
10967
|
type: "Identifier",
|
|
10948
10968
|
children: [$1]
|
|
10949
10969
|
};
|
|
10950
10970
|
});
|
|
10951
|
-
var PipelineTailItem$
|
|
10971
|
+
var PipelineTailItem$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix, (0, import_lib2.$Q)(TypePostfix)), function($skip, $loc, $0, $1, $2) {
|
|
10952
10972
|
return makeAmpersandFunction({
|
|
10953
10973
|
body: [" ", $1, ...$2]
|
|
10954
10974
|
});
|
|
10955
10975
|
});
|
|
10956
|
-
var PipelineTailItem$
|
|
10976
|
+
var PipelineTailItem$4 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
|
|
10957
10977
|
return value[0];
|
|
10958
10978
|
});
|
|
10959
|
-
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3];
|
|
10979
|
+
var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3, PipelineTailItem$4];
|
|
10960
10980
|
function PipelineTailItem(ctx, state2) {
|
|
10961
10981
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineTailItem", PipelineTailItem$$);
|
|
10962
10982
|
}
|
|
@@ -12707,13 +12727,17 @@ var FunctionExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionSign
|
|
|
12707
12727
|
block
|
|
12708
12728
|
};
|
|
12709
12729
|
});
|
|
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) {
|
|
12730
|
+
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
12731
|
var open = $2;
|
|
12712
|
-
var
|
|
12713
|
-
var
|
|
12732
|
+
var ws1 = $3;
|
|
12733
|
+
var op = $4;
|
|
12734
|
+
var ws2 = $5;
|
|
12735
|
+
var close = $6;
|
|
12714
12736
|
if (op.special && op.call && !op.negated) return op.call;
|
|
12737
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12738
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12715
12739
|
const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
|
|
12716
|
-
[
|
|
12740
|
+
[ws1, op, ws2, refB]
|
|
12717
12741
|
// BinaryOpRHS
|
|
12718
12742
|
]]);
|
|
12719
12743
|
const parameterList = [[refA, ","], refB];
|
|
@@ -12745,6 +12769,8 @@ var FunctionExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, N
|
|
|
12745
12769
|
var op = $4;
|
|
12746
12770
|
var ws2 = $5;
|
|
12747
12771
|
var close = $6;
|
|
12772
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12773
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12748
12774
|
const refB = makeRef("b");
|
|
12749
12775
|
const fn = makeAmpersandFunction({
|
|
12750
12776
|
ref: refB,
|
|
@@ -12811,6 +12837,8 @@ var FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, _
|
|
|
12811
12837
|
var ws2 = $6;
|
|
12812
12838
|
var rhs = $7;
|
|
12813
12839
|
var close = $8;
|
|
12840
|
+
if (!ws1) ws1 = op.spaced ? [" "] : [];
|
|
12841
|
+
if (!ws2) ws2 = op.spaced ? [" "] : [];
|
|
12814
12842
|
const refA = makeRef("a");
|
|
12815
12843
|
const fn = makeAmpersandFunction({
|
|
12816
12844
|
ref: refA,
|
|
@@ -12835,10 +12863,9 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12835
12863
|
var w = $3;
|
|
12836
12864
|
var decl = $4;
|
|
12837
12865
|
decl.names.forEach((name) => state.operators.set(name, behavior));
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
};
|
|
12866
|
+
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
12867
|
+
decl = prepend(trimFirstSpace(w), decl);
|
|
12868
|
+
return decl;
|
|
12842
12869
|
});
|
|
12843
12870
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
12844
12871
|
var signature = $1;
|
|
@@ -12859,11 +12886,16 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
12859
12886
|
var id = $3;
|
|
12860
12887
|
var behavior = $4;
|
|
12861
12888
|
var ids = $5;
|
|
12889
|
+
const children = [];
|
|
12862
12890
|
state.operators.set(id.name, behavior);
|
|
12863
|
-
|
|
12891
|
+
if (behavior?.error) children.push(behavior.error);
|
|
12892
|
+
ids.forEach(([, , id2, behavior2]) => {
|
|
12893
|
+
state.operators.set(id2.name, behavior2);
|
|
12894
|
+
if (behavior2?.error) children.push(behavior2.error);
|
|
12895
|
+
});
|
|
12864
12896
|
return {
|
|
12865
12897
|
id,
|
|
12866
|
-
children
|
|
12898
|
+
children
|
|
12867
12899
|
};
|
|
12868
12900
|
});
|
|
12869
12901
|
var OperatorDeclaration$$ = [OperatorDeclaration$0, OperatorDeclaration$1, OperatorDeclaration$2];
|
|
@@ -12901,7 +12933,7 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
12901
12933
|
generator: !!generator.length
|
|
12902
12934
|
},
|
|
12903
12935
|
block: null,
|
|
12904
|
-
children: [async, func, generator, w1, id, w2, parameters, returnType],
|
|
12936
|
+
children: [async, func, generator, w1, id, behavior?.error, w2, parameters, returnType],
|
|
12905
12937
|
behavior
|
|
12906
12938
|
};
|
|
12907
12939
|
});
|
|
@@ -12921,16 +12953,29 @@ function OperatorBehavior(ctx, state2) {
|
|
|
12921
12953
|
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
12954
|
var mod = $2;
|
|
12923
12955
|
var op = $5;
|
|
12924
|
-
let prec
|
|
12956
|
+
let prec, error;
|
|
12957
|
+
if (op.type === "Identifier") {
|
|
12958
|
+
if (state.operators.has(op.name)) {
|
|
12959
|
+
prec = state.operators.get(op.name).prec;
|
|
12960
|
+
} else {
|
|
12961
|
+
prec = precedenceCustomDefault;
|
|
12962
|
+
error = {
|
|
12963
|
+
type: "Error",
|
|
12964
|
+
message: `Precedence refers to unknown operator ${op.name}`
|
|
12965
|
+
};
|
|
12966
|
+
}
|
|
12967
|
+
} else {
|
|
12968
|
+
prec = getPrecedence(op[1]);
|
|
12969
|
+
}
|
|
12925
12970
|
switch (mod) {
|
|
12926
12971
|
case "tighter":
|
|
12927
|
-
prec +=
|
|
12972
|
+
prec += precedenceStep;
|
|
12928
12973
|
break;
|
|
12929
12974
|
case "looser":
|
|
12930
|
-
prec -=
|
|
12975
|
+
prec -= precedenceStep;
|
|
12931
12976
|
break;
|
|
12932
12977
|
}
|
|
12933
|
-
return { prec };
|
|
12978
|
+
return { prec, error };
|
|
12934
12979
|
});
|
|
12935
12980
|
function OperatorPrecedence(ctx, state2) {
|
|
12936
12981
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorPrecedence", OperatorPrecedence$0);
|
|
@@ -14768,6 +14813,7 @@ var BinaryOpSymbol$13 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L23, 'Bin
|
|
|
14768
14813
|
return {
|
|
14769
14814
|
$loc,
|
|
14770
14815
|
token: "instanceof",
|
|
14816
|
+
spaced: true,
|
|
14771
14817
|
relational: true,
|
|
14772
14818
|
special: true
|
|
14773
14819
|
};
|
|
@@ -14776,6 +14822,7 @@ var BinaryOpSymbol$14 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L84, 'Bin
|
|
|
14776
14822
|
return {
|
|
14777
14823
|
$loc,
|
|
14778
14824
|
token: "instanceof",
|
|
14825
|
+
spaced: true,
|
|
14779
14826
|
relational: true,
|
|
14780
14827
|
special: true,
|
|
14781
14828
|
negated: true
|
|
@@ -14851,6 +14898,7 @@ var BinaryOpSymbol$40 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
14851
14898
|
return {
|
|
14852
14899
|
$loc,
|
|
14853
14900
|
token: $1,
|
|
14901
|
+
spaced: true,
|
|
14854
14902
|
relational: true,
|
|
14855
14903
|
special: true
|
|
14856
14904
|
// for typeof shorthand
|
|
@@ -14953,6 +15001,7 @@ var CoffeeOfOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __,
|
|
|
14953
15001
|
return {
|
|
14954
15002
|
$loc,
|
|
14955
15003
|
token: "in",
|
|
15004
|
+
spaced: true,
|
|
14956
15005
|
special: true,
|
|
14957
15006
|
negated: true
|
|
14958
15007
|
};
|
|
@@ -14974,6 +15023,7 @@ var NotOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
|
|
|
14974
15023
|
return {
|
|
14975
15024
|
$loc,
|
|
14976
15025
|
token: "instanceof",
|
|
15026
|
+
spaced: true,
|
|
14977
15027
|
relational: true,
|
|
14978
15028
|
special: true,
|
|
14979
15029
|
negated: true
|
|
@@ -14983,6 +15033,7 @@ var NotOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(In), function($skip, $loc
|
|
|
14983
15033
|
return {
|
|
14984
15034
|
$loc,
|
|
14985
15035
|
token: "in",
|
|
15036
|
+
spaced: true,
|
|
14986
15037
|
special: true,
|
|
14987
15038
|
negated: true
|
|
14988
15039
|
};
|
|
@@ -16584,12 +16635,15 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16584
16635
|
var imports = $5;
|
|
16585
16636
|
var ws2 = $6;
|
|
16586
16637
|
var from = $7;
|
|
16638
|
+
const errors = [];
|
|
16639
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16587
16640
|
imports.specifiers.forEach((spec) => {
|
|
16588
16641
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16642
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16589
16643
|
});
|
|
16590
16644
|
return {
|
|
16591
16645
|
type: "ImportDeclaration",
|
|
16592
|
-
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
16646
|
+
children: [i, ...errors, trimFirstSpace(ws1), imports, ws2, from],
|
|
16593
16647
|
// omit $2 = Operator and $3 = OperatorBehavior
|
|
16594
16648
|
imports,
|
|
16595
16649
|
from
|
|
@@ -16632,12 +16686,15 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(ImpliedFromCl
|
|
|
16632
16686
|
var behavior = $6;
|
|
16633
16687
|
var ows = $7;
|
|
16634
16688
|
var imports = $8;
|
|
16689
|
+
const errors = [];
|
|
16690
|
+
if (behavior?.error) errors.push(behavior.error);
|
|
16635
16691
|
imports.specifiers.forEach((spec) => {
|
|
16636
16692
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
16693
|
+
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16637
16694
|
});
|
|
16638
16695
|
return {
|
|
16639
16696
|
type: "ImportDeclaration",
|
|
16640
|
-
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
16697
|
+
children: [i, iws, ...errors, trimFirstSpace(ows), imports, fws, from],
|
|
16641
16698
|
// omit Operator and OperatorBehavior
|
|
16642
16699
|
imports,
|
|
16643
16700
|
from
|
|
@@ -16819,7 +16876,7 @@ var OperatorImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Mod
|
|
|
16819
16876
|
return {
|
|
16820
16877
|
binding,
|
|
16821
16878
|
behavior,
|
|
16822
|
-
children: [$1, $2, $4, $5, $6, $7]
|
|
16879
|
+
children: [$1, $2, $3?.error, $4, $5, $6, $7]
|
|
16823
16880
|
};
|
|
16824
16881
|
});
|
|
16825
16882
|
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 +16885,7 @@ var OperatorImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Imp
|
|
|
16828
16885
|
return {
|
|
16829
16886
|
binding,
|
|
16830
16887
|
behavior,
|
|
16831
|
-
children: [$1, $2, $4]
|
|
16888
|
+
children: [$1, $2, $3?.error, $4]
|
|
16832
16889
|
};
|
|
16833
16890
|
});
|
|
16834
16891
|
var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecifier$1];
|
|
@@ -17951,7 +18008,7 @@ function Import(ctx, state2) {
|
|
|
17951
18008
|
return (0, import_lib2.$EVENT)(ctx, state2, "Import", Import$0);
|
|
17952
18009
|
}
|
|
17953
18010
|
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 };
|
|
18011
|
+
return { $loc, token: $1, spaced: true };
|
|
17955
18012
|
});
|
|
17956
18013
|
function In(ctx, state2) {
|
|
17957
18014
|
return (0, import_lib2.$EVENT)(ctx, state2, "In", In$0);
|