@danielx/civet 0.6.58 → 0.6.59
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/dist/browser.js +69 -41
- package/dist/main.js +69 -41
- package/dist/main.mjs +69 -41
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -1595,7 +1595,9 @@ ${input.slice(result.pos)}
|
|
|
1595
1595
|
}
|
|
1596
1596
|
return;
|
|
1597
1597
|
case "WhenClause":
|
|
1598
|
-
|
|
1598
|
+
if (node.break) {
|
|
1599
|
+
node.children.splice(node.children.indexOf(node.break), 1);
|
|
1600
|
+
}
|
|
1599
1601
|
if (node.block.expressions.length) {
|
|
1600
1602
|
insertReturn(node.block);
|
|
1601
1603
|
} else {
|
|
@@ -1725,6 +1727,14 @@ ${input.slice(result.pos)}
|
|
|
1725
1727
|
return node.every(isWhitespaceOrEmpty);
|
|
1726
1728
|
return;
|
|
1727
1729
|
}
|
|
1730
|
+
function isExit(node) {
|
|
1731
|
+
return [
|
|
1732
|
+
"ReturnStatement",
|
|
1733
|
+
"ThrowStatement",
|
|
1734
|
+
"BreakStatement",
|
|
1735
|
+
"ContinueStatement"
|
|
1736
|
+
].includes(node?.type);
|
|
1737
|
+
}
|
|
1728
1738
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
1729
1739
|
return gatherRecursive(node, predicate, isFunction);
|
|
1730
1740
|
}
|
|
@@ -2415,9 +2425,7 @@ ${input.slice(result.pos)}
|
|
|
2415
2425
|
case "IterationStatement": {
|
|
2416
2426
|
const { children, block } = s;
|
|
2417
2427
|
const newBlock = blockWithPrefix(condition.expression.blockPrefix, block);
|
|
2418
|
-
s.children = children.map(
|
|
2419
|
-
return c.type === "BlockStatement" ? newBlock : c;
|
|
2420
|
-
});
|
|
2428
|
+
s.children = children.map((c) => c?.type === "BlockStatement" ? newBlock : c);
|
|
2421
2429
|
updateParentPointers(newBlock, s);
|
|
2422
2430
|
break;
|
|
2423
2431
|
}
|
|
@@ -2965,6 +2973,15 @@ ${input.slice(result.pos)}
|
|
|
2965
2973
|
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
|
|
2966
2974
|
const { caseBlock } = s;
|
|
2967
2975
|
const { clauses } = caseBlock;
|
|
2976
|
+
for (const c of clauses) {
|
|
2977
|
+
if (c.type === "WhenClause" && c.break) {
|
|
2978
|
+
const last = c.block?.expressions?.at(-1)?.[1];
|
|
2979
|
+
if (isExit(last)) {
|
|
2980
|
+
c.children.splice(c.children.indexOf(c.break), 1);
|
|
2981
|
+
c.break = void 0;
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2968
2985
|
let errors = false;
|
|
2969
2986
|
let isPattern = false;
|
|
2970
2987
|
if (clauses.some((c) => c.type === "PatternClause")) {
|
|
@@ -3593,20 +3610,29 @@ ${input.slice(result.pos)}
|
|
|
3593
3610
|
};
|
|
3594
3611
|
}
|
|
3595
3612
|
function replaceNodes(root, predicate, replacer) {
|
|
3596
|
-
if (root
|
|
3613
|
+
if (!(root != null)) {
|
|
3597
3614
|
return root;
|
|
3615
|
+
}
|
|
3598
3616
|
const array = Array.isArray(root) ? root : root.children;
|
|
3599
|
-
if (!array)
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3617
|
+
if (!array) {
|
|
3618
|
+
if (predicate(root)) {
|
|
3619
|
+
return replacer(root, root);
|
|
3620
|
+
} else {
|
|
3621
|
+
return root;
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
for (let i4 = 0, len4 = array.length; i4 < len4; i4++) {
|
|
3625
|
+
const i = i4;
|
|
3626
|
+
const node = array[i4];
|
|
3627
|
+
if (!(node != null)) {
|
|
3603
3628
|
return;
|
|
3629
|
+
}
|
|
3604
3630
|
if (predicate(node)) {
|
|
3605
|
-
|
|
3631
|
+
array[i] = replacer(node, root);
|
|
3606
3632
|
} else {
|
|
3607
|
-
|
|
3633
|
+
replaceNodes(node, predicate, replacer);
|
|
3608
3634
|
}
|
|
3609
|
-
}
|
|
3635
|
+
}
|
|
3610
3636
|
return root;
|
|
3611
3637
|
}
|
|
3612
3638
|
function skipIfOnlyWS(target) {
|
|
@@ -6015,33 +6041,8 @@ ${input.slice(result.pos)}
|
|
|
6015
6041
|
expression
|
|
6016
6042
|
};
|
|
6017
6043
|
});
|
|
6018
|
-
var MemberBracketContent$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
6019
|
-
var dot = $1;
|
|
6020
|
-
var literal = $2;
|
|
6021
|
-
if (Array.isArray(dot))
|
|
6022
|
-
dot = dot[0];
|
|
6023
|
-
return {
|
|
6024
|
-
type: "Index",
|
|
6025
|
-
children: [
|
|
6026
|
-
{ token: "[", $loc: dot.$loc },
|
|
6027
|
-
literal,
|
|
6028
|
-
"]"
|
|
6029
|
-
]
|
|
6030
|
-
};
|
|
6031
|
-
});
|
|
6032
|
-
var MemberBracketContent$2 = $TS($S(Dot, $EXPECT($L19, 'MemberBracketContent "-"'), IntegerLiteral), function($skip, $loc, $0, $1, $2, $3) {
|
|
6033
|
-
var dot = $1;
|
|
6034
|
-
var neg = $2;
|
|
6035
|
-
var num = $3;
|
|
6036
|
-
return [
|
|
6037
|
-
{ type: "PropertyAccess", children: [dot, "at"] },
|
|
6038
|
-
// not including `name` so that `{x.-1}` doesn't use it
|
|
6039
|
-
{ type: "Call", children: ["(", neg, num, ")"] }
|
|
6040
|
-
];
|
|
6041
|
-
});
|
|
6042
|
-
var MemberBracketContent$$ = [MemberBracketContent$0, MemberBracketContent$1, MemberBracketContent$2];
|
|
6043
6044
|
function MemberBracketContent(ctx, state) {
|
|
6044
|
-
return $
|
|
6045
|
+
return $EVENT(ctx, state, "MemberBracketContent", MemberBracketContent$0);
|
|
6045
6046
|
}
|
|
6046
6047
|
var SliceParameters$0 = $TS($S(ExtendedExpression, __, $C(DotDotDot, DotDot), $E(ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6047
6048
|
var start = $1;
|
|
@@ -6121,7 +6122,34 @@ ${input.slice(result.pos)}
|
|
|
6121
6122
|
function PropertyAccessModifier(ctx, state) {
|
|
6122
6123
|
return $EVENT_C(ctx, state, "PropertyAccessModifier", PropertyAccessModifier$$);
|
|
6123
6124
|
}
|
|
6124
|
-
var PropertyAccess$0 = $TS($S(AccessStart, $
|
|
6125
|
+
var PropertyAccess$0 = $TS($S(AccessStart, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
6126
|
+
var dot = $1;
|
|
6127
|
+
var literal = $2;
|
|
6128
|
+
dot = replaceNodes(
|
|
6129
|
+
deepCopy(dot),
|
|
6130
|
+
(node) => node.token === ".",
|
|
6131
|
+
(node) => ({ token: "[", $loc: node.$loc })
|
|
6132
|
+
);
|
|
6133
|
+
return {
|
|
6134
|
+
type: "Index",
|
|
6135
|
+
children: [
|
|
6136
|
+
dot,
|
|
6137
|
+
literal,
|
|
6138
|
+
"]"
|
|
6139
|
+
]
|
|
6140
|
+
};
|
|
6141
|
+
});
|
|
6142
|
+
var PropertyAccess$1 = $TS($S(AccessStart, $EXPECT($L19, 'PropertyAccess "-"'), IntegerLiteral), function($skip, $loc, $0, $1, $2, $3) {
|
|
6143
|
+
var dot = $1;
|
|
6144
|
+
var neg = $2;
|
|
6145
|
+
var num = $3;
|
|
6146
|
+
return [
|
|
6147
|
+
{ type: "PropertyAccess", children: [dot, "at"] },
|
|
6148
|
+
// not including `name` so that `{x.-1}` doesn't use it
|
|
6149
|
+
{ type: "Call", children: ["(", neg, num, ")"] }
|
|
6150
|
+
];
|
|
6151
|
+
});
|
|
6152
|
+
var PropertyAccess$2 = $TS($S(AccessStart, $Q(InlineComment), $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6125
6153
|
var access = $1;
|
|
6126
6154
|
var comments = $2;
|
|
6127
6155
|
var id = $3;
|
|
@@ -6132,7 +6160,7 @@ ${input.slice(result.pos)}
|
|
|
6132
6160
|
children
|
|
6133
6161
|
};
|
|
6134
6162
|
});
|
|
6135
|
-
var PropertyAccess$
|
|
6163
|
+
var PropertyAccess$3 = $TS($S(CoffeePrototypeEnabled, DoubleColon, $E(IdentifierName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6136
6164
|
var p = $2;
|
|
6137
6165
|
var id = $3;
|
|
6138
6166
|
if (id) {
|
|
@@ -6149,7 +6177,7 @@ ${input.slice(result.pos)}
|
|
|
6149
6177
|
};
|
|
6150
6178
|
}
|
|
6151
6179
|
});
|
|
6152
|
-
var PropertyAccess$$ = [PropertyAccess$0, PropertyAccess$1];
|
|
6180
|
+
var PropertyAccess$$ = [PropertyAccess$0, PropertyAccess$1, PropertyAccess$2, PropertyAccess$3];
|
|
6153
6181
|
function PropertyAccess(ctx, state) {
|
|
6154
6182
|
return $EVENT_C(ctx, state, "PropertyAccess", PropertyAccess$$);
|
|
6155
6183
|
}
|
package/dist/main.js
CHANGED
|
@@ -1587,7 +1587,9 @@ var require_lib = __commonJS({
|
|
|
1587
1587
|
}
|
|
1588
1588
|
return;
|
|
1589
1589
|
case "WhenClause":
|
|
1590
|
-
|
|
1590
|
+
if (node.break) {
|
|
1591
|
+
node.children.splice(node.children.indexOf(node.break), 1);
|
|
1592
|
+
}
|
|
1591
1593
|
if (node.block.expressions.length) {
|
|
1592
1594
|
insertReturn(node.block);
|
|
1593
1595
|
} else {
|
|
@@ -1717,6 +1719,14 @@ var require_lib = __commonJS({
|
|
|
1717
1719
|
return node.every(isWhitespaceOrEmpty);
|
|
1718
1720
|
return;
|
|
1719
1721
|
}
|
|
1722
|
+
function isExit(node) {
|
|
1723
|
+
return [
|
|
1724
|
+
"ReturnStatement",
|
|
1725
|
+
"ThrowStatement",
|
|
1726
|
+
"BreakStatement",
|
|
1727
|
+
"ContinueStatement"
|
|
1728
|
+
].includes(node?.type);
|
|
1729
|
+
}
|
|
1720
1730
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
1721
1731
|
return gatherRecursive(node, predicate, isFunction);
|
|
1722
1732
|
}
|
|
@@ -2407,9 +2417,7 @@ var require_lib = __commonJS({
|
|
|
2407
2417
|
case "IterationStatement": {
|
|
2408
2418
|
const { children, block } = s;
|
|
2409
2419
|
const newBlock = blockWithPrefix(condition.expression.blockPrefix, block);
|
|
2410
|
-
s.children = children.map(
|
|
2411
|
-
return c.type === "BlockStatement" ? newBlock : c;
|
|
2412
|
-
});
|
|
2420
|
+
s.children = children.map((c) => c?.type === "BlockStatement" ? newBlock : c);
|
|
2413
2421
|
updateParentPointers(newBlock, s);
|
|
2414
2422
|
break;
|
|
2415
2423
|
}
|
|
@@ -2957,6 +2965,15 @@ var require_lib = __commonJS({
|
|
|
2957
2965
|
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
|
|
2958
2966
|
const { caseBlock } = s;
|
|
2959
2967
|
const { clauses } = caseBlock;
|
|
2968
|
+
for (const c of clauses) {
|
|
2969
|
+
if (c.type === "WhenClause" && c.break) {
|
|
2970
|
+
const last = c.block?.expressions?.at(-1)?.[1];
|
|
2971
|
+
if (isExit(last)) {
|
|
2972
|
+
c.children.splice(c.children.indexOf(c.break), 1);
|
|
2973
|
+
c.break = void 0;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2960
2977
|
let errors = false;
|
|
2961
2978
|
let isPattern = false;
|
|
2962
2979
|
if (clauses.some((c) => c.type === "PatternClause")) {
|
|
@@ -3585,20 +3602,29 @@ var require_lib = __commonJS({
|
|
|
3585
3602
|
};
|
|
3586
3603
|
}
|
|
3587
3604
|
function replaceNodes(root, predicate, replacer) {
|
|
3588
|
-
if (root
|
|
3605
|
+
if (!(root != null)) {
|
|
3589
3606
|
return root;
|
|
3607
|
+
}
|
|
3590
3608
|
const array = Array.isArray(root) ? root : root.children;
|
|
3591
|
-
if (!array)
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3609
|
+
if (!array) {
|
|
3610
|
+
if (predicate(root)) {
|
|
3611
|
+
return replacer(root, root);
|
|
3612
|
+
} else {
|
|
3613
|
+
return root;
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
for (let i4 = 0, len4 = array.length; i4 < len4; i4++) {
|
|
3617
|
+
const i = i4;
|
|
3618
|
+
const node = array[i4];
|
|
3619
|
+
if (!(node != null)) {
|
|
3595
3620
|
return;
|
|
3621
|
+
}
|
|
3596
3622
|
if (predicate(node)) {
|
|
3597
|
-
|
|
3623
|
+
array[i] = replacer(node, root);
|
|
3598
3624
|
} else {
|
|
3599
|
-
|
|
3625
|
+
replaceNodes(node, predicate, replacer);
|
|
3600
3626
|
}
|
|
3601
|
-
}
|
|
3627
|
+
}
|
|
3602
3628
|
return root;
|
|
3603
3629
|
}
|
|
3604
3630
|
function skipIfOnlyWS(target) {
|
|
@@ -6007,33 +6033,8 @@ var require_parser = __commonJS({
|
|
|
6007
6033
|
expression
|
|
6008
6034
|
};
|
|
6009
6035
|
});
|
|
6010
|
-
var MemberBracketContent$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
6011
|
-
var dot = $1;
|
|
6012
|
-
var literal = $2;
|
|
6013
|
-
if (Array.isArray(dot))
|
|
6014
|
-
dot = dot[0];
|
|
6015
|
-
return {
|
|
6016
|
-
type: "Index",
|
|
6017
|
-
children: [
|
|
6018
|
-
{ token: "[", $loc: dot.$loc },
|
|
6019
|
-
literal,
|
|
6020
|
-
"]"
|
|
6021
|
-
]
|
|
6022
|
-
};
|
|
6023
|
-
});
|
|
6024
|
-
var MemberBracketContent$2 = $TS($S(Dot, $EXPECT($L19, 'MemberBracketContent "-"'), IntegerLiteral), function($skip, $loc, $0, $1, $2, $3) {
|
|
6025
|
-
var dot = $1;
|
|
6026
|
-
var neg = $2;
|
|
6027
|
-
var num = $3;
|
|
6028
|
-
return [
|
|
6029
|
-
{ type: "PropertyAccess", children: [dot, "at"] },
|
|
6030
|
-
// not including `name` so that `{x.-1}` doesn't use it
|
|
6031
|
-
{ type: "Call", children: ["(", neg, num, ")"] }
|
|
6032
|
-
];
|
|
6033
|
-
});
|
|
6034
|
-
var MemberBracketContent$$ = [MemberBracketContent$0, MemberBracketContent$1, MemberBracketContent$2];
|
|
6035
6036
|
function MemberBracketContent(ctx, state) {
|
|
6036
|
-
return $
|
|
6037
|
+
return $EVENT(ctx, state, "MemberBracketContent", MemberBracketContent$0);
|
|
6037
6038
|
}
|
|
6038
6039
|
var SliceParameters$0 = $TS($S(ExtendedExpression, __, $C(DotDotDot, DotDot), $E(ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6039
6040
|
var start = $1;
|
|
@@ -6113,7 +6114,34 @@ var require_parser = __commonJS({
|
|
|
6113
6114
|
function PropertyAccessModifier(ctx, state) {
|
|
6114
6115
|
return $EVENT_C(ctx, state, "PropertyAccessModifier", PropertyAccessModifier$$);
|
|
6115
6116
|
}
|
|
6116
|
-
var PropertyAccess$0 = $TS($S(AccessStart, $
|
|
6117
|
+
var PropertyAccess$0 = $TS($S(AccessStart, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
6118
|
+
var dot = $1;
|
|
6119
|
+
var literal = $2;
|
|
6120
|
+
dot = replaceNodes(
|
|
6121
|
+
deepCopy(dot),
|
|
6122
|
+
(node) => node.token === ".",
|
|
6123
|
+
(node) => ({ token: "[", $loc: node.$loc })
|
|
6124
|
+
);
|
|
6125
|
+
return {
|
|
6126
|
+
type: "Index",
|
|
6127
|
+
children: [
|
|
6128
|
+
dot,
|
|
6129
|
+
literal,
|
|
6130
|
+
"]"
|
|
6131
|
+
]
|
|
6132
|
+
};
|
|
6133
|
+
});
|
|
6134
|
+
var PropertyAccess$1 = $TS($S(AccessStart, $EXPECT($L19, 'PropertyAccess "-"'), IntegerLiteral), function($skip, $loc, $0, $1, $2, $3) {
|
|
6135
|
+
var dot = $1;
|
|
6136
|
+
var neg = $2;
|
|
6137
|
+
var num = $3;
|
|
6138
|
+
return [
|
|
6139
|
+
{ type: "PropertyAccess", children: [dot, "at"] },
|
|
6140
|
+
// not including `name` so that `{x.-1}` doesn't use it
|
|
6141
|
+
{ type: "Call", children: ["(", neg, num, ")"] }
|
|
6142
|
+
];
|
|
6143
|
+
});
|
|
6144
|
+
var PropertyAccess$2 = $TS($S(AccessStart, $Q(InlineComment), $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6117
6145
|
var access = $1;
|
|
6118
6146
|
var comments = $2;
|
|
6119
6147
|
var id = $3;
|
|
@@ -6124,7 +6152,7 @@ var require_parser = __commonJS({
|
|
|
6124
6152
|
children
|
|
6125
6153
|
};
|
|
6126
6154
|
});
|
|
6127
|
-
var PropertyAccess$
|
|
6155
|
+
var PropertyAccess$3 = $TS($S(CoffeePrototypeEnabled, DoubleColon, $E(IdentifierName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6128
6156
|
var p = $2;
|
|
6129
6157
|
var id = $3;
|
|
6130
6158
|
if (id) {
|
|
@@ -6141,7 +6169,7 @@ var require_parser = __commonJS({
|
|
|
6141
6169
|
};
|
|
6142
6170
|
}
|
|
6143
6171
|
});
|
|
6144
|
-
var PropertyAccess$$ = [PropertyAccess$0, PropertyAccess$1];
|
|
6172
|
+
var PropertyAccess$$ = [PropertyAccess$0, PropertyAccess$1, PropertyAccess$2, PropertyAccess$3];
|
|
6145
6173
|
function PropertyAccess(ctx, state) {
|
|
6146
6174
|
return $EVENT_C(ctx, state, "PropertyAccess", PropertyAccess$$);
|
|
6147
6175
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1585,7 +1585,9 @@ var require_lib = __commonJS({
|
|
|
1585
1585
|
}
|
|
1586
1586
|
return;
|
|
1587
1587
|
case "WhenClause":
|
|
1588
|
-
|
|
1588
|
+
if (node.break) {
|
|
1589
|
+
node.children.splice(node.children.indexOf(node.break), 1);
|
|
1590
|
+
}
|
|
1589
1591
|
if (node.block.expressions.length) {
|
|
1590
1592
|
insertReturn(node.block);
|
|
1591
1593
|
} else {
|
|
@@ -1715,6 +1717,14 @@ var require_lib = __commonJS({
|
|
|
1715
1717
|
return node.every(isWhitespaceOrEmpty);
|
|
1716
1718
|
return;
|
|
1717
1719
|
}
|
|
1720
|
+
function isExit(node) {
|
|
1721
|
+
return [
|
|
1722
|
+
"ReturnStatement",
|
|
1723
|
+
"ThrowStatement",
|
|
1724
|
+
"BreakStatement",
|
|
1725
|
+
"ContinueStatement"
|
|
1726
|
+
].includes(node?.type);
|
|
1727
|
+
}
|
|
1718
1728
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
1719
1729
|
return gatherRecursive(node, predicate, isFunction);
|
|
1720
1730
|
}
|
|
@@ -2405,9 +2415,7 @@ var require_lib = __commonJS({
|
|
|
2405
2415
|
case "IterationStatement": {
|
|
2406
2416
|
const { children, block } = s;
|
|
2407
2417
|
const newBlock = blockWithPrefix(condition.expression.blockPrefix, block);
|
|
2408
|
-
s.children = children.map(
|
|
2409
|
-
return c.type === "BlockStatement" ? newBlock : c;
|
|
2410
|
-
});
|
|
2418
|
+
s.children = children.map((c) => c?.type === "BlockStatement" ? newBlock : c);
|
|
2411
2419
|
updateParentPointers(newBlock, s);
|
|
2412
2420
|
break;
|
|
2413
2421
|
}
|
|
@@ -2955,6 +2963,15 @@ var require_lib = __commonJS({
|
|
|
2955
2963
|
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
|
|
2956
2964
|
const { caseBlock } = s;
|
|
2957
2965
|
const { clauses } = caseBlock;
|
|
2966
|
+
for (const c of clauses) {
|
|
2967
|
+
if (c.type === "WhenClause" && c.break) {
|
|
2968
|
+
const last = c.block?.expressions?.at(-1)?.[1];
|
|
2969
|
+
if (isExit(last)) {
|
|
2970
|
+
c.children.splice(c.children.indexOf(c.break), 1);
|
|
2971
|
+
c.break = void 0;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2958
2975
|
let errors = false;
|
|
2959
2976
|
let isPattern = false;
|
|
2960
2977
|
if (clauses.some((c) => c.type === "PatternClause")) {
|
|
@@ -3583,20 +3600,29 @@ var require_lib = __commonJS({
|
|
|
3583
3600
|
};
|
|
3584
3601
|
}
|
|
3585
3602
|
function replaceNodes(root, predicate, replacer) {
|
|
3586
|
-
if (root
|
|
3603
|
+
if (!(root != null)) {
|
|
3587
3604
|
return root;
|
|
3605
|
+
}
|
|
3588
3606
|
const array = Array.isArray(root) ? root : root.children;
|
|
3589
|
-
if (!array)
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3607
|
+
if (!array) {
|
|
3608
|
+
if (predicate(root)) {
|
|
3609
|
+
return replacer(root, root);
|
|
3610
|
+
} else {
|
|
3611
|
+
return root;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
for (let i4 = 0, len4 = array.length; i4 < len4; i4++) {
|
|
3615
|
+
const i = i4;
|
|
3616
|
+
const node = array[i4];
|
|
3617
|
+
if (!(node != null)) {
|
|
3593
3618
|
return;
|
|
3619
|
+
}
|
|
3594
3620
|
if (predicate(node)) {
|
|
3595
|
-
|
|
3621
|
+
array[i] = replacer(node, root);
|
|
3596
3622
|
} else {
|
|
3597
|
-
|
|
3623
|
+
replaceNodes(node, predicate, replacer);
|
|
3598
3624
|
}
|
|
3599
|
-
}
|
|
3625
|
+
}
|
|
3600
3626
|
return root;
|
|
3601
3627
|
}
|
|
3602
3628
|
function skipIfOnlyWS(target) {
|
|
@@ -6005,33 +6031,8 @@ var require_parser = __commonJS({
|
|
|
6005
6031
|
expression
|
|
6006
6032
|
};
|
|
6007
6033
|
});
|
|
6008
|
-
var MemberBracketContent$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
6009
|
-
var dot = $1;
|
|
6010
|
-
var literal = $2;
|
|
6011
|
-
if (Array.isArray(dot))
|
|
6012
|
-
dot = dot[0];
|
|
6013
|
-
return {
|
|
6014
|
-
type: "Index",
|
|
6015
|
-
children: [
|
|
6016
|
-
{ token: "[", $loc: dot.$loc },
|
|
6017
|
-
literal,
|
|
6018
|
-
"]"
|
|
6019
|
-
]
|
|
6020
|
-
};
|
|
6021
|
-
});
|
|
6022
|
-
var MemberBracketContent$2 = $TS($S(Dot, $EXPECT($L19, 'MemberBracketContent "-"'), IntegerLiteral), function($skip, $loc, $0, $1, $2, $3) {
|
|
6023
|
-
var dot = $1;
|
|
6024
|
-
var neg = $2;
|
|
6025
|
-
var num = $3;
|
|
6026
|
-
return [
|
|
6027
|
-
{ type: "PropertyAccess", children: [dot, "at"] },
|
|
6028
|
-
// not including `name` so that `{x.-1}` doesn't use it
|
|
6029
|
-
{ type: "Call", children: ["(", neg, num, ")"] }
|
|
6030
|
-
];
|
|
6031
|
-
});
|
|
6032
|
-
var MemberBracketContent$$ = [MemberBracketContent$0, MemberBracketContent$1, MemberBracketContent$2];
|
|
6033
6034
|
function MemberBracketContent(ctx, state) {
|
|
6034
|
-
return $
|
|
6035
|
+
return $EVENT(ctx, state, "MemberBracketContent", MemberBracketContent$0);
|
|
6035
6036
|
}
|
|
6036
6037
|
var SliceParameters$0 = $TS($S(ExtendedExpression, __, $C(DotDotDot, DotDot), $E(ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6037
6038
|
var start = $1;
|
|
@@ -6111,7 +6112,34 @@ var require_parser = __commonJS({
|
|
|
6111
6112
|
function PropertyAccessModifier(ctx, state) {
|
|
6112
6113
|
return $EVENT_C(ctx, state, "PropertyAccessModifier", PropertyAccessModifier$$);
|
|
6113
6114
|
}
|
|
6114
|
-
var PropertyAccess$0 = $TS($S(AccessStart, $
|
|
6115
|
+
var PropertyAccess$0 = $TS($S(AccessStart, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
6116
|
+
var dot = $1;
|
|
6117
|
+
var literal = $2;
|
|
6118
|
+
dot = replaceNodes(
|
|
6119
|
+
deepCopy(dot),
|
|
6120
|
+
(node) => node.token === ".",
|
|
6121
|
+
(node) => ({ token: "[", $loc: node.$loc })
|
|
6122
|
+
);
|
|
6123
|
+
return {
|
|
6124
|
+
type: "Index",
|
|
6125
|
+
children: [
|
|
6126
|
+
dot,
|
|
6127
|
+
literal,
|
|
6128
|
+
"]"
|
|
6129
|
+
]
|
|
6130
|
+
};
|
|
6131
|
+
});
|
|
6132
|
+
var PropertyAccess$1 = $TS($S(AccessStart, $EXPECT($L19, 'PropertyAccess "-"'), IntegerLiteral), function($skip, $loc, $0, $1, $2, $3) {
|
|
6133
|
+
var dot = $1;
|
|
6134
|
+
var neg = $2;
|
|
6135
|
+
var num = $3;
|
|
6136
|
+
return [
|
|
6137
|
+
{ type: "PropertyAccess", children: [dot, "at"] },
|
|
6138
|
+
// not including `name` so that `{x.-1}` doesn't use it
|
|
6139
|
+
{ type: "Call", children: ["(", neg, num, ")"] }
|
|
6140
|
+
];
|
|
6141
|
+
});
|
|
6142
|
+
var PropertyAccess$2 = $TS($S(AccessStart, $Q(InlineComment), $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6115
6143
|
var access = $1;
|
|
6116
6144
|
var comments = $2;
|
|
6117
6145
|
var id = $3;
|
|
@@ -6122,7 +6150,7 @@ var require_parser = __commonJS({
|
|
|
6122
6150
|
children
|
|
6123
6151
|
};
|
|
6124
6152
|
});
|
|
6125
|
-
var PropertyAccess$
|
|
6153
|
+
var PropertyAccess$3 = $TS($S(CoffeePrototypeEnabled, DoubleColon, $E(IdentifierName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6126
6154
|
var p = $2;
|
|
6127
6155
|
var id = $3;
|
|
6128
6156
|
if (id) {
|
|
@@ -6139,7 +6167,7 @@ var require_parser = __commonJS({
|
|
|
6139
6167
|
};
|
|
6140
6168
|
}
|
|
6141
6169
|
});
|
|
6142
|
-
var PropertyAccess$$ = [PropertyAccess$0, PropertyAccess$1];
|
|
6170
|
+
var PropertyAccess$$ = [PropertyAccess$0, PropertyAccess$1, PropertyAccess$2, PropertyAccess$3];
|
|
6143
6171
|
function PropertyAccess(ctx, state) {
|
|
6144
6172
|
return $EVENT_C(ctx, state, "PropertyAccess", PropertyAccess$$);
|
|
6145
6173
|
}
|