@danielx/civet 0.8.4 → 0.8.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 +578 -274
- package/dist/civet +6 -15
- package/dist/main.js +578 -274
- package/dist/main.mjs +578 -274
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -1058,6 +1058,9 @@ function makeLeftHandSideExpression(expression) {
|
|
|
1058
1058
|
expression = item;
|
|
1059
1059
|
}
|
|
1060
1060
|
if (isASTNodeObject(expression)) {
|
|
1061
|
+
if (expression.token) {
|
|
1062
|
+
return expression;
|
|
1063
|
+
}
|
|
1061
1064
|
if (expression.parenthesized) {
|
|
1062
1065
|
return expression;
|
|
1063
1066
|
}
|
|
@@ -1580,86 +1583,90 @@ function gatherBindingPatternTypeSuffix(pattern) {
|
|
|
1580
1583
|
let count = 0;
|
|
1581
1584
|
switch (pattern.type) {
|
|
1582
1585
|
case "ArrayBindingPattern": {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1586
|
+
{
|
|
1587
|
+
const results = [];
|
|
1588
|
+
for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
|
|
1589
|
+
const elem = ref2[i2];
|
|
1590
|
+
let { typeSuffix } = elem;
|
|
1591
|
+
typeSuffix ??= elem.binding?.typeSuffix;
|
|
1592
|
+
if (typeSuffix) {
|
|
1593
|
+
count++;
|
|
1594
|
+
}
|
|
1595
|
+
let typeElement = [typeSuffix?.t, elem.delim];
|
|
1596
|
+
if (typeSuffix?.optional) {
|
|
1597
|
+
typeElement[0] = parenthesizeType(typeElement[0]);
|
|
1598
|
+
typeElement.unshift("undefined |");
|
|
1599
|
+
}
|
|
1600
|
+
if (elem.type === "BindingRestElement") {
|
|
1601
|
+
typeElement[0] ??= "unknown[]";
|
|
1602
|
+
typeElement.unshift(elem.dots);
|
|
1603
|
+
} else {
|
|
1604
|
+
typeElement[0] ??= "unknown";
|
|
1605
|
+
}
|
|
1606
|
+
results.push(typeElement);
|
|
1595
1607
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1608
|
+
;
|
|
1609
|
+
const types = results;
|
|
1610
|
+
if (count) {
|
|
1611
|
+
const t = [": [", types, "]"];
|
|
1612
|
+
pattern.typeSuffix = {
|
|
1613
|
+
type: "TypeSuffix",
|
|
1614
|
+
ts: true,
|
|
1615
|
+
t,
|
|
1616
|
+
children: [t]
|
|
1617
|
+
};
|
|
1601
1618
|
}
|
|
1602
|
-
results.push(typeElement);
|
|
1603
|
-
}
|
|
1604
|
-
;
|
|
1605
|
-
const types = results;
|
|
1606
|
-
if (count) {
|
|
1607
|
-
const t = [": [", types, "]"];
|
|
1608
|
-
pattern.typeSuffix = {
|
|
1609
|
-
type: "TypeSuffix",
|
|
1610
|
-
ts: true,
|
|
1611
|
-
t,
|
|
1612
|
-
children: [t]
|
|
1613
|
-
};
|
|
1614
1619
|
}
|
|
1615
1620
|
;
|
|
1616
1621
|
break;
|
|
1617
1622
|
}
|
|
1618
1623
|
case "ObjectBindingPattern": {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
typeSuffix ??= {
|
|
1629
|
-
type: "TypeSuffix",
|
|
1630
|
-
ts: true,
|
|
1631
|
-
children: [": unknown"]
|
|
1632
|
-
};
|
|
1633
|
-
switch (prop.type) {
|
|
1634
|
-
case "BindingProperty": {
|
|
1635
|
-
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
1636
|
-
results1.push([...ws, prop.name, typeSuffix, prop.delim]);
|
|
1637
|
-
break;
|
|
1638
|
-
}
|
|
1639
|
-
case "AtBindingProperty": {
|
|
1640
|
-
const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
|
|
1641
|
-
results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
|
|
1642
|
-
break;
|
|
1624
|
+
{
|
|
1625
|
+
let restType;
|
|
1626
|
+
const results1 = [];
|
|
1627
|
+
for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
|
|
1628
|
+
const prop = ref3[i3];
|
|
1629
|
+
let { typeSuffix } = prop;
|
|
1630
|
+
typeSuffix ??= prop.value?.typeSuffix;
|
|
1631
|
+
if (typeSuffix) {
|
|
1632
|
+
count++;
|
|
1643
1633
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1634
|
+
typeSuffix ??= {
|
|
1635
|
+
type: "TypeSuffix",
|
|
1636
|
+
ts: true,
|
|
1637
|
+
children: [": unknown"]
|
|
1638
|
+
};
|
|
1639
|
+
switch (prop.type) {
|
|
1640
|
+
case "BindingProperty": {
|
|
1641
|
+
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
1642
|
+
results1.push([...ws, prop.name, typeSuffix, prop.delim]);
|
|
1643
|
+
break;
|
|
1644
|
+
}
|
|
1645
|
+
case "AtBindingProperty": {
|
|
1646
|
+
const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
|
|
1647
|
+
results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
case "BindingRestProperty": {
|
|
1651
|
+
restType = prop.typeSuffix?.t;
|
|
1652
|
+
continue;
|
|
1653
|
+
}
|
|
1647
1654
|
}
|
|
1648
1655
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
+
;
|
|
1657
|
+
const types = results1;
|
|
1658
|
+
if (count) {
|
|
1659
|
+
const t = ["{", types, "}"];
|
|
1660
|
+
if (restType != null) {
|
|
1661
|
+
t.push(" & ", parenthesizeType(trimFirstSpace(restType)));
|
|
1662
|
+
}
|
|
1663
|
+
pattern.typeSuffix = {
|
|
1664
|
+
type: "TypeSuffix",
|
|
1665
|
+
ts: true,
|
|
1666
|
+
t,
|
|
1667
|
+
children: [": ", t]
|
|
1668
|
+
};
|
|
1656
1669
|
}
|
|
1657
|
-
pattern.typeSuffix = {
|
|
1658
|
-
type: "TypeSuffix",
|
|
1659
|
-
ts: true,
|
|
1660
|
-
t,
|
|
1661
|
-
children: [": ", t]
|
|
1662
|
-
};
|
|
1663
1670
|
}
|
|
1664
1671
|
;
|
|
1665
1672
|
break;
|
|
@@ -1729,6 +1736,34 @@ var declareHelper = {
|
|
|
1729
1736
|
"\n"
|
|
1730
1737
|
]]);
|
|
1731
1738
|
},
|
|
1739
|
+
rslice(rsliceRef) {
|
|
1740
|
+
const RSliceable = makeRef("RSliceable");
|
|
1741
|
+
state.prelude.push(["", [
|
|
1742
|
+
ts(["type ", RSliceable, "<R> = string | {length: number; slice(start: number, end: number): {reverse(): R}}\n"]),
|
|
1743
|
+
preludeVar,
|
|
1744
|
+
rsliceRef,
|
|
1745
|
+
ts([": <R, T extends string | ", RSliceable, "<R>>(a: T, start?: number, end?: number) => T extends string ? string : T extends ", RSliceable, "<infer R> ? R : never"]),
|
|
1746
|
+
" = ((a, start, end) => {\n",
|
|
1747
|
+
" const l = a.length\n",
|
|
1748
|
+
" start = ",
|
|
1749
|
+
getHelperRef("modulo"),
|
|
1750
|
+
"(start ?? -1, l)\n",
|
|
1751
|
+
" end = ",
|
|
1752
|
+
getHelperRef("modulo"),
|
|
1753
|
+
"((end ?? -1) + 1, l)\n",
|
|
1754
|
+
" if (typeof a === 'string') {\n",
|
|
1755
|
+
` let r = ""
|
|
1756
|
+
`,
|
|
1757
|
+
" for (let i = start; i >= end; --i) r += a[i]\n",
|
|
1758
|
+
" return r",
|
|
1759
|
+
asAny,
|
|
1760
|
+
"\n",
|
|
1761
|
+
" } else {\n",
|
|
1762
|
+
" return a.slice(end, start + 1).reverse()\n",
|
|
1763
|
+
" }\n",
|
|
1764
|
+
"});\n"
|
|
1765
|
+
]]);
|
|
1766
|
+
},
|
|
1732
1767
|
div(divRef) {
|
|
1733
1768
|
state.prelude.push(["", [
|
|
1734
1769
|
// [indent, statement]
|
|
@@ -1855,6 +1890,9 @@ function getHelperRef(base) {
|
|
|
1855
1890
|
declareHelper[base](ref);
|
|
1856
1891
|
return state.helperRefs[base] = ref;
|
|
1857
1892
|
}
|
|
1893
|
+
function peekHelperRef(base) {
|
|
1894
|
+
return state.helperRefs[base];
|
|
1895
|
+
}
|
|
1858
1896
|
function extractPreludeFor(node) {
|
|
1859
1897
|
let helpers = new Set(Object.values(state.helperRefs));
|
|
1860
1898
|
helpers = new Set(gatherRecursive(node, helpers.has.bind(helpers)));
|
|
@@ -5801,7 +5839,131 @@ function handleThisPrivateShorthands(value) {
|
|
|
5801
5839
|
return [value, value.thisShorthand];
|
|
5802
5840
|
}
|
|
5803
5841
|
function processTryBlock($0) {
|
|
5804
|
-
let [t, , b,
|
|
5842
|
+
let [t, , b, cs, e, f] = $0;
|
|
5843
|
+
let c;
|
|
5844
|
+
let m;
|
|
5845
|
+
if (cs.some(($) => (m = $.binding?.parameter, typeof m === "object" && m != null && "type" in m && m.type === "CatchPattern"))) {
|
|
5846
|
+
const ref = makeRef("e");
|
|
5847
|
+
const binding = {
|
|
5848
|
+
type: "CatchBinding",
|
|
5849
|
+
children: ["(", ref, ")"],
|
|
5850
|
+
parameter: ref
|
|
5851
|
+
};
|
|
5852
|
+
const condition = {
|
|
5853
|
+
type: "ParenthesizedExpression",
|
|
5854
|
+
children: ["(", ref, ")"],
|
|
5855
|
+
expression: ref
|
|
5856
|
+
};
|
|
5857
|
+
let defaultClause = false;
|
|
5858
|
+
const clauses = cs.map((clause) => {
|
|
5859
|
+
let ref1;
|
|
5860
|
+
if ((ref1 = clause.binding?.parameter) && typeof ref1 === "object" && "type" in ref1 && ref1.type === "CatchPattern" && "patterns" in ref1) {
|
|
5861
|
+
const { type, patterns } = ref1;
|
|
5862
|
+
return {
|
|
5863
|
+
type: "PatternClause",
|
|
5864
|
+
patterns,
|
|
5865
|
+
block: clause.block,
|
|
5866
|
+
children: [patterns, clause.block]
|
|
5867
|
+
};
|
|
5868
|
+
} else {
|
|
5869
|
+
defaultClause = true;
|
|
5870
|
+
const parameter = clause.binding?.parameter;
|
|
5871
|
+
if (parameter != null) {
|
|
5872
|
+
assert.equal(
|
|
5873
|
+
parameter.type,
|
|
5874
|
+
"CatchParameter",
|
|
5875
|
+
`Invalid catch parameter ${parameter.type}`
|
|
5876
|
+
);
|
|
5877
|
+
const { binding: pattern, typeSuffix } = parameter;
|
|
5878
|
+
const initializer = {
|
|
5879
|
+
type: "Initializer",
|
|
5880
|
+
expression: ref,
|
|
5881
|
+
children: ["", " = ", ref]
|
|
5882
|
+
};
|
|
5883
|
+
const bindings = [{
|
|
5884
|
+
type: "Binding",
|
|
5885
|
+
names: pattern.names,
|
|
5886
|
+
pattern,
|
|
5887
|
+
typeSuffix,
|
|
5888
|
+
initializer,
|
|
5889
|
+
children: [pattern, typeSuffix, initializer],
|
|
5890
|
+
splices: [],
|
|
5891
|
+
thisAssignments: []
|
|
5892
|
+
}];
|
|
5893
|
+
clause.block.expressions.unshift(["", {
|
|
5894
|
+
type: "Declaration",
|
|
5895
|
+
children: ["let", " ", bindings],
|
|
5896
|
+
bindings,
|
|
5897
|
+
names: bindings[0].names,
|
|
5898
|
+
decl: "let"
|
|
5899
|
+
}, ";"]);
|
|
5900
|
+
}
|
|
5901
|
+
return {
|
|
5902
|
+
type: "DefaultClause",
|
|
5903
|
+
block: clause.block,
|
|
5904
|
+
children: ["default: ", clause.block]
|
|
5905
|
+
};
|
|
5906
|
+
}
|
|
5907
|
+
});
|
|
5908
|
+
if (!defaultClause) {
|
|
5909
|
+
const expressions = [[
|
|
5910
|
+
"",
|
|
5911
|
+
{
|
|
5912
|
+
type: "ThrowStatement",
|
|
5913
|
+
children: ["throw", " ", ref]
|
|
5914
|
+
}
|
|
5915
|
+
]];
|
|
5916
|
+
const block2 = {
|
|
5917
|
+
type: "BlockStatement",
|
|
5918
|
+
expressions,
|
|
5919
|
+
children: [" {", expressions, "}"],
|
|
5920
|
+
bare: false
|
|
5921
|
+
};
|
|
5922
|
+
clauses.push({
|
|
5923
|
+
type: "DefaultClause",
|
|
5924
|
+
block: block2,
|
|
5925
|
+
children: ["default: ", block2]
|
|
5926
|
+
});
|
|
5927
|
+
}
|
|
5928
|
+
const caseBlock = {
|
|
5929
|
+
type: "CaseBlock",
|
|
5930
|
+
clauses,
|
|
5931
|
+
children: [" {", clauses, "}"]
|
|
5932
|
+
};
|
|
5933
|
+
const patternSwitch = {
|
|
5934
|
+
type: "SwitchStatement",
|
|
5935
|
+
condition,
|
|
5936
|
+
caseBlock,
|
|
5937
|
+
children: ["switch", condition, caseBlock]
|
|
5938
|
+
};
|
|
5939
|
+
const block = {
|
|
5940
|
+
type: "BlockStatement",
|
|
5941
|
+
bare: false,
|
|
5942
|
+
expressions: [["", patternSwitch]],
|
|
5943
|
+
children: [" {", patternSwitch, "}"]
|
|
5944
|
+
};
|
|
5945
|
+
c = makeNode({
|
|
5946
|
+
type: "CatchClause",
|
|
5947
|
+
children: [
|
|
5948
|
+
cs[0].children[0],
|
|
5949
|
+
// whitespace
|
|
5950
|
+
cs[0].children[1],
|
|
5951
|
+
// catch token
|
|
5952
|
+
binding,
|
|
5953
|
+
block
|
|
5954
|
+
],
|
|
5955
|
+
binding,
|
|
5956
|
+
block
|
|
5957
|
+
});
|
|
5958
|
+
} else {
|
|
5959
|
+
c = cs[0];
|
|
5960
|
+
if (cs.length > 1) {
|
|
5961
|
+
c = append(c, {
|
|
5962
|
+
type: "Error",
|
|
5963
|
+
message: "Only one catch clause allowed unless using pattern matching"
|
|
5964
|
+
});
|
|
5965
|
+
}
|
|
5966
|
+
}
|
|
5805
5967
|
if (!c && (e || !f)) {
|
|
5806
5968
|
const emptyCatchBlock = makeEmptyBlock();
|
|
5807
5969
|
c = {
|
|
@@ -5900,8 +6062,9 @@ function processCallMemberExpression(node) {
|
|
|
5900
6062
|
}
|
|
5901
6063
|
}
|
|
5902
6064
|
}
|
|
5903
|
-
for (let
|
|
5904
|
-
const
|
|
6065
|
+
for (let i3 = 0, len22 = children.length; i3 < len22; i3++) {
|
|
6066
|
+
const i = i3;
|
|
6067
|
+
const glob = children[i3];
|
|
5905
6068
|
if (glob?.type === "PropertyGlob") {
|
|
5906
6069
|
let prefix = children.slice(0, i);
|
|
5907
6070
|
const parts = [];
|
|
@@ -5972,14 +6135,14 @@ function processCallMemberExpression(node) {
|
|
|
5972
6135
|
});
|
|
5973
6136
|
}
|
|
5974
6137
|
}
|
|
5975
|
-
let
|
|
6138
|
+
let ref2;
|
|
5976
6139
|
let object = {
|
|
5977
6140
|
type: "ObjectExpression",
|
|
5978
6141
|
children: [
|
|
5979
6142
|
glob.object.children[0],
|
|
5980
6143
|
// {
|
|
5981
6144
|
...parts,
|
|
5982
|
-
(
|
|
6145
|
+
(ref2 = glob.object.children)[ref2.length - 1]
|
|
5983
6146
|
// whitespace and }
|
|
5984
6147
|
],
|
|
5985
6148
|
properties: parts,
|
|
@@ -6021,6 +6184,33 @@ function processCallMemberExpression(node) {
|
|
|
6021
6184
|
...children.slice(i + 1)
|
|
6022
6185
|
]
|
|
6023
6186
|
});
|
|
6187
|
+
} else if (typeof glob === "object" && glob != null && "type" in glob && glob.type === "SliceExpression" && "reversed" in glob && glob.reversed === true) {
|
|
6188
|
+
const args = [
|
|
6189
|
+
{ ...node, children: node.children.slice(0, i) },
|
|
6190
|
+
{ ...glob.children[0], token: ", " },
|
|
6191
|
+
...glob.children.slice(1, -1)
|
|
6192
|
+
];
|
|
6193
|
+
let ref3;
|
|
6194
|
+
return makeNode({
|
|
6195
|
+
...node,
|
|
6196
|
+
children: [
|
|
6197
|
+
{
|
|
6198
|
+
type: "CallExpression",
|
|
6199
|
+
children: [
|
|
6200
|
+
getHelperRef("rslice"),
|
|
6201
|
+
makeNode({
|
|
6202
|
+
type: "Call",
|
|
6203
|
+
args,
|
|
6204
|
+
children: [
|
|
6205
|
+
"(",
|
|
6206
|
+
args,
|
|
6207
|
+
(ref3 = glob.children)[ref3.length - 1]
|
|
6208
|
+
]
|
|
6209
|
+
})
|
|
6210
|
+
]
|
|
6211
|
+
}
|
|
6212
|
+
]
|
|
6213
|
+
});
|
|
6024
6214
|
}
|
|
6025
6215
|
}
|
|
6026
6216
|
return node;
|
|
@@ -6031,9 +6221,9 @@ function replaceNode(node, newNode, parent) {
|
|
|
6031
6221
|
throw new Error("replaceNode failed: node has no parent");
|
|
6032
6222
|
}
|
|
6033
6223
|
function recurse(children) {
|
|
6034
|
-
for (let
|
|
6035
|
-
const i =
|
|
6036
|
-
const child = children[
|
|
6224
|
+
for (let i4 = 0, len3 = children.length; i4 < len3; i4++) {
|
|
6225
|
+
const i = i4;
|
|
6226
|
+
const child = children[i4];
|
|
6037
6227
|
if (child === node) {
|
|
6038
6228
|
children[i] = newNode;
|
|
6039
6229
|
return true;
|
|
@@ -6125,8 +6315,8 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
6125
6315
|
return { type: "Error", message: "cannot use `type` in dynamic import" };
|
|
6126
6316
|
} else {
|
|
6127
6317
|
const { source, binding } = specifier;
|
|
6128
|
-
let
|
|
6129
|
-
const delim = (
|
|
6318
|
+
let ref4;
|
|
6319
|
+
const delim = (ref4 = specifier.children)[ref4.length - 1];
|
|
6130
6320
|
return {
|
|
6131
6321
|
type: pattern ? "BindingProperty" : "Property",
|
|
6132
6322
|
name: source,
|
|
@@ -6136,7 +6326,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
6136
6326
|
};
|
|
6137
6327
|
}
|
|
6138
6328
|
});
|
|
6139
|
-
let
|
|
6329
|
+
let ref5;
|
|
6140
6330
|
return {
|
|
6141
6331
|
type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
|
|
6142
6332
|
names: node.names,
|
|
@@ -6145,7 +6335,7 @@ function convertNamedImportsToObject(node, pattern) {
|
|
|
6145
6335
|
node.children[0],
|
|
6146
6336
|
// {
|
|
6147
6337
|
properties,
|
|
6148
|
-
(
|
|
6338
|
+
(ref5 = node.children)[ref5.length - 1]
|
|
6149
6339
|
// }
|
|
6150
6340
|
]
|
|
6151
6341
|
};
|
|
@@ -6251,8 +6441,8 @@ function processAssignments(statements) {
|
|
|
6251
6441
|
while (expr.type === "ParenthesizedExpression") {
|
|
6252
6442
|
expr = expr.expression;
|
|
6253
6443
|
}
|
|
6254
|
-
let
|
|
6255
|
-
if (
|
|
6444
|
+
let m1;
|
|
6445
|
+
if (m1 = expr.type, m1 === "AssignmentExpression" || m1 === "UpdateExpression") {
|
|
6256
6446
|
if (expr.type === "UpdateExpression" && expr.children[0] === expr.assigned) {
|
|
6257
6447
|
pre.push("(");
|
|
6258
6448
|
post.push([", ", lhs, ")"]);
|
|
@@ -6266,15 +6456,15 @@ function processAssignments(statements) {
|
|
|
6266
6456
|
return;
|
|
6267
6457
|
}
|
|
6268
6458
|
const pre = [], post = [];
|
|
6269
|
-
let
|
|
6459
|
+
let ref6;
|
|
6270
6460
|
switch (exp.type) {
|
|
6271
6461
|
case "AssignmentExpression": {
|
|
6272
6462
|
if (!exp.lhs)
|
|
6273
6463
|
return;
|
|
6274
6464
|
exp.lhs.forEach((lhsPart, i) => {
|
|
6275
|
-
let
|
|
6276
|
-
if (
|
|
6277
|
-
const newLhs =
|
|
6465
|
+
let ref7;
|
|
6466
|
+
if (ref7 = extractAssignment(lhsPart[1])) {
|
|
6467
|
+
const newLhs = ref7;
|
|
6278
6468
|
return lhsPart[1] = newLhs;
|
|
6279
6469
|
}
|
|
6280
6470
|
;
|
|
@@ -6283,8 +6473,8 @@ function processAssignments(statements) {
|
|
|
6283
6473
|
break;
|
|
6284
6474
|
}
|
|
6285
6475
|
case "UpdateExpression": {
|
|
6286
|
-
if (
|
|
6287
|
-
const newLhs =
|
|
6476
|
+
if (ref6 = extractAssignment(exp.assigned)) {
|
|
6477
|
+
const newLhs = ref6;
|
|
6288
6478
|
const i = exp.children.indexOf(exp.assigned);
|
|
6289
6479
|
exp.assigned = exp.children[i] = newLhs;
|
|
6290
6480
|
}
|
|
@@ -6300,7 +6490,7 @@ function processAssignments(statements) {
|
|
|
6300
6490
|
const { assigned } = exp;
|
|
6301
6491
|
const ref = makeRef();
|
|
6302
6492
|
const newMemberExp = unchainOptionalMemberExpression(assigned, ref, (children) => {
|
|
6303
|
-
return exp.children.map(($) => $ === assigned ? children : $);
|
|
6493
|
+
return exp.children.map(($3) => $3 === assigned ? children : $3);
|
|
6304
6494
|
});
|
|
6305
6495
|
if (newMemberExp !== assigned) {
|
|
6306
6496
|
if (newMemberExp.usesRef) {
|
|
@@ -6324,23 +6514,23 @@ function processAssignments(statements) {
|
|
|
6324
6514
|
(exp) => {
|
|
6325
6515
|
let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
|
|
6326
6516
|
let block;
|
|
6327
|
-
let
|
|
6328
|
-
if (exp.parent?.type === "BlockStatement" && !(
|
|
6517
|
+
let ref8;
|
|
6518
|
+
if (exp.parent?.type === "BlockStatement" && !(ref8 = $1[$1.length - 1])?.[ref8.length - 1]?.special) {
|
|
6329
6519
|
block = makeBlockFragment();
|
|
6330
|
-
let
|
|
6331
|
-
if (
|
|
6520
|
+
let ref9;
|
|
6521
|
+
if (ref9 = prependStatementExpressionBlock(
|
|
6332
6522
|
{ type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
|
|
6333
6523
|
block
|
|
6334
6524
|
)) {
|
|
6335
|
-
const ref =
|
|
6336
|
-
exp.children = exp.children.map(($
|
|
6525
|
+
const ref = ref9;
|
|
6526
|
+
exp.children = exp.children.map(($4) => $4 === $2 ? ref : $4);
|
|
6337
6527
|
$2 = ref;
|
|
6338
6528
|
} else {
|
|
6339
6529
|
block = void 0;
|
|
6340
6530
|
}
|
|
6341
6531
|
}
|
|
6342
|
-
let
|
|
6343
|
-
if ($1.some(($
|
|
6532
|
+
let ref10;
|
|
6533
|
+
if ($1.some(($5) => (ref10 = $5)[ref10.length - 1].special)) {
|
|
6344
6534
|
if ($1.length !== 1)
|
|
6345
6535
|
throw new Error("Only one assignment with id= is allowed");
|
|
6346
6536
|
const [, lhs, , op] = $1[0];
|
|
@@ -6365,8 +6555,8 @@ function processAssignments(statements) {
|
|
|
6365
6555
|
if (!(op.token === "=")) {
|
|
6366
6556
|
continue;
|
|
6367
6557
|
}
|
|
6368
|
-
let
|
|
6369
|
-
if (
|
|
6558
|
+
let m2;
|
|
6559
|
+
if (m2 = lhs.type, m2 === "ObjectExpression" || m2 === "ObjectBindingPattern") {
|
|
6370
6560
|
if (!wrapped) {
|
|
6371
6561
|
wrapped = true;
|
|
6372
6562
|
lhs.children.splice(0, 0, "(");
|
|
@@ -6380,10 +6570,17 @@ function processAssignments(statements) {
|
|
|
6380
6570
|
const lastAssignment = $1[i];
|
|
6381
6571
|
if (lastAssignment[3].token === "=") {
|
|
6382
6572
|
const lhs = lastAssignment[1];
|
|
6383
|
-
let
|
|
6573
|
+
let m3;
|
|
6384
6574
|
if (lhs.type === "MemberExpression") {
|
|
6385
6575
|
const members = lhs.children;
|
|
6386
6576
|
const lastMember = members[members.length - 1];
|
|
6577
|
+
if (typeof lastMember === "object" && lastMember != null && "type" in lastMember && lastMember.type === "CallExpression" && "children" in lastMember && Array.isArray(lastMember.children) && lastMember.children.length >= 1 && lastMember.children[0] === peekHelperRef("rslice")) {
|
|
6578
|
+
lastMember.children.push({
|
|
6579
|
+
type: "Error",
|
|
6580
|
+
message: "Slice range cannot be decreasing in assignment"
|
|
6581
|
+
});
|
|
6582
|
+
break;
|
|
6583
|
+
}
|
|
6387
6584
|
if (lastMember.type === "SliceExpression") {
|
|
6388
6585
|
const { start, end, children: c } = lastMember;
|
|
6389
6586
|
c[0].token = ".splice(";
|
|
@@ -6406,9 +6603,9 @@ function processAssignments(statements) {
|
|
|
6406
6603
|
exp.names = [];
|
|
6407
6604
|
break;
|
|
6408
6605
|
}
|
|
6409
|
-
} else if (
|
|
6606
|
+
} else if (m3 = lhs.type, m3 === "ObjectBindingPattern" || m3 === "ArrayBindingPattern") {
|
|
6410
6607
|
processBindingPatternLHS(lhs, tail);
|
|
6411
|
-
gatherRecursiveAll(lhs, ($
|
|
6608
|
+
gatherRecursiveAll(lhs, ($6) => $6.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
|
|
6412
6609
|
}
|
|
6413
6610
|
}
|
|
6414
6611
|
i--;
|
|
@@ -6441,7 +6638,7 @@ function processAssignments(statements) {
|
|
|
6441
6638
|
}
|
|
6442
6639
|
if (refsToDeclare.size) {
|
|
6443
6640
|
if (exp.hoistDec) {
|
|
6444
|
-
exp.hoistDec.children.push([...refsToDeclare].map(($
|
|
6641
|
+
exp.hoistDec.children.push([...refsToDeclare].map(($7) => [",", $7]));
|
|
6445
6642
|
} else {
|
|
6446
6643
|
exp.hoistDec = {
|
|
6447
6644
|
type: "Declaration",
|
|
@@ -6515,9 +6712,9 @@ function unchainOptionalMemberExpression(exp, ref, innerExp) {
|
|
|
6515
6712
|
}
|
|
6516
6713
|
j++;
|
|
6517
6714
|
}
|
|
6518
|
-
let
|
|
6519
|
-
if (
|
|
6520
|
-
const l =
|
|
6715
|
+
let ref11;
|
|
6716
|
+
if (ref11 = conditions.length) {
|
|
6717
|
+
const l = ref11;
|
|
6521
6718
|
const cs = flatJoin(conditions, " && ");
|
|
6522
6719
|
return {
|
|
6523
6720
|
...exp,
|
|
@@ -6556,27 +6753,27 @@ function processTypes(node) {
|
|
|
6556
6753
|
if (!unary.suffix.length) {
|
|
6557
6754
|
return;
|
|
6558
6755
|
}
|
|
6559
|
-
let
|
|
6560
|
-
let
|
|
6561
|
-
if (
|
|
6562
|
-
const { token } =
|
|
6756
|
+
let ref12;
|
|
6757
|
+
let m4;
|
|
6758
|
+
if (m4 = (ref12 = unary.suffix)[ref12.length - 1], typeof m4 === "object" && m4 != null && "token" in m4 && m4.token === "?") {
|
|
6759
|
+
const { token } = m4;
|
|
6563
6760
|
let last;
|
|
6564
6761
|
let count = 0;
|
|
6565
|
-
let
|
|
6566
|
-
while (unary.suffix.length && (
|
|
6762
|
+
let ref13;
|
|
6763
|
+
while (unary.suffix.length && (ref13 = unary.suffix)[ref13.length - 1]?.token === "?") {
|
|
6567
6764
|
last = unary.suffix.pop();
|
|
6568
6765
|
count++;
|
|
6569
6766
|
}
|
|
6570
|
-
let
|
|
6571
|
-
while (unary.suffix.length && (
|
|
6767
|
+
let ref14;
|
|
6768
|
+
while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
|
|
6572
6769
|
unary.suffix.pop();
|
|
6573
6770
|
}
|
|
6574
|
-
let
|
|
6771
|
+
let ref15;
|
|
6575
6772
|
if (unary.suffix.length || unary.prefix.length)
|
|
6576
|
-
|
|
6773
|
+
ref15 = unary;
|
|
6577
6774
|
else
|
|
6578
|
-
|
|
6579
|
-
const t =
|
|
6775
|
+
ref15 = unary.t;
|
|
6776
|
+
const t = ref15;
|
|
6580
6777
|
if (unary.parent?.type === "TypeTuple") {
|
|
6581
6778
|
if (count === 1) {
|
|
6582
6779
|
unary.suffix.push(last);
|
|
@@ -6602,14 +6799,14 @@ function processTypes(node) {
|
|
|
6602
6799
|
]
|
|
6603
6800
|
});
|
|
6604
6801
|
}
|
|
6605
|
-
} else if (typeof
|
|
6606
|
-
const { type } =
|
|
6607
|
-
let
|
|
6608
|
-
while (unary.suffix.length && (
|
|
6802
|
+
} else if (typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "NonNullAssertion") {
|
|
6803
|
+
const { type } = m4;
|
|
6804
|
+
let ref16;
|
|
6805
|
+
while (unary.suffix.length && (ref16 = unary.suffix)[ref16.length - 1]?.type === "NonNullAssertion") {
|
|
6609
6806
|
unary.suffix.pop();
|
|
6610
6807
|
}
|
|
6611
|
-
let
|
|
6612
|
-
while (unary.suffix.length && (
|
|
6808
|
+
let ref17;
|
|
6809
|
+
while (unary.suffix.length && (ref17 = unary.suffix)[ref17.length - 1]?.token === "?") {
|
|
6613
6810
|
unary.suffix.pop();
|
|
6614
6811
|
}
|
|
6615
6812
|
const t = trimFirstSpace(
|
|
@@ -6635,14 +6832,14 @@ function processTypes(node) {
|
|
|
6635
6832
|
});
|
|
6636
6833
|
}
|
|
6637
6834
|
function processStatementExpressions(statements) {
|
|
6638
|
-
gatherRecursiveAll(statements, ($
|
|
6835
|
+
gatherRecursiveAll(statements, ($8) => $8.type === "StatementExpression").forEach((_exp) => {
|
|
6639
6836
|
const exp = _exp;
|
|
6640
6837
|
const { statement } = exp;
|
|
6641
|
-
let
|
|
6838
|
+
let ref18;
|
|
6642
6839
|
switch (statement.type) {
|
|
6643
6840
|
case "IfStatement": {
|
|
6644
|
-
if (
|
|
6645
|
-
const expression =
|
|
6841
|
+
if (ref18 = expressionizeIfStatement(statement)) {
|
|
6842
|
+
const expression = ref18;
|
|
6646
6843
|
return replaceNode(statement, expression, exp);
|
|
6647
6844
|
} else {
|
|
6648
6845
|
return replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -6711,7 +6908,7 @@ function processProgram(root) {
|
|
|
6711
6908
|
if (config2.iife || config2.repl) {
|
|
6712
6909
|
rootIIFE = wrapIIFE(root.expressions, root.topLevelAwait);
|
|
6713
6910
|
const newExpressions = [["", rootIIFE]];
|
|
6714
|
-
root.children = root.children.map(($
|
|
6911
|
+
root.children = root.children.map(($9) => $9 === root.expressions ? newExpressions : $9);
|
|
6715
6912
|
root.expressions = newExpressions;
|
|
6716
6913
|
}
|
|
6717
6914
|
addParentPointers(root);
|
|
@@ -6751,17 +6948,17 @@ async function processProgramAsync(root) {
|
|
|
6751
6948
|
await processComptime(statements);
|
|
6752
6949
|
}
|
|
6753
6950
|
function processRepl(root, rootIIFE) {
|
|
6754
|
-
const topBlock = gatherRecursive(rootIIFE, ($
|
|
6951
|
+
const topBlock = gatherRecursive(rootIIFE, ($10) => $10.type === "BlockStatement")[0];
|
|
6755
6952
|
let i = 0;
|
|
6756
|
-
for (let
|
|
6757
|
-
const decl =
|
|
6953
|
+
for (let ref19 = gatherRecursiveWithinFunction(topBlock, ($11) => $11.type === "Declaration"), i5 = 0, len4 = ref19.length; i5 < len4; i5++) {
|
|
6954
|
+
const decl = ref19[i5];
|
|
6758
6955
|
if (decl.parent === topBlock || decl.decl === "var") {
|
|
6759
6956
|
decl.children.shift();
|
|
6760
6957
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")};`]);
|
|
6761
6958
|
}
|
|
6762
6959
|
}
|
|
6763
|
-
for (let
|
|
6764
|
-
const func =
|
|
6960
|
+
for (let ref20 = gatherRecursive(topBlock, ($12) => $12.type === "FunctionExpression"), i6 = 0, len5 = ref20.length; i6 < len5; i6++) {
|
|
6961
|
+
const func = ref20[i6];
|
|
6765
6962
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
6766
6963
|
if (func.parent === topBlock) {
|
|
6767
6964
|
replaceNode(func, void 0);
|
|
@@ -6773,17 +6970,17 @@ function processRepl(root, rootIIFE) {
|
|
|
6773
6970
|
}
|
|
6774
6971
|
}
|
|
6775
6972
|
}
|
|
6776
|
-
for (let
|
|
6777
|
-
const classExp =
|
|
6778
|
-
let
|
|
6779
|
-
if (classExp.name && classExp.parent === topBlock || (
|
|
6973
|
+
for (let ref21 = gatherRecursiveWithinFunction(topBlock, ($13) => $13.type === "ClassExpression"), i7 = 0, len6 = ref21.length; i7 < len6; i7++) {
|
|
6974
|
+
const classExp = ref21[i7];
|
|
6975
|
+
let m5;
|
|
6976
|
+
if (classExp.name && classExp.parent === topBlock || (m5 = classExp.parent, typeof m5 === "object" && m5 != null && "type" in m5 && m5.type === "ReturnStatement" && "parent" in m5 && m5.parent === topBlock)) {
|
|
6780
6977
|
classExp.children.unshift(classExp.name, "=");
|
|
6781
6978
|
root.expressions.splice(i++, 0, ["", `var ${classExp.name};`]);
|
|
6782
6979
|
}
|
|
6783
6980
|
}
|
|
6784
6981
|
}
|
|
6785
6982
|
function populateRefs(statements) {
|
|
6786
|
-
const refNodes = gatherRecursive(statements, ($
|
|
6983
|
+
const refNodes = gatherRecursive(statements, ($14) => $14.type === "Ref");
|
|
6787
6984
|
if (refNodes.length) {
|
|
6788
6985
|
const ids = gatherRecursive(statements, (s) => s.type === "Identifier");
|
|
6789
6986
|
const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
|
|
@@ -6806,11 +7003,11 @@ function populateRefs(statements) {
|
|
|
6806
7003
|
function processPlaceholders(statements) {
|
|
6807
7004
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
6808
7005
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
6809
|
-
gatherRecursiveAll(statements, ($
|
|
7006
|
+
gatherRecursiveAll(statements, ($15) => $15.type === "Placeholder").forEach((_exp) => {
|
|
6810
7007
|
const exp = _exp;
|
|
6811
7008
|
let ancestor;
|
|
6812
7009
|
if (exp.subtype === ".") {
|
|
6813
|
-
({ ancestor } = findAncestor(exp, ($
|
|
7010
|
+
({ ancestor } = findAncestor(exp, ($16) => $16.type === "Call"));
|
|
6814
7011
|
ancestor = ancestor?.parent;
|
|
6815
7012
|
while (ancestor?.parent?.type === "UnaryExpression" || ancestor?.parent?.type === "NewExpression") {
|
|
6816
7013
|
ancestor = ancestor.parent;
|
|
@@ -6829,10 +7026,10 @@ function processPlaceholders(statements) {
|
|
|
6829
7026
|
if (type === "IfStatement") {
|
|
6830
7027
|
liftedIfs.add(ancestor2);
|
|
6831
7028
|
}
|
|
6832
|
-
let m5;
|
|
6833
7029
|
let m6;
|
|
7030
|
+
let m7;
|
|
6834
7031
|
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
6835
|
-
type === "BlockStatement" && !((
|
|
7032
|
+
type === "BlockStatement" && !((m6 = ancestor2.parent, typeof m6 === "object" && m6 != null && "type" in m6 && m6.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m7 = ancestor2.parent, typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "ElseClause" && "parent" in m7 && typeof m7.parent === "object" && m7.parent != null && "type" in m7.parent && m7.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
|
|
6836
7033
|
type === "Initializer" || // Right-hand side of assignment
|
|
6837
7034
|
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
6838
7035
|
}));
|
|
@@ -6908,11 +7105,11 @@ function processPlaceholders(statements) {
|
|
|
6908
7105
|
for (const [ancestor, placeholders] of placeholderMap) {
|
|
6909
7106
|
let ref = makeRef("$");
|
|
6910
7107
|
let typeSuffix;
|
|
6911
|
-
for (let
|
|
6912
|
-
const placeholder = placeholders[
|
|
7108
|
+
for (let i8 = 0, len7 = placeholders.length; i8 < len7; i8++) {
|
|
7109
|
+
const placeholder = placeholders[i8];
|
|
6913
7110
|
typeSuffix ??= placeholder.typeSuffix;
|
|
6914
|
-
let
|
|
6915
|
-
replaceNode((
|
|
7111
|
+
let ref22;
|
|
7112
|
+
replaceNode((ref22 = placeholder.children)[ref22.length - 1], ref);
|
|
6916
7113
|
}
|
|
6917
7114
|
const { parent } = ancestor;
|
|
6918
7115
|
const body = maybeUnwrap(ancestor);
|
|
@@ -6933,16 +7130,16 @@ function processPlaceholders(statements) {
|
|
|
6933
7130
|
}
|
|
6934
7131
|
case "PipelineExpression": {
|
|
6935
7132
|
const i = findChildIndex(parent, ancestor);
|
|
6936
|
-
let
|
|
7133
|
+
let ref23;
|
|
6937
7134
|
if (i === 1) {
|
|
6938
|
-
|
|
7135
|
+
ref23 = ancestor === parent.children[i];
|
|
6939
7136
|
} else if (i === 2) {
|
|
6940
|
-
|
|
7137
|
+
ref23 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
6941
7138
|
} else {
|
|
6942
|
-
|
|
7139
|
+
ref23 = void 0;
|
|
6943
7140
|
}
|
|
6944
7141
|
;
|
|
6945
|
-
outer =
|
|
7142
|
+
outer = ref23;
|
|
6946
7143
|
break;
|
|
6947
7144
|
}
|
|
6948
7145
|
case "AssignmentExpression":
|
|
@@ -6957,9 +7154,9 @@ function processPlaceholders(statements) {
|
|
|
6957
7154
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
6958
7155
|
}
|
|
6959
7156
|
replaceNode(ancestor, fnExp, parent);
|
|
6960
|
-
let
|
|
6961
|
-
if (
|
|
6962
|
-
const ws =
|
|
7157
|
+
let ref24;
|
|
7158
|
+
if (ref24 = getTrimmingSpace(body)) {
|
|
7159
|
+
const ws = ref24;
|
|
6963
7160
|
inplaceInsertTrimmingSpace(body, "");
|
|
6964
7161
|
inplacePrepend(ws, fnExp);
|
|
6965
7162
|
}
|
|
@@ -7004,8 +7201,8 @@ function reorderBindingRestProperty(props) {
|
|
|
7004
7201
|
}
|
|
7005
7202
|
];
|
|
7006
7203
|
}
|
|
7007
|
-
let
|
|
7008
|
-
if (Array.isArray(rest.delim) && (
|
|
7204
|
+
let ref25;
|
|
7205
|
+
if (Array.isArray(rest.delim) && (ref25 = rest.delim)[ref25.length - 1]?.token === ",") {
|
|
7009
7206
|
rest.delim = rest.delim.slice(0, -1);
|
|
7010
7207
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
7011
7208
|
}
|
|
@@ -7030,9 +7227,9 @@ function replaceNodes(root, predicate, replacer) {
|
|
|
7030
7227
|
return root;
|
|
7031
7228
|
}
|
|
7032
7229
|
}
|
|
7033
|
-
for (let
|
|
7034
|
-
const i =
|
|
7035
|
-
const node = array[
|
|
7230
|
+
for (let i9 = 0, len8 = array.length; i9 < len8; i9++) {
|
|
7231
|
+
const i = i9;
|
|
7232
|
+
const node = array[i9];
|
|
7036
7233
|
if (!(node != null)) {
|
|
7037
7234
|
return;
|
|
7038
7235
|
}
|
|
@@ -7056,9 +7253,9 @@ function replaceNodesRecursive(root, predicate, replacer) {
|
|
|
7056
7253
|
return root;
|
|
7057
7254
|
}
|
|
7058
7255
|
}
|
|
7059
|
-
for (let
|
|
7060
|
-
const i =
|
|
7061
|
-
const node = array[
|
|
7256
|
+
for (let i10 = 0, len9 = array.length; i10 < len9; i10++) {
|
|
7257
|
+
const i = i10;
|
|
7258
|
+
const node = array[i10];
|
|
7062
7259
|
if (!(node != null)) {
|
|
7063
7260
|
continue;
|
|
7064
7261
|
}
|
|
@@ -7476,7 +7673,7 @@ var grammar = {
|
|
|
7476
7673
|
IgnoreColon,
|
|
7477
7674
|
TryStatement,
|
|
7478
7675
|
CatchClause,
|
|
7479
|
-
|
|
7676
|
+
CatchBinding,
|
|
7480
7677
|
FinallyClause,
|
|
7481
7678
|
CatchParameter,
|
|
7482
7679
|
Condition,
|
|
@@ -7536,6 +7733,8 @@ var grammar = {
|
|
|
7536
7733
|
NamedImports,
|
|
7537
7734
|
OperatorNamedImports,
|
|
7538
7735
|
FromClause,
|
|
7736
|
+
ImpliedFromClause,
|
|
7737
|
+
ImpliedFrom,
|
|
7539
7738
|
ImportAssertion,
|
|
7540
7739
|
TypeAndImportSpecifier,
|
|
7541
7740
|
ImportSpecifier,
|
|
@@ -7820,6 +8019,7 @@ var grammar = {
|
|
|
7820
8019
|
TypeSuffix,
|
|
7821
8020
|
MaybeNestedType,
|
|
7822
8021
|
MaybeNestedTypePrimary,
|
|
8022
|
+
MaybeNestedTypeUnary,
|
|
7823
8023
|
ReturnTypeSuffix,
|
|
7824
8024
|
ReturnType,
|
|
7825
8025
|
TypePredicate,
|
|
@@ -8219,7 +8419,7 @@ var $R28 = (0, import_lib4.$R)(new RegExp("(?!\\+\\+|--)[!~+-](?!\\s)", "suy"));
|
|
|
8219
8419
|
var $R29 = (0, import_lib4.$R)(new RegExp("[:.]", "suy"));
|
|
8220
8420
|
var $R30 = (0, import_lib4.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy"));
|
|
8221
8421
|
var $R31 = (0, import_lib4.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy"));
|
|
8222
|
-
var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s]+', "suy"));
|
|
8422
|
+
var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s=>]+', "suy"));
|
|
8223
8423
|
var $R33 = (0, import_lib4.$R)(new RegExp("(?=[0-9.])", "suy"));
|
|
8224
8424
|
var $R34 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy"));
|
|
8225
8425
|
var $R35 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy"));
|
|
@@ -9728,14 +9928,22 @@ var CallExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Super, Arguments
|
|
|
9728
9928
|
var CallExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9729
9929
|
return dynamizeImportDeclarationExpression($0);
|
|
9730
9930
|
});
|
|
9731
|
-
var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(
|
|
9931
|
+
var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(FromClause, __, Import, _, NamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9932
|
+
var from = $1;
|
|
9933
|
+
var fws = $2;
|
|
9934
|
+
var i = $3;
|
|
9935
|
+
var iws = $4;
|
|
9936
|
+
var imports = $5;
|
|
9937
|
+
return dynamizeImportDeclarationExpression([i, iws, imports, fws, from]);
|
|
9938
|
+
});
|
|
9939
|
+
var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$EXPECT)($L15, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
9732
9940
|
var rest = $3;
|
|
9733
9941
|
return processCallMemberExpression({
|
|
9734
9942
|
type: "CallExpression",
|
|
9735
9943
|
children: [$1, ...$2, ...rest.flat()]
|
|
9736
9944
|
});
|
|
9737
9945
|
});
|
|
9738
|
-
var CallExpression$
|
|
9946
|
+
var CallExpression$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression, AllowedTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
9739
9947
|
var member = $1;
|
|
9740
9948
|
var trailing = $2;
|
|
9741
9949
|
var rest = $3;
|
|
@@ -9748,7 +9956,7 @@ var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression
|
|
|
9748
9956
|
}
|
|
9749
9957
|
return member;
|
|
9750
9958
|
});
|
|
9751
|
-
var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3];
|
|
9959
|
+
var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3, CallExpression$4];
|
|
9752
9960
|
function CallExpression(ctx, state2) {
|
|
9753
9961
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "CallExpression", CallExpression$$);
|
|
9754
9962
|
}
|
|
@@ -9878,11 +10086,12 @@ var MemberBracketContent$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(OpenBracke
|
|
|
9878
10086
|
var ws = $3;
|
|
9879
10087
|
var close = $4;
|
|
9880
10088
|
if (expression.type === "SliceParameters") {
|
|
9881
|
-
const { start, end, children } = expression;
|
|
10089
|
+
const { start, end, reversed, children } = expression;
|
|
9882
10090
|
return {
|
|
9883
10091
|
type: "SliceExpression",
|
|
9884
10092
|
start,
|
|
9885
10093
|
end,
|
|
10094
|
+
reversed,
|
|
9886
10095
|
children: [
|
|
9887
10096
|
{ ...open, token: ".slice(" },
|
|
9888
10097
|
...children,
|
|
@@ -9899,78 +10108,57 @@ var MemberBracketContent$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(OpenBracke
|
|
|
9899
10108
|
function MemberBracketContent(ctx, state2) {
|
|
9900
10109
|
return (0, import_lib4.$EVENT)(ctx, state2, "MemberBracketContent", MemberBracketContent$0);
|
|
9901
10110
|
}
|
|
9902
|
-
var SliceParameters$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Expression, __, RangeDots, (0, import_lib4.$E)(Expression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9903
|
-
var
|
|
9904
|
-
var
|
|
9905
|
-
var
|
|
9906
|
-
var
|
|
10111
|
+
var SliceParameters$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Loc, (0, import_lib4.$E)(Expression), __, RangeDots, Loc, (0, import_lib4.$E)(Expression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
10112
|
+
var ls = $1;
|
|
10113
|
+
var start = $2;
|
|
10114
|
+
var ws = $3;
|
|
10115
|
+
var dots = $4;
|
|
10116
|
+
var le = $5;
|
|
10117
|
+
var end = $6;
|
|
10118
|
+
const reversed = dots.increasing === false;
|
|
10119
|
+
const sign = reversed ? "-" : "+";
|
|
9907
10120
|
let children;
|
|
10121
|
+
start ??= {
|
|
10122
|
+
$loc: ls.$loc,
|
|
10123
|
+
token: reversed ? "-1" : "0"
|
|
10124
|
+
};
|
|
10125
|
+
if (!end) {
|
|
10126
|
+
if (reversed) {
|
|
10127
|
+
end = {
|
|
10128
|
+
$loc: le.$loc,
|
|
10129
|
+
token: "0"
|
|
10130
|
+
};
|
|
10131
|
+
} else if (!dots.right.inclusive && !dots.triple) {
|
|
10132
|
+
end = {
|
|
10133
|
+
$loc: le.$loc,
|
|
10134
|
+
token: "-1"
|
|
10135
|
+
};
|
|
10136
|
+
}
|
|
10137
|
+
}
|
|
9908
10138
|
if (!dots.left.inclusive) {
|
|
9909
|
-
start = [
|
|
10139
|
+
start = [makeLeftHandSideExpression(start), ` ${sign} 1`];
|
|
9910
10140
|
}
|
|
9911
10141
|
if (end) {
|
|
9912
10142
|
const inc = [];
|
|
9913
10143
|
if (dots.right.inclusive) {
|
|
9914
|
-
end = [
|
|
9915
|
-
|
|
10144
|
+
end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
|
|
10145
|
+
if (!reversed)
|
|
10146
|
+
inc.push(" || 1/0");
|
|
9916
10147
|
}
|
|
9917
10148
|
children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
|
|
9918
10149
|
} else {
|
|
9919
10150
|
children = [start, ws];
|
|
9920
10151
|
}
|
|
9921
|
-
if (dots.increasing === false) {
|
|
9922
|
-
children.push({
|
|
9923
|
-
type: "Error",
|
|
9924
|
-
message: "Slice range cannot be decreasing",
|
|
9925
|
-
$loc: dots.$loc
|
|
9926
|
-
});
|
|
9927
|
-
}
|
|
9928
10152
|
return {
|
|
9929
10153
|
type: "SliceParameters",
|
|
9930
10154
|
start,
|
|
9931
10155
|
end,
|
|
10156
|
+
reversed,
|
|
9932
10157
|
children
|
|
9933
10158
|
};
|
|
9934
10159
|
});
|
|
9935
|
-
var SliceParameters$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Loc, __, (0, import_lib4.$C)(DotDotDot, DotDot), Expression), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9936
|
-
var l = $1;
|
|
9937
|
-
var ws = $2;
|
|
9938
|
-
var sep = $3;
|
|
9939
|
-
var end = $4;
|
|
9940
|
-
const inclusive = sep.token === "..";
|
|
9941
|
-
const inc = [];
|
|
9942
|
-
if (inclusive) {
|
|
9943
|
-
end = ["1 + ", end];
|
|
9944
|
-
inc.push(" || 1/0");
|
|
9945
|
-
}
|
|
9946
|
-
const start = {
|
|
9947
|
-
$loc: l.$loc,
|
|
9948
|
-
token: "0"
|
|
9949
|
-
};
|
|
9950
|
-
return {
|
|
9951
|
-
type: "SliceParameters",
|
|
9952
|
-
start,
|
|
9953
|
-
end,
|
|
9954
|
-
children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
|
|
9955
|
-
};
|
|
9956
|
-
});
|
|
9957
|
-
var SliceParameters$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Loc, __, (0, import_lib4.$C)(DotDot, DotDotDot), (0, import_lib4.$Y)((0, import_lib4.$S)(__, CloseBracket))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9958
|
-
var l = $1;
|
|
9959
|
-
var ws = $2;
|
|
9960
|
-
const start = {
|
|
9961
|
-
$loc: l.$loc,
|
|
9962
|
-
token: "0"
|
|
9963
|
-
};
|
|
9964
|
-
return {
|
|
9965
|
-
type: "SliceParameters",
|
|
9966
|
-
start,
|
|
9967
|
-
end: void 0,
|
|
9968
|
-
children: [start, ws]
|
|
9969
|
-
};
|
|
9970
|
-
});
|
|
9971
|
-
var SliceParameters$$ = [SliceParameters$0, SliceParameters$1, SliceParameters$2];
|
|
9972
10160
|
function SliceParameters(ctx, state2) {
|
|
9973
|
-
return (0, import_lib4.$
|
|
10161
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "SliceParameters", SliceParameters$0);
|
|
9974
10162
|
}
|
|
9975
10163
|
var AccessStart$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(PropertyAccessModifier), Dot, (0, import_lib4.$N)((0, import_lib4.$EXPECT)($R11, "AccessStart /[.\\s]/"))), function($skip, $loc, $0, $1, $2, $3) {
|
|
9976
10164
|
var modifier = $1;
|
|
@@ -11639,6 +11827,7 @@ var RangeDots$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(DotDotDot), function(
|
|
|
11639
11827
|
left: { inclusive: true, raw: "" },
|
|
11640
11828
|
right: { inclusive: false, raw: "." },
|
|
11641
11829
|
increasing: void 0,
|
|
11830
|
+
triple: true,
|
|
11642
11831
|
children: []
|
|
11643
11832
|
};
|
|
11644
11833
|
});
|
|
@@ -13797,9 +13986,12 @@ var ForBinding$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(
|
|
|
13797
13986
|
function ForBinding(ctx, state2) {
|
|
13798
13987
|
return (0, import_lib4.$EVENT)(ctx, state2, "ForBinding", ForBinding$0);
|
|
13799
13988
|
}
|
|
13800
|
-
var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, import_lib4.$C)(EmptyCondition, Condition), CaseBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
13801
|
-
var
|
|
13802
|
-
var
|
|
13989
|
+
var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, ForbidNewlineBinaryOp, (0, import_lib4.$E)((0, import_lib4.$C)(EmptyCondition, Condition)), RestoreNewlineBinaryOp, CaseBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
13990
|
+
var s = $1;
|
|
13991
|
+
var condition = $3;
|
|
13992
|
+
var caseBlock = $5;
|
|
13993
|
+
if (!condition)
|
|
13994
|
+
return $skip;
|
|
13803
13995
|
if (condition.type === "EmptyCondition") {
|
|
13804
13996
|
caseBlock.clauses.forEach(({ cases }) => {
|
|
13805
13997
|
if (cases) {
|
|
@@ -13819,7 +14011,8 @@ var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, imp
|
|
|
13819
14011
|
}
|
|
13820
14012
|
return {
|
|
13821
14013
|
type: "SwitchStatement",
|
|
13822
|
-
children:
|
|
14014
|
+
children: [s, condition, caseBlock],
|
|
14015
|
+
// omit NewlineBinaryOp control
|
|
13823
14016
|
condition,
|
|
13824
14017
|
caseBlock
|
|
13825
14018
|
};
|
|
@@ -13916,12 +14109,14 @@ var CaseClause$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Default, ImpliedColo
|
|
|
13916
14109
|
};
|
|
13917
14110
|
});
|
|
13918
14111
|
var CaseClause$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(Else, ImpliedColon, (0, import_lib4.$C)(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
|
|
14112
|
+
var e = $1;
|
|
14113
|
+
var colon = $2;
|
|
13919
14114
|
var block = $3;
|
|
13920
|
-
|
|
14115
|
+
e = { ...e, token: "default" };
|
|
13921
14116
|
return {
|
|
13922
14117
|
type: "DefaultClause",
|
|
13923
14118
|
block,
|
|
13924
|
-
children:
|
|
14119
|
+
children: [e, colon, block]
|
|
13925
14120
|
};
|
|
13926
14121
|
});
|
|
13927
14122
|
var CaseClause$$ = [CaseClause$0, CaseClause$1, CaseClause$2, CaseClause$3, CaseClause$4];
|
|
@@ -13992,36 +14187,56 @@ var IgnoreColon$0 = (0, import_lib4.$TV)((0, import_lib4.$E)((0, import_lib4.$S)
|
|
|
13992
14187
|
function IgnoreColon(ctx, state2) {
|
|
13993
14188
|
return (0, import_lib4.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
|
|
13994
14189
|
}
|
|
13995
|
-
var TryStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Try, (0, import_lib4.$N)((0, import_lib4.$EXPECT)($L16, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, (0, import_lib4.$
|
|
14190
|
+
var TryStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Try, (0, import_lib4.$N)((0, import_lib4.$EXPECT)($L16, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, (0, import_lib4.$Q)(CatchClause), (0, import_lib4.$E)(ElseClause), (0, import_lib4.$E)(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
13996
14191
|
return processTryBlock($0);
|
|
13997
14192
|
});
|
|
13998
14193
|
function TryStatement(ctx, state2) {
|
|
13999
14194
|
return (0, import_lib4.$EVENT)(ctx, state2, "TryStatement", TryStatement$0);
|
|
14000
14195
|
}
|
|
14001
|
-
var CatchClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Catch, (0, import_lib4.$E)(
|
|
14196
|
+
var CatchClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Catch, (0, import_lib4.$E)(CatchBinding), (0, import_lib4.$C)(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
14197
|
+
var binding = $3;
|
|
14002
14198
|
var block = $4;
|
|
14003
14199
|
return {
|
|
14004
14200
|
type: "CatchClause",
|
|
14005
14201
|
children: $0,
|
|
14006
|
-
block
|
|
14202
|
+
block,
|
|
14203
|
+
binding
|
|
14007
14204
|
};
|
|
14008
14205
|
});
|
|
14009
14206
|
function CatchClause(ctx, state2) {
|
|
14010
14207
|
return (0, import_lib4.$EVENT)(ctx, state2, "CatchClause", CatchClause$0);
|
|
14011
14208
|
}
|
|
14012
|
-
var
|
|
14013
|
-
var
|
|
14209
|
+
var CatchBinding$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), OpenParen, __, AllowAll, (0, import_lib4.$E)(CatchParameter), RestoreAll, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
14210
|
+
var ws1 = $1;
|
|
14211
|
+
var open = $2;
|
|
14212
|
+
var ws2 = $3;
|
|
14213
|
+
var parameter = $5;
|
|
14214
|
+
var ws3 = $7;
|
|
14215
|
+
var close = $8;
|
|
14216
|
+
if (!parameter)
|
|
14217
|
+
return $skip;
|
|
14218
|
+
return {
|
|
14219
|
+
type: "CatchBinding",
|
|
14220
|
+
parameter,
|
|
14221
|
+
children: [ws1, open, ws2, parameter, ws3, close]
|
|
14222
|
+
};
|
|
14223
|
+
});
|
|
14224
|
+
var CatchBinding$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(_, InsertOpenParen, (0, import_lib4.$N)(EOS), ForbidIndentedApplication, (0, import_lib4.$E)(CatchParameter), RestoreIndentedApplication, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
14014
14225
|
var ws = $1;
|
|
14015
14226
|
var open = $2;
|
|
14016
|
-
var
|
|
14227
|
+
var parameter = $5;
|
|
14017
14228
|
var close = $7;
|
|
14018
|
-
if (!
|
|
14229
|
+
if (!parameter)
|
|
14019
14230
|
return $skip;
|
|
14020
|
-
return
|
|
14231
|
+
return {
|
|
14232
|
+
type: "CatchBinding",
|
|
14233
|
+
parameter,
|
|
14234
|
+
children: [ws, open, parameter, close]
|
|
14235
|
+
};
|
|
14021
14236
|
});
|
|
14022
|
-
var
|
|
14023
|
-
function
|
|
14024
|
-
return (0, import_lib4.$EVENT_C)(ctx, state2, "
|
|
14237
|
+
var CatchBinding$$ = [CatchBinding$0, CatchBinding$1];
|
|
14238
|
+
function CatchBinding(ctx, state2) {
|
|
14239
|
+
return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchBinding", CatchBinding$$);
|
|
14025
14240
|
}
|
|
14026
14241
|
var FinallyClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Finally, (0, import_lib4.$C)(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
|
|
14027
14242
|
var block = $3;
|
|
@@ -14034,9 +14249,34 @@ var FinallyClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$
|
|
|
14034
14249
|
function FinallyClause(ctx, state2) {
|
|
14035
14250
|
return (0, import_lib4.$EVENT)(ctx, state2, "FinallyClause", FinallyClause$0);
|
|
14036
14251
|
}
|
|
14037
|
-
var CatchParameter$0 = (0, import_lib4.$S)(BindingIdentifier, (0, import_lib4.$E)(TypeSuffix))
|
|
14038
|
-
var
|
|
14039
|
-
var
|
|
14252
|
+
var CatchParameter$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(BindingIdentifier, (0, import_lib4.$E)(TypeSuffix)), function($skip, $loc, $0, $1, $2) {
|
|
14253
|
+
var binding = $1;
|
|
14254
|
+
var typeSuffix = $2;
|
|
14255
|
+
return {
|
|
14256
|
+
type: "CatchParameter",
|
|
14257
|
+
binding,
|
|
14258
|
+
typeSuffix,
|
|
14259
|
+
children: $0
|
|
14260
|
+
};
|
|
14261
|
+
});
|
|
14262
|
+
var CatchParameter$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(ObjectBindingPattern, ArrayBindingPattern), TypeSuffix), function($skip, $loc, $0, $1, $2) {
|
|
14263
|
+
var binding = $1;
|
|
14264
|
+
var typeSuffix = $2;
|
|
14265
|
+
return {
|
|
14266
|
+
type: "CatchParameter",
|
|
14267
|
+
binding,
|
|
14268
|
+
typeSuffix,
|
|
14269
|
+
children: [binding, typeSuffix]
|
|
14270
|
+
};
|
|
14271
|
+
});
|
|
14272
|
+
var CatchParameter$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(PatternExpressionList), function($skip, $loc, $0, $1) {
|
|
14273
|
+
return {
|
|
14274
|
+
type: "CatchPattern",
|
|
14275
|
+
children: $0,
|
|
14276
|
+
patterns: $1
|
|
14277
|
+
};
|
|
14278
|
+
});
|
|
14279
|
+
var CatchParameter$$ = [CatchParameter$0, CatchParameter$1, CatchParameter$2];
|
|
14040
14280
|
function CatchParameter(ctx, state2) {
|
|
14041
14281
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchParameter", CatchParameter$$);
|
|
14042
14282
|
}
|
|
@@ -14140,8 +14380,8 @@ var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib4.$TS
|
|
|
14140
14380
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
14141
14381
|
return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
|
|
14142
14382
|
}
|
|
14143
|
-
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication,
|
|
14144
|
-
var exp = $
|
|
14383
|
+
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib4.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14384
|
+
var exp = $3;
|
|
14145
14385
|
if (exp)
|
|
14146
14386
|
return exp;
|
|
14147
14387
|
return $skip;
|
|
@@ -14530,36 +14770,41 @@ var ImportDeclaration$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, Id
|
|
|
14530
14770
|
children: [imp, $0.slice(1)]
|
|
14531
14771
|
};
|
|
14532
14772
|
});
|
|
14533
|
-
var ImportDeclaration$1 = (0, import_lib4.$
|
|
14534
|
-
var
|
|
14535
|
-
var
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
var
|
|
14539
|
-
var
|
|
14540
|
-
var imports = $6;
|
|
14541
|
-
var from = $8;
|
|
14773
|
+
var ImportDeclaration$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(Import, __), ImpliedImport), Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
14774
|
+
var i = $1;
|
|
14775
|
+
var behavior = $3;
|
|
14776
|
+
var ws1 = $4;
|
|
14777
|
+
var imports = $5;
|
|
14778
|
+
var ws2 = $6;
|
|
14779
|
+
var from = $7;
|
|
14542
14780
|
imports.specifiers.forEach((spec) => {
|
|
14543
14781
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
14544
14782
|
});
|
|
14545
14783
|
return {
|
|
14546
14784
|
type: "ImportDeclaration",
|
|
14547
|
-
children: [
|
|
14548
|
-
// omit $
|
|
14785
|
+
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
14786
|
+
// omit $2 = Operator and $3 = OperatorBehavior
|
|
14549
14787
|
imports,
|
|
14550
14788
|
from
|
|
14551
14789
|
};
|
|
14552
14790
|
});
|
|
14553
|
-
var ImportDeclaration$
|
|
14554
|
-
var
|
|
14555
|
-
var
|
|
14556
|
-
|
|
14791
|
+
var ImportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
14792
|
+
var t = $3;
|
|
14793
|
+
var imports = $4;
|
|
14794
|
+
var from = $6;
|
|
14795
|
+
return {
|
|
14796
|
+
type: "ImportDeclaration",
|
|
14797
|
+
children: $0,
|
|
14798
|
+
imports,
|
|
14799
|
+
from,
|
|
14800
|
+
ts: !!t
|
|
14801
|
+
};
|
|
14557
14802
|
});
|
|
14558
|
-
var ImportDeclaration$
|
|
14803
|
+
var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
|
|
14559
14804
|
var module2 = value[2];
|
|
14560
14805
|
return { "type": "ImportDeclaration", "children": value, "module": module2 };
|
|
14561
14806
|
});
|
|
14562
|
-
var ImportDeclaration$
|
|
14807
|
+
var ImportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14563
14808
|
var i = $1;
|
|
14564
14809
|
var t = $2;
|
|
14565
14810
|
var imports = $3;
|
|
@@ -14572,22 +14817,40 @@ var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport
|
|
|
14572
14817
|
const children = [i, t, imports, w, from];
|
|
14573
14818
|
return { type: "ImportDeclaration", ts: !!t, children, imports, from };
|
|
14574
14819
|
});
|
|
14575
|
-
var ImportDeclaration$
|
|
14576
|
-
var
|
|
14577
|
-
var
|
|
14578
|
-
var
|
|
14579
|
-
var
|
|
14820
|
+
var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
14821
|
+
var from = $1;
|
|
14822
|
+
var fws = $2;
|
|
14823
|
+
var i = $3;
|
|
14824
|
+
var iws = $4;
|
|
14825
|
+
var behavior = $6;
|
|
14826
|
+
var ows = $7;
|
|
14827
|
+
var imports = $8;
|
|
14580
14828
|
imports.specifiers.forEach((spec) => {
|
|
14581
14829
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
14582
14830
|
});
|
|
14583
14831
|
return {
|
|
14584
14832
|
type: "ImportDeclaration",
|
|
14585
|
-
children: [
|
|
14586
|
-
// omit
|
|
14833
|
+
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
14834
|
+
// omit Operator and OperatorBehavior
|
|
14587
14835
|
imports,
|
|
14588
14836
|
from
|
|
14589
14837
|
};
|
|
14590
14838
|
});
|
|
14839
|
+
var ImportDeclaration$6 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
14840
|
+
var from = $1;
|
|
14841
|
+
var fws = $2;
|
|
14842
|
+
var i = $3;
|
|
14843
|
+
var iws = $4;
|
|
14844
|
+
var t = $5;
|
|
14845
|
+
var imports = $6;
|
|
14846
|
+
return {
|
|
14847
|
+
type: "ImportDeclaration",
|
|
14848
|
+
children: [i, iws, t, imports, fws, from],
|
|
14849
|
+
imports,
|
|
14850
|
+
from,
|
|
14851
|
+
ts: !!t
|
|
14852
|
+
};
|
|
14853
|
+
});
|
|
14591
14854
|
var ImportDeclaration$$ = [ImportDeclaration$0, ImportDeclaration$1, ImportDeclaration$2, ImportDeclaration$3, ImportDeclaration$4, ImportDeclaration$5, ImportDeclaration$6];
|
|
14592
14855
|
function ImportDeclaration(ctx, state2) {
|
|
14593
14856
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ImportDeclaration", ImportDeclaration$$);
|
|
@@ -14672,6 +14935,21 @@ var FromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(From, __, ModuleSpec
|
|
|
14672
14935
|
function FromClause(ctx, state2) {
|
|
14673
14936
|
return (0, import_lib4.$EVENT)(ctx, state2, "FromClause", FromClause$0);
|
|
14674
14937
|
}
|
|
14938
|
+
var ImpliedFromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(From, __), ImpliedFrom), ModuleSpecifier), function($skip, $loc, $0, $1, $2) {
|
|
14939
|
+
var module2 = $2;
|
|
14940
|
+
if (!Array.isArray(module2))
|
|
14941
|
+
return $0;
|
|
14942
|
+
return [$1, ...module2];
|
|
14943
|
+
});
|
|
14944
|
+
function ImpliedFromClause(ctx, state2) {
|
|
14945
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFromClause", ImpliedFromClause$0);
|
|
14946
|
+
}
|
|
14947
|
+
var ImpliedFrom$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($L0, 'ImpliedFrom ""'), function($skip, $loc, $0, $1) {
|
|
14948
|
+
return { $loc, token: "from " };
|
|
14949
|
+
});
|
|
14950
|
+
function ImpliedFrom(ctx, state2) {
|
|
14951
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFrom", ImpliedFrom$0);
|
|
14952
|
+
}
|
|
14675
14953
|
var ImportAssertion$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), (0, import_lib4.$C)((0, import_lib4.$EXPECT)($L124, 'ImportAssertion "with"'), (0, import_lib4.$EXPECT)($L125, 'ImportAssertion "assert"')), NonIdContinue, (0, import_lib4.$E)(_), ObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14676
14954
|
var keyword = $2;
|
|
14677
14955
|
var object = $5;
|
|
@@ -14804,7 +15082,7 @@ var UnprocessedModuleSpecifier$$ = [UnprocessedModuleSpecifier$0, UnprocessedMod
|
|
|
14804
15082
|
function UnprocessedModuleSpecifier(ctx, state2) {
|
|
14805
15083
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "UnprocessedModuleSpecifier", UnprocessedModuleSpecifier$$);
|
|
14806
15084
|
}
|
|
14807
|
-
var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s]+/'), function($skip, $loc, $0, $1) {
|
|
15085
|
+
var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s=>]+/'), function($skip, $loc, $0, $1) {
|
|
14808
15086
|
var spec = $0;
|
|
14809
15087
|
return { $loc, token: `"${spec}"` };
|
|
14810
15088
|
});
|
|
@@ -14857,13 +15135,26 @@ var ExportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_li
|
|
|
14857
15135
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
14858
15136
|
});
|
|
14859
15137
|
var ExportDeclaration$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14860
|
-
|
|
15138
|
+
var exports2 = $3;
|
|
15139
|
+
return { type: "ExportDeclaration", ts: exports2.ts, children: $0 };
|
|
14861
15140
|
});
|
|
14862
|
-
var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(
|
|
15141
|
+
var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Export, __, ExportFromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15142
|
+
var from = $1;
|
|
15143
|
+
var fws = $2;
|
|
15144
|
+
var e = $3;
|
|
15145
|
+
var ews = $4;
|
|
15146
|
+
var exports2 = $5;
|
|
15147
|
+
return {
|
|
15148
|
+
type: "ExportDeclaration",
|
|
15149
|
+
ts: exports2.ts,
|
|
15150
|
+
children: [e, ews, exports2, " ", from, trimFirstSpace(fws)]
|
|
15151
|
+
};
|
|
15152
|
+
});
|
|
15153
|
+
var ExportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(Decorators), Export, __, (0, import_lib4.$C)(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
14863
15154
|
var declaration = $4;
|
|
14864
15155
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
14865
15156
|
});
|
|
14866
|
-
var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4];
|
|
15157
|
+
var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4, ExportDeclaration$5];
|
|
14867
15158
|
function ExportDeclaration(ctx, state2) {
|
|
14868
15159
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ExportDeclaration", ExportDeclaration$$);
|
|
14869
15160
|
}
|
|
@@ -17442,6 +17733,19 @@ var MaybeNestedTypePrimary$$ = [MaybeNestedTypePrimary$0, MaybeNestedTypePrimary
|
|
|
17442
17733
|
function MaybeNestedTypePrimary(ctx, state2) {
|
|
17443
17734
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "MaybeNestedTypePrimary", MaybeNestedTypePrimary$$);
|
|
17444
17735
|
}
|
|
17736
|
+
var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
|
|
17737
|
+
var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
|
|
17738
|
+
var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
|
|
17739
|
+
var MaybeNestedTypeUnary$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(PushIndent, (0, import_lib4.$E)((0, import_lib4.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
17740
|
+
if (!$2)
|
|
17741
|
+
return $skip;
|
|
17742
|
+
return $2;
|
|
17743
|
+
});
|
|
17744
|
+
var MaybeNestedTypeUnary$4 = (0, import_lib4.$S)(NotDedented, TypeUnary);
|
|
17745
|
+
var MaybeNestedTypeUnary$$ = [MaybeNestedTypeUnary$0, MaybeNestedTypeUnary$1, MaybeNestedTypeUnary$2, MaybeNestedTypeUnary$3, MaybeNestedTypeUnary$4];
|
|
17746
|
+
function MaybeNestedTypeUnary(ctx, state2) {
|
|
17747
|
+
return (0, import_lib4.$EVENT_C)(ctx, state2, "MaybeNestedTypeUnary", MaybeNestedTypeUnary$$);
|
|
17748
|
+
}
|
|
17445
17749
|
var ReturnTypeSuffix$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), (0, import_lib4.$E)(QuestionMark), (0, import_lib4.$E)(_), Colon, ReturnType), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17446
17750
|
var optional = $2;
|
|
17447
17751
|
var t = $5;
|
|
@@ -17496,7 +17800,7 @@ var Type$0 = TypeWithPostfix;
|
|
|
17496
17800
|
function Type(ctx, state2) {
|
|
17497
17801
|
return (0, import_lib4.$EVENT)(ctx, state2, "Type", Type$0);
|
|
17498
17802
|
}
|
|
17499
|
-
var TypeBinary$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, __)), TypeUnary, (0, import_lib4.$Q)((0, import_lib4.$S)(NotDedented, TypeBinaryOp,
|
|
17803
|
+
var TypeBinary$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, __)), TypeUnary, (0, import_lib4.$Q)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, MaybeNestedTypeUnary))), function($skip, $loc, $0, $1, $2, $3) {
|
|
17500
17804
|
var optionalPrefix = $1;
|
|
17501
17805
|
var t = $2;
|
|
17502
17806
|
var ops = $3;
|