@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/browser.js
CHANGED
|
@@ -1067,6 +1067,9 @@ ${body}`;
|
|
|
1067
1067
|
expression = item;
|
|
1068
1068
|
}
|
|
1069
1069
|
if (isASTNodeObject(expression)) {
|
|
1070
|
+
if (expression.token) {
|
|
1071
|
+
return expression;
|
|
1072
|
+
}
|
|
1070
1073
|
if (expression.parenthesized) {
|
|
1071
1074
|
return expression;
|
|
1072
1075
|
}
|
|
@@ -1589,86 +1592,90 @@ ${body}`;
|
|
|
1589
1592
|
let count = 0;
|
|
1590
1593
|
switch (pattern.type) {
|
|
1591
1594
|
case "ArrayBindingPattern": {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1595
|
+
{
|
|
1596
|
+
const results = [];
|
|
1597
|
+
for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
|
|
1598
|
+
const elem = ref2[i2];
|
|
1599
|
+
let { typeSuffix } = elem;
|
|
1600
|
+
typeSuffix ??= elem.binding?.typeSuffix;
|
|
1601
|
+
if (typeSuffix) {
|
|
1602
|
+
count++;
|
|
1603
|
+
}
|
|
1604
|
+
let typeElement = [typeSuffix?.t, elem.delim];
|
|
1605
|
+
if (typeSuffix?.optional) {
|
|
1606
|
+
typeElement[0] = parenthesizeType(typeElement[0]);
|
|
1607
|
+
typeElement.unshift("undefined |");
|
|
1608
|
+
}
|
|
1609
|
+
if (elem.type === "BindingRestElement") {
|
|
1610
|
+
typeElement[0] ??= "unknown[]";
|
|
1611
|
+
typeElement.unshift(elem.dots);
|
|
1612
|
+
} else {
|
|
1613
|
+
typeElement[0] ??= "unknown";
|
|
1614
|
+
}
|
|
1615
|
+
results.push(typeElement);
|
|
1604
1616
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1617
|
+
;
|
|
1618
|
+
const types = results;
|
|
1619
|
+
if (count) {
|
|
1620
|
+
const t = [": [", types, "]"];
|
|
1621
|
+
pattern.typeSuffix = {
|
|
1622
|
+
type: "TypeSuffix",
|
|
1623
|
+
ts: true,
|
|
1624
|
+
t,
|
|
1625
|
+
children: [t]
|
|
1626
|
+
};
|
|
1610
1627
|
}
|
|
1611
|
-
results.push(typeElement);
|
|
1612
|
-
}
|
|
1613
|
-
;
|
|
1614
|
-
const types = results;
|
|
1615
|
-
if (count) {
|
|
1616
|
-
const t = [": [", types, "]"];
|
|
1617
|
-
pattern.typeSuffix = {
|
|
1618
|
-
type: "TypeSuffix",
|
|
1619
|
-
ts: true,
|
|
1620
|
-
t,
|
|
1621
|
-
children: [t]
|
|
1622
|
-
};
|
|
1623
1628
|
}
|
|
1624
1629
|
;
|
|
1625
1630
|
break;
|
|
1626
1631
|
}
|
|
1627
1632
|
case "ObjectBindingPattern": {
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
typeSuffix ??= {
|
|
1638
|
-
type: "TypeSuffix",
|
|
1639
|
-
ts: true,
|
|
1640
|
-
children: [": unknown"]
|
|
1641
|
-
};
|
|
1642
|
-
switch (prop.type) {
|
|
1643
|
-
case "BindingProperty": {
|
|
1644
|
-
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
1645
|
-
results1.push([...ws, prop.name, typeSuffix, prop.delim]);
|
|
1646
|
-
break;
|
|
1647
|
-
}
|
|
1648
|
-
case "AtBindingProperty": {
|
|
1649
|
-
const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
|
|
1650
|
-
results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
|
|
1651
|
-
break;
|
|
1633
|
+
{
|
|
1634
|
+
let restType;
|
|
1635
|
+
const results1 = [];
|
|
1636
|
+
for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
|
|
1637
|
+
const prop = ref3[i3];
|
|
1638
|
+
let { typeSuffix } = prop;
|
|
1639
|
+
typeSuffix ??= prop.value?.typeSuffix;
|
|
1640
|
+
if (typeSuffix) {
|
|
1641
|
+
count++;
|
|
1652
1642
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1643
|
+
typeSuffix ??= {
|
|
1644
|
+
type: "TypeSuffix",
|
|
1645
|
+
ts: true,
|
|
1646
|
+
children: [": unknown"]
|
|
1647
|
+
};
|
|
1648
|
+
switch (prop.type) {
|
|
1649
|
+
case "BindingProperty": {
|
|
1650
|
+
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
1651
|
+
results1.push([...ws, prop.name, typeSuffix, prop.delim]);
|
|
1652
|
+
break;
|
|
1653
|
+
}
|
|
1654
|
+
case "AtBindingProperty": {
|
|
1655
|
+
const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
|
|
1656
|
+
results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
|
|
1657
|
+
break;
|
|
1658
|
+
}
|
|
1659
|
+
case "BindingRestProperty": {
|
|
1660
|
+
restType = prop.typeSuffix?.t;
|
|
1661
|
+
continue;
|
|
1662
|
+
}
|
|
1656
1663
|
}
|
|
1657
1664
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
+
;
|
|
1666
|
+
const types = results1;
|
|
1667
|
+
if (count) {
|
|
1668
|
+
const t = ["{", types, "}"];
|
|
1669
|
+
if (restType != null) {
|
|
1670
|
+
t.push(" & ", parenthesizeType(trimFirstSpace(restType)));
|
|
1671
|
+
}
|
|
1672
|
+
pattern.typeSuffix = {
|
|
1673
|
+
type: "TypeSuffix",
|
|
1674
|
+
ts: true,
|
|
1675
|
+
t,
|
|
1676
|
+
children: [": ", t]
|
|
1677
|
+
};
|
|
1665
1678
|
}
|
|
1666
|
-
pattern.typeSuffix = {
|
|
1667
|
-
type: "TypeSuffix",
|
|
1668
|
-
ts: true,
|
|
1669
|
-
t,
|
|
1670
|
-
children: [": ", t]
|
|
1671
|
-
};
|
|
1672
1679
|
}
|
|
1673
1680
|
;
|
|
1674
1681
|
break;
|
|
@@ -1753,6 +1760,34 @@ ${body}`;
|
|
|
1753
1760
|
"\n"
|
|
1754
1761
|
]]);
|
|
1755
1762
|
},
|
|
1763
|
+
rslice(rsliceRef) {
|
|
1764
|
+
const RSliceable = makeRef("RSliceable");
|
|
1765
|
+
state.prelude.push(["", [
|
|
1766
|
+
ts(["type ", RSliceable, "<R> = string | {length: number; slice(start: number, end: number): {reverse(): R}}\n"]),
|
|
1767
|
+
preludeVar,
|
|
1768
|
+
rsliceRef,
|
|
1769
|
+
ts([": <R, T extends string | ", RSliceable, "<R>>(a: T, start?: number, end?: number) => T extends string ? string : T extends ", RSliceable, "<infer R> ? R : never"]),
|
|
1770
|
+
" = ((a, start, end) => {\n",
|
|
1771
|
+
" const l = a.length\n",
|
|
1772
|
+
" start = ",
|
|
1773
|
+
getHelperRef("modulo"),
|
|
1774
|
+
"(start ?? -1, l)\n",
|
|
1775
|
+
" end = ",
|
|
1776
|
+
getHelperRef("modulo"),
|
|
1777
|
+
"((end ?? -1) + 1, l)\n",
|
|
1778
|
+
" if (typeof a === 'string') {\n",
|
|
1779
|
+
` let r = ""
|
|
1780
|
+
`,
|
|
1781
|
+
" for (let i = start; i >= end; --i) r += a[i]\n",
|
|
1782
|
+
" return r",
|
|
1783
|
+
asAny,
|
|
1784
|
+
"\n",
|
|
1785
|
+
" } else {\n",
|
|
1786
|
+
" return a.slice(end, start + 1).reverse()\n",
|
|
1787
|
+
" }\n",
|
|
1788
|
+
"});\n"
|
|
1789
|
+
]]);
|
|
1790
|
+
},
|
|
1756
1791
|
div(divRef) {
|
|
1757
1792
|
state.prelude.push(["", [
|
|
1758
1793
|
// [indent, statement]
|
|
@@ -1879,6 +1914,9 @@ ${body}`;
|
|
|
1879
1914
|
declareHelper[base](ref);
|
|
1880
1915
|
return state.helperRefs[base] = ref;
|
|
1881
1916
|
}
|
|
1917
|
+
function peekHelperRef(base) {
|
|
1918
|
+
return state.helperRefs[base];
|
|
1919
|
+
}
|
|
1882
1920
|
function extractPreludeFor(node) {
|
|
1883
1921
|
let helpers = new Set(Object.values(state.helperRefs));
|
|
1884
1922
|
helpers = new Set(gatherRecursive(node, helpers.has.bind(helpers)));
|
|
@@ -5825,7 +5863,131 @@ ${js}`
|
|
|
5825
5863
|
return [value, value.thisShorthand];
|
|
5826
5864
|
}
|
|
5827
5865
|
function processTryBlock($0) {
|
|
5828
|
-
let [t, , b,
|
|
5866
|
+
let [t, , b, cs, e, f] = $0;
|
|
5867
|
+
let c;
|
|
5868
|
+
let m;
|
|
5869
|
+
if (cs.some(($) => (m = $.binding?.parameter, typeof m === "object" && m != null && "type" in m && m.type === "CatchPattern"))) {
|
|
5870
|
+
const ref = makeRef("e");
|
|
5871
|
+
const binding = {
|
|
5872
|
+
type: "CatchBinding",
|
|
5873
|
+
children: ["(", ref, ")"],
|
|
5874
|
+
parameter: ref
|
|
5875
|
+
};
|
|
5876
|
+
const condition = {
|
|
5877
|
+
type: "ParenthesizedExpression",
|
|
5878
|
+
children: ["(", ref, ")"],
|
|
5879
|
+
expression: ref
|
|
5880
|
+
};
|
|
5881
|
+
let defaultClause = false;
|
|
5882
|
+
const clauses = cs.map((clause) => {
|
|
5883
|
+
let ref1;
|
|
5884
|
+
if ((ref1 = clause.binding?.parameter) && typeof ref1 === "object" && "type" in ref1 && ref1.type === "CatchPattern" && "patterns" in ref1) {
|
|
5885
|
+
const { type, patterns } = ref1;
|
|
5886
|
+
return {
|
|
5887
|
+
type: "PatternClause",
|
|
5888
|
+
patterns,
|
|
5889
|
+
block: clause.block,
|
|
5890
|
+
children: [patterns, clause.block]
|
|
5891
|
+
};
|
|
5892
|
+
} else {
|
|
5893
|
+
defaultClause = true;
|
|
5894
|
+
const parameter = clause.binding?.parameter;
|
|
5895
|
+
if (parameter != null) {
|
|
5896
|
+
assert.equal(
|
|
5897
|
+
parameter.type,
|
|
5898
|
+
"CatchParameter",
|
|
5899
|
+
`Invalid catch parameter ${parameter.type}`
|
|
5900
|
+
);
|
|
5901
|
+
const { binding: pattern, typeSuffix } = parameter;
|
|
5902
|
+
const initializer = {
|
|
5903
|
+
type: "Initializer",
|
|
5904
|
+
expression: ref,
|
|
5905
|
+
children: ["", " = ", ref]
|
|
5906
|
+
};
|
|
5907
|
+
const bindings = [{
|
|
5908
|
+
type: "Binding",
|
|
5909
|
+
names: pattern.names,
|
|
5910
|
+
pattern,
|
|
5911
|
+
typeSuffix,
|
|
5912
|
+
initializer,
|
|
5913
|
+
children: [pattern, typeSuffix, initializer],
|
|
5914
|
+
splices: [],
|
|
5915
|
+
thisAssignments: []
|
|
5916
|
+
}];
|
|
5917
|
+
clause.block.expressions.unshift(["", {
|
|
5918
|
+
type: "Declaration",
|
|
5919
|
+
children: ["let", " ", bindings],
|
|
5920
|
+
bindings,
|
|
5921
|
+
names: bindings[0].names,
|
|
5922
|
+
decl: "let"
|
|
5923
|
+
}, ";"]);
|
|
5924
|
+
}
|
|
5925
|
+
return {
|
|
5926
|
+
type: "DefaultClause",
|
|
5927
|
+
block: clause.block,
|
|
5928
|
+
children: ["default: ", clause.block]
|
|
5929
|
+
};
|
|
5930
|
+
}
|
|
5931
|
+
});
|
|
5932
|
+
if (!defaultClause) {
|
|
5933
|
+
const expressions = [[
|
|
5934
|
+
"",
|
|
5935
|
+
{
|
|
5936
|
+
type: "ThrowStatement",
|
|
5937
|
+
children: ["throw", " ", ref]
|
|
5938
|
+
}
|
|
5939
|
+
]];
|
|
5940
|
+
const block2 = {
|
|
5941
|
+
type: "BlockStatement",
|
|
5942
|
+
expressions,
|
|
5943
|
+
children: [" {", expressions, "}"],
|
|
5944
|
+
bare: false
|
|
5945
|
+
};
|
|
5946
|
+
clauses.push({
|
|
5947
|
+
type: "DefaultClause",
|
|
5948
|
+
block: block2,
|
|
5949
|
+
children: ["default: ", block2]
|
|
5950
|
+
});
|
|
5951
|
+
}
|
|
5952
|
+
const caseBlock = {
|
|
5953
|
+
type: "CaseBlock",
|
|
5954
|
+
clauses,
|
|
5955
|
+
children: [" {", clauses, "}"]
|
|
5956
|
+
};
|
|
5957
|
+
const patternSwitch = {
|
|
5958
|
+
type: "SwitchStatement",
|
|
5959
|
+
condition,
|
|
5960
|
+
caseBlock,
|
|
5961
|
+
children: ["switch", condition, caseBlock]
|
|
5962
|
+
};
|
|
5963
|
+
const block = {
|
|
5964
|
+
type: "BlockStatement",
|
|
5965
|
+
bare: false,
|
|
5966
|
+
expressions: [["", patternSwitch]],
|
|
5967
|
+
children: [" {", patternSwitch, "}"]
|
|
5968
|
+
};
|
|
5969
|
+
c = makeNode({
|
|
5970
|
+
type: "CatchClause",
|
|
5971
|
+
children: [
|
|
5972
|
+
cs[0].children[0],
|
|
5973
|
+
// whitespace
|
|
5974
|
+
cs[0].children[1],
|
|
5975
|
+
// catch token
|
|
5976
|
+
binding,
|
|
5977
|
+
block
|
|
5978
|
+
],
|
|
5979
|
+
binding,
|
|
5980
|
+
block
|
|
5981
|
+
});
|
|
5982
|
+
} else {
|
|
5983
|
+
c = cs[0];
|
|
5984
|
+
if (cs.length > 1) {
|
|
5985
|
+
c = append(c, {
|
|
5986
|
+
type: "Error",
|
|
5987
|
+
message: "Only one catch clause allowed unless using pattern matching"
|
|
5988
|
+
});
|
|
5989
|
+
}
|
|
5990
|
+
}
|
|
5829
5991
|
if (!c && (e || !f)) {
|
|
5830
5992
|
const emptyCatchBlock = makeEmptyBlock();
|
|
5831
5993
|
c = {
|
|
@@ -5924,8 +6086,9 @@ ${js}`
|
|
|
5924
6086
|
}
|
|
5925
6087
|
}
|
|
5926
6088
|
}
|
|
5927
|
-
for (let
|
|
5928
|
-
const
|
|
6089
|
+
for (let i3 = 0, len22 = children.length; i3 < len22; i3++) {
|
|
6090
|
+
const i = i3;
|
|
6091
|
+
const glob = children[i3];
|
|
5929
6092
|
if (glob?.type === "PropertyGlob") {
|
|
5930
6093
|
let prefix = children.slice(0, i);
|
|
5931
6094
|
const parts = [];
|
|
@@ -5996,14 +6159,14 @@ ${js}`
|
|
|
5996
6159
|
});
|
|
5997
6160
|
}
|
|
5998
6161
|
}
|
|
5999
|
-
let
|
|
6162
|
+
let ref2;
|
|
6000
6163
|
let object = {
|
|
6001
6164
|
type: "ObjectExpression",
|
|
6002
6165
|
children: [
|
|
6003
6166
|
glob.object.children[0],
|
|
6004
6167
|
// {
|
|
6005
6168
|
...parts,
|
|
6006
|
-
(
|
|
6169
|
+
(ref2 = glob.object.children)[ref2.length - 1]
|
|
6007
6170
|
// whitespace and }
|
|
6008
6171
|
],
|
|
6009
6172
|
properties: parts,
|
|
@@ -6045,6 +6208,33 @@ ${js}`
|
|
|
6045
6208
|
...children.slice(i + 1)
|
|
6046
6209
|
]
|
|
6047
6210
|
});
|
|
6211
|
+
} else if (typeof glob === "object" && glob != null && "type" in glob && glob.type === "SliceExpression" && "reversed" in glob && glob.reversed === true) {
|
|
6212
|
+
const args = [
|
|
6213
|
+
{ ...node, children: node.children.slice(0, i) },
|
|
6214
|
+
{ ...glob.children[0], token: ", " },
|
|
6215
|
+
...glob.children.slice(1, -1)
|
|
6216
|
+
];
|
|
6217
|
+
let ref3;
|
|
6218
|
+
return makeNode({
|
|
6219
|
+
...node,
|
|
6220
|
+
children: [
|
|
6221
|
+
{
|
|
6222
|
+
type: "CallExpression",
|
|
6223
|
+
children: [
|
|
6224
|
+
getHelperRef("rslice"),
|
|
6225
|
+
makeNode({
|
|
6226
|
+
type: "Call",
|
|
6227
|
+
args,
|
|
6228
|
+
children: [
|
|
6229
|
+
"(",
|
|
6230
|
+
args,
|
|
6231
|
+
(ref3 = glob.children)[ref3.length - 1]
|
|
6232
|
+
]
|
|
6233
|
+
})
|
|
6234
|
+
]
|
|
6235
|
+
}
|
|
6236
|
+
]
|
|
6237
|
+
});
|
|
6048
6238
|
}
|
|
6049
6239
|
}
|
|
6050
6240
|
return node;
|
|
@@ -6055,9 +6245,9 @@ ${js}`
|
|
|
6055
6245
|
throw new Error("replaceNode failed: node has no parent");
|
|
6056
6246
|
}
|
|
6057
6247
|
function recurse(children) {
|
|
6058
|
-
for (let
|
|
6059
|
-
const i =
|
|
6060
|
-
const child = children[
|
|
6248
|
+
for (let i4 = 0, len3 = children.length; i4 < len3; i4++) {
|
|
6249
|
+
const i = i4;
|
|
6250
|
+
const child = children[i4];
|
|
6061
6251
|
if (child === node) {
|
|
6062
6252
|
children[i] = newNode;
|
|
6063
6253
|
return true;
|
|
@@ -6149,8 +6339,8 @@ ${js}`
|
|
|
6149
6339
|
return { type: "Error", message: "cannot use `type` in dynamic import" };
|
|
6150
6340
|
} else {
|
|
6151
6341
|
const { source, binding } = specifier;
|
|
6152
|
-
let
|
|
6153
|
-
const delim = (
|
|
6342
|
+
let ref4;
|
|
6343
|
+
const delim = (ref4 = specifier.children)[ref4.length - 1];
|
|
6154
6344
|
return {
|
|
6155
6345
|
type: pattern ? "BindingProperty" : "Property",
|
|
6156
6346
|
name: source,
|
|
@@ -6160,7 +6350,7 @@ ${js}`
|
|
|
6160
6350
|
};
|
|
6161
6351
|
}
|
|
6162
6352
|
});
|
|
6163
|
-
let
|
|
6353
|
+
let ref5;
|
|
6164
6354
|
return {
|
|
6165
6355
|
type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
|
|
6166
6356
|
names: node.names,
|
|
@@ -6169,7 +6359,7 @@ ${js}`
|
|
|
6169
6359
|
node.children[0],
|
|
6170
6360
|
// {
|
|
6171
6361
|
properties,
|
|
6172
|
-
(
|
|
6362
|
+
(ref5 = node.children)[ref5.length - 1]
|
|
6173
6363
|
// }
|
|
6174
6364
|
]
|
|
6175
6365
|
};
|
|
@@ -6275,8 +6465,8 @@ ${js}`
|
|
|
6275
6465
|
while (expr.type === "ParenthesizedExpression") {
|
|
6276
6466
|
expr = expr.expression;
|
|
6277
6467
|
}
|
|
6278
|
-
let
|
|
6279
|
-
if (
|
|
6468
|
+
let m1;
|
|
6469
|
+
if (m1 = expr.type, m1 === "AssignmentExpression" || m1 === "UpdateExpression") {
|
|
6280
6470
|
if (expr.type === "UpdateExpression" && expr.children[0] === expr.assigned) {
|
|
6281
6471
|
pre.push("(");
|
|
6282
6472
|
post.push([", ", lhs, ")"]);
|
|
@@ -6290,15 +6480,15 @@ ${js}`
|
|
|
6290
6480
|
return;
|
|
6291
6481
|
}
|
|
6292
6482
|
const pre = [], post = [];
|
|
6293
|
-
let
|
|
6483
|
+
let ref6;
|
|
6294
6484
|
switch (exp.type) {
|
|
6295
6485
|
case "AssignmentExpression": {
|
|
6296
6486
|
if (!exp.lhs)
|
|
6297
6487
|
return;
|
|
6298
6488
|
exp.lhs.forEach((lhsPart, i) => {
|
|
6299
|
-
let
|
|
6300
|
-
if (
|
|
6301
|
-
const newLhs =
|
|
6489
|
+
let ref7;
|
|
6490
|
+
if (ref7 = extractAssignment(lhsPart[1])) {
|
|
6491
|
+
const newLhs = ref7;
|
|
6302
6492
|
return lhsPart[1] = newLhs;
|
|
6303
6493
|
}
|
|
6304
6494
|
;
|
|
@@ -6307,8 +6497,8 @@ ${js}`
|
|
|
6307
6497
|
break;
|
|
6308
6498
|
}
|
|
6309
6499
|
case "UpdateExpression": {
|
|
6310
|
-
if (
|
|
6311
|
-
const newLhs =
|
|
6500
|
+
if (ref6 = extractAssignment(exp.assigned)) {
|
|
6501
|
+
const newLhs = ref6;
|
|
6312
6502
|
const i = exp.children.indexOf(exp.assigned);
|
|
6313
6503
|
exp.assigned = exp.children[i] = newLhs;
|
|
6314
6504
|
}
|
|
@@ -6324,7 +6514,7 @@ ${js}`
|
|
|
6324
6514
|
const { assigned } = exp;
|
|
6325
6515
|
const ref = makeRef();
|
|
6326
6516
|
const newMemberExp = unchainOptionalMemberExpression(assigned, ref, (children) => {
|
|
6327
|
-
return exp.children.map(($) => $ === assigned ? children : $);
|
|
6517
|
+
return exp.children.map(($3) => $3 === assigned ? children : $3);
|
|
6328
6518
|
});
|
|
6329
6519
|
if (newMemberExp !== assigned) {
|
|
6330
6520
|
if (newMemberExp.usesRef) {
|
|
@@ -6348,23 +6538,23 @@ ${js}`
|
|
|
6348
6538
|
(exp) => {
|
|
6349
6539
|
let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
|
|
6350
6540
|
let block;
|
|
6351
|
-
let
|
|
6352
|
-
if (exp.parent?.type === "BlockStatement" && !(
|
|
6541
|
+
let ref8;
|
|
6542
|
+
if (exp.parent?.type === "BlockStatement" && !(ref8 = $1[$1.length - 1])?.[ref8.length - 1]?.special) {
|
|
6353
6543
|
block = makeBlockFragment();
|
|
6354
|
-
let
|
|
6355
|
-
if (
|
|
6544
|
+
let ref9;
|
|
6545
|
+
if (ref9 = prependStatementExpressionBlock(
|
|
6356
6546
|
{ type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
|
|
6357
6547
|
block
|
|
6358
6548
|
)) {
|
|
6359
|
-
const ref =
|
|
6360
|
-
exp.children = exp.children.map(($
|
|
6549
|
+
const ref = ref9;
|
|
6550
|
+
exp.children = exp.children.map(($4) => $4 === $2 ? ref : $4);
|
|
6361
6551
|
$2 = ref;
|
|
6362
6552
|
} else {
|
|
6363
6553
|
block = void 0;
|
|
6364
6554
|
}
|
|
6365
6555
|
}
|
|
6366
|
-
let
|
|
6367
|
-
if ($1.some(($
|
|
6556
|
+
let ref10;
|
|
6557
|
+
if ($1.some(($5) => (ref10 = $5)[ref10.length - 1].special)) {
|
|
6368
6558
|
if ($1.length !== 1)
|
|
6369
6559
|
throw new Error("Only one assignment with id= is allowed");
|
|
6370
6560
|
const [, lhs, , op] = $1[0];
|
|
@@ -6389,8 +6579,8 @@ ${js}`
|
|
|
6389
6579
|
if (!(op.token === "=")) {
|
|
6390
6580
|
continue;
|
|
6391
6581
|
}
|
|
6392
|
-
let
|
|
6393
|
-
if (
|
|
6582
|
+
let m2;
|
|
6583
|
+
if (m2 = lhs.type, m2 === "ObjectExpression" || m2 === "ObjectBindingPattern") {
|
|
6394
6584
|
if (!wrapped) {
|
|
6395
6585
|
wrapped = true;
|
|
6396
6586
|
lhs.children.splice(0, 0, "(");
|
|
@@ -6404,10 +6594,17 @@ ${js}`
|
|
|
6404
6594
|
const lastAssignment = $1[i];
|
|
6405
6595
|
if (lastAssignment[3].token === "=") {
|
|
6406
6596
|
const lhs = lastAssignment[1];
|
|
6407
|
-
let
|
|
6597
|
+
let m3;
|
|
6408
6598
|
if (lhs.type === "MemberExpression") {
|
|
6409
6599
|
const members = lhs.children;
|
|
6410
6600
|
const lastMember = members[members.length - 1];
|
|
6601
|
+
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")) {
|
|
6602
|
+
lastMember.children.push({
|
|
6603
|
+
type: "Error",
|
|
6604
|
+
message: "Slice range cannot be decreasing in assignment"
|
|
6605
|
+
});
|
|
6606
|
+
break;
|
|
6607
|
+
}
|
|
6411
6608
|
if (lastMember.type === "SliceExpression") {
|
|
6412
6609
|
const { start, end, children: c } = lastMember;
|
|
6413
6610
|
c[0].token = ".splice(";
|
|
@@ -6430,9 +6627,9 @@ ${js}`
|
|
|
6430
6627
|
exp.names = [];
|
|
6431
6628
|
break;
|
|
6432
6629
|
}
|
|
6433
|
-
} else if (
|
|
6630
|
+
} else if (m3 = lhs.type, m3 === "ObjectBindingPattern" || m3 === "ArrayBindingPattern") {
|
|
6434
6631
|
processBindingPatternLHS(lhs, tail);
|
|
6435
|
-
gatherRecursiveAll(lhs, ($
|
|
6632
|
+
gatherRecursiveAll(lhs, ($6) => $6.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
|
|
6436
6633
|
}
|
|
6437
6634
|
}
|
|
6438
6635
|
i--;
|
|
@@ -6465,7 +6662,7 @@ ${js}`
|
|
|
6465
6662
|
}
|
|
6466
6663
|
if (refsToDeclare.size) {
|
|
6467
6664
|
if (exp.hoistDec) {
|
|
6468
|
-
exp.hoistDec.children.push([...refsToDeclare].map(($
|
|
6665
|
+
exp.hoistDec.children.push([...refsToDeclare].map(($7) => [",", $7]));
|
|
6469
6666
|
} else {
|
|
6470
6667
|
exp.hoistDec = {
|
|
6471
6668
|
type: "Declaration",
|
|
@@ -6539,9 +6736,9 @@ ${js}`
|
|
|
6539
6736
|
}
|
|
6540
6737
|
j++;
|
|
6541
6738
|
}
|
|
6542
|
-
let
|
|
6543
|
-
if (
|
|
6544
|
-
const l =
|
|
6739
|
+
let ref11;
|
|
6740
|
+
if (ref11 = conditions.length) {
|
|
6741
|
+
const l = ref11;
|
|
6545
6742
|
const cs = flatJoin(conditions, " && ");
|
|
6546
6743
|
return {
|
|
6547
6744
|
...exp,
|
|
@@ -6580,27 +6777,27 @@ ${js}`
|
|
|
6580
6777
|
if (!unary.suffix.length) {
|
|
6581
6778
|
return;
|
|
6582
6779
|
}
|
|
6583
|
-
let
|
|
6584
|
-
let
|
|
6585
|
-
if (
|
|
6586
|
-
const { token } =
|
|
6780
|
+
let ref12;
|
|
6781
|
+
let m4;
|
|
6782
|
+
if (m4 = (ref12 = unary.suffix)[ref12.length - 1], typeof m4 === "object" && m4 != null && "token" in m4 && m4.token === "?") {
|
|
6783
|
+
const { token } = m4;
|
|
6587
6784
|
let last;
|
|
6588
6785
|
let count = 0;
|
|
6589
|
-
let
|
|
6590
|
-
while (unary.suffix.length && (
|
|
6786
|
+
let ref13;
|
|
6787
|
+
while (unary.suffix.length && (ref13 = unary.suffix)[ref13.length - 1]?.token === "?") {
|
|
6591
6788
|
last = unary.suffix.pop();
|
|
6592
6789
|
count++;
|
|
6593
6790
|
}
|
|
6594
|
-
let
|
|
6595
|
-
while (unary.suffix.length && (
|
|
6791
|
+
let ref14;
|
|
6792
|
+
while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
|
|
6596
6793
|
unary.suffix.pop();
|
|
6597
6794
|
}
|
|
6598
|
-
let
|
|
6795
|
+
let ref15;
|
|
6599
6796
|
if (unary.suffix.length || unary.prefix.length)
|
|
6600
|
-
|
|
6797
|
+
ref15 = unary;
|
|
6601
6798
|
else
|
|
6602
|
-
|
|
6603
|
-
const t =
|
|
6799
|
+
ref15 = unary.t;
|
|
6800
|
+
const t = ref15;
|
|
6604
6801
|
if (unary.parent?.type === "TypeTuple") {
|
|
6605
6802
|
if (count === 1) {
|
|
6606
6803
|
unary.suffix.push(last);
|
|
@@ -6626,14 +6823,14 @@ ${js}`
|
|
|
6626
6823
|
]
|
|
6627
6824
|
});
|
|
6628
6825
|
}
|
|
6629
|
-
} else if (typeof
|
|
6630
|
-
const { type } =
|
|
6631
|
-
let
|
|
6632
|
-
while (unary.suffix.length && (
|
|
6826
|
+
} else if (typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "NonNullAssertion") {
|
|
6827
|
+
const { type } = m4;
|
|
6828
|
+
let ref16;
|
|
6829
|
+
while (unary.suffix.length && (ref16 = unary.suffix)[ref16.length - 1]?.type === "NonNullAssertion") {
|
|
6633
6830
|
unary.suffix.pop();
|
|
6634
6831
|
}
|
|
6635
|
-
let
|
|
6636
|
-
while (unary.suffix.length && (
|
|
6832
|
+
let ref17;
|
|
6833
|
+
while (unary.suffix.length && (ref17 = unary.suffix)[ref17.length - 1]?.token === "?") {
|
|
6637
6834
|
unary.suffix.pop();
|
|
6638
6835
|
}
|
|
6639
6836
|
const t = trimFirstSpace(
|
|
@@ -6659,14 +6856,14 @@ ${js}`
|
|
|
6659
6856
|
});
|
|
6660
6857
|
}
|
|
6661
6858
|
function processStatementExpressions(statements) {
|
|
6662
|
-
gatherRecursiveAll(statements, ($
|
|
6859
|
+
gatherRecursiveAll(statements, ($8) => $8.type === "StatementExpression").forEach((_exp) => {
|
|
6663
6860
|
const exp = _exp;
|
|
6664
6861
|
const { statement } = exp;
|
|
6665
|
-
let
|
|
6862
|
+
let ref18;
|
|
6666
6863
|
switch (statement.type) {
|
|
6667
6864
|
case "IfStatement": {
|
|
6668
|
-
if (
|
|
6669
|
-
const expression =
|
|
6865
|
+
if (ref18 = expressionizeIfStatement(statement)) {
|
|
6866
|
+
const expression = ref18;
|
|
6670
6867
|
return replaceNode(statement, expression, exp);
|
|
6671
6868
|
} else {
|
|
6672
6869
|
return replaceNode(statement, wrapIIFE([["", statement]]), exp);
|
|
@@ -6735,7 +6932,7 @@ ${js}`
|
|
|
6735
6932
|
if (config2.iife || config2.repl) {
|
|
6736
6933
|
rootIIFE = wrapIIFE(root.expressions, root.topLevelAwait);
|
|
6737
6934
|
const newExpressions = [["", rootIIFE]];
|
|
6738
|
-
root.children = root.children.map(($
|
|
6935
|
+
root.children = root.children.map(($9) => $9 === root.expressions ? newExpressions : $9);
|
|
6739
6936
|
root.expressions = newExpressions;
|
|
6740
6937
|
}
|
|
6741
6938
|
addParentPointers(root);
|
|
@@ -6775,17 +6972,17 @@ ${js}`
|
|
|
6775
6972
|
await processComptime(statements);
|
|
6776
6973
|
}
|
|
6777
6974
|
function processRepl(root, rootIIFE) {
|
|
6778
|
-
const topBlock = gatherRecursive(rootIIFE, ($
|
|
6975
|
+
const topBlock = gatherRecursive(rootIIFE, ($10) => $10.type === "BlockStatement")[0];
|
|
6779
6976
|
let i = 0;
|
|
6780
|
-
for (let
|
|
6781
|
-
const decl =
|
|
6977
|
+
for (let ref19 = gatherRecursiveWithinFunction(topBlock, ($11) => $11.type === "Declaration"), i5 = 0, len4 = ref19.length; i5 < len4; i5++) {
|
|
6978
|
+
const decl = ref19[i5];
|
|
6782
6979
|
if (decl.parent === topBlock || decl.decl === "var") {
|
|
6783
6980
|
decl.children.shift();
|
|
6784
6981
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")};`]);
|
|
6785
6982
|
}
|
|
6786
6983
|
}
|
|
6787
|
-
for (let
|
|
6788
|
-
const func =
|
|
6984
|
+
for (let ref20 = gatherRecursive(topBlock, ($12) => $12.type === "FunctionExpression"), i6 = 0, len5 = ref20.length; i6 < len5; i6++) {
|
|
6985
|
+
const func = ref20[i6];
|
|
6789
6986
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
6790
6987
|
if (func.parent === topBlock) {
|
|
6791
6988
|
replaceNode(func, void 0);
|
|
@@ -6797,17 +6994,17 @@ ${js}`
|
|
|
6797
6994
|
}
|
|
6798
6995
|
}
|
|
6799
6996
|
}
|
|
6800
|
-
for (let
|
|
6801
|
-
const classExp =
|
|
6802
|
-
let
|
|
6803
|
-
if (classExp.name && classExp.parent === topBlock || (
|
|
6997
|
+
for (let ref21 = gatherRecursiveWithinFunction(topBlock, ($13) => $13.type === "ClassExpression"), i7 = 0, len6 = ref21.length; i7 < len6; i7++) {
|
|
6998
|
+
const classExp = ref21[i7];
|
|
6999
|
+
let m5;
|
|
7000
|
+
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)) {
|
|
6804
7001
|
classExp.children.unshift(classExp.name, "=");
|
|
6805
7002
|
root.expressions.splice(i++, 0, ["", `var ${classExp.name};`]);
|
|
6806
7003
|
}
|
|
6807
7004
|
}
|
|
6808
7005
|
}
|
|
6809
7006
|
function populateRefs(statements) {
|
|
6810
|
-
const refNodes = gatherRecursive(statements, ($
|
|
7007
|
+
const refNodes = gatherRecursive(statements, ($14) => $14.type === "Ref");
|
|
6811
7008
|
if (refNodes.length) {
|
|
6812
7009
|
const ids = gatherRecursive(statements, (s) => s.type === "Identifier");
|
|
6813
7010
|
const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
|
|
@@ -6830,11 +7027,11 @@ ${js}`
|
|
|
6830
7027
|
function processPlaceholders(statements) {
|
|
6831
7028
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
6832
7029
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
6833
|
-
gatherRecursiveAll(statements, ($
|
|
7030
|
+
gatherRecursiveAll(statements, ($15) => $15.type === "Placeholder").forEach((_exp) => {
|
|
6834
7031
|
const exp = _exp;
|
|
6835
7032
|
let ancestor;
|
|
6836
7033
|
if (exp.subtype === ".") {
|
|
6837
|
-
({ ancestor } = findAncestor(exp, ($
|
|
7034
|
+
({ ancestor } = findAncestor(exp, ($16) => $16.type === "Call"));
|
|
6838
7035
|
ancestor = ancestor?.parent;
|
|
6839
7036
|
while (ancestor?.parent?.type === "UnaryExpression" || ancestor?.parent?.type === "NewExpression") {
|
|
6840
7037
|
ancestor = ancestor.parent;
|
|
@@ -6853,10 +7050,10 @@ ${js}`
|
|
|
6853
7050
|
if (type === "IfStatement") {
|
|
6854
7051
|
liftedIfs.add(ancestor2);
|
|
6855
7052
|
}
|
|
6856
|
-
let m5;
|
|
6857
7053
|
let m6;
|
|
7054
|
+
let m7;
|
|
6858
7055
|
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
6859
|
-
type === "BlockStatement" && !((
|
|
7056
|
+
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
|
|
6860
7057
|
type === "Initializer" || // Right-hand side of assignment
|
|
6861
7058
|
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
6862
7059
|
}));
|
|
@@ -6932,11 +7129,11 @@ ${js}`
|
|
|
6932
7129
|
for (const [ancestor, placeholders] of placeholderMap) {
|
|
6933
7130
|
let ref = makeRef("$");
|
|
6934
7131
|
let typeSuffix;
|
|
6935
|
-
for (let
|
|
6936
|
-
const placeholder = placeholders[
|
|
7132
|
+
for (let i8 = 0, len7 = placeholders.length; i8 < len7; i8++) {
|
|
7133
|
+
const placeholder = placeholders[i8];
|
|
6937
7134
|
typeSuffix ??= placeholder.typeSuffix;
|
|
6938
|
-
let
|
|
6939
|
-
replaceNode((
|
|
7135
|
+
let ref22;
|
|
7136
|
+
replaceNode((ref22 = placeholder.children)[ref22.length - 1], ref);
|
|
6940
7137
|
}
|
|
6941
7138
|
const { parent } = ancestor;
|
|
6942
7139
|
const body = maybeUnwrap(ancestor);
|
|
@@ -6957,16 +7154,16 @@ ${js}`
|
|
|
6957
7154
|
}
|
|
6958
7155
|
case "PipelineExpression": {
|
|
6959
7156
|
const i = findChildIndex(parent, ancestor);
|
|
6960
|
-
let
|
|
7157
|
+
let ref23;
|
|
6961
7158
|
if (i === 1) {
|
|
6962
|
-
|
|
7159
|
+
ref23 = ancestor === parent.children[i];
|
|
6963
7160
|
} else if (i === 2) {
|
|
6964
|
-
|
|
7161
|
+
ref23 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
|
|
6965
7162
|
} else {
|
|
6966
|
-
|
|
7163
|
+
ref23 = void 0;
|
|
6967
7164
|
}
|
|
6968
7165
|
;
|
|
6969
|
-
outer =
|
|
7166
|
+
outer = ref23;
|
|
6970
7167
|
break;
|
|
6971
7168
|
}
|
|
6972
7169
|
case "AssignmentExpression":
|
|
@@ -6981,9 +7178,9 @@ ${js}`
|
|
|
6981
7178
|
fnExp = makeLeftHandSideExpression(fnExp);
|
|
6982
7179
|
}
|
|
6983
7180
|
replaceNode(ancestor, fnExp, parent);
|
|
6984
|
-
let
|
|
6985
|
-
if (
|
|
6986
|
-
const ws =
|
|
7181
|
+
let ref24;
|
|
7182
|
+
if (ref24 = getTrimmingSpace(body)) {
|
|
7183
|
+
const ws = ref24;
|
|
6987
7184
|
inplaceInsertTrimmingSpace(body, "");
|
|
6988
7185
|
inplacePrepend(ws, fnExp);
|
|
6989
7186
|
}
|
|
@@ -7028,8 +7225,8 @@ ${js}`
|
|
|
7028
7225
|
}
|
|
7029
7226
|
];
|
|
7030
7227
|
}
|
|
7031
|
-
let
|
|
7032
|
-
if (Array.isArray(rest.delim) && (
|
|
7228
|
+
let ref25;
|
|
7229
|
+
if (Array.isArray(rest.delim) && (ref25 = rest.delim)[ref25.length - 1]?.token === ",") {
|
|
7033
7230
|
rest.delim = rest.delim.slice(0, -1);
|
|
7034
7231
|
rest.children = [...rest.children.slice(0, -1), rest.delim];
|
|
7035
7232
|
}
|
|
@@ -7054,9 +7251,9 @@ ${js}`
|
|
|
7054
7251
|
return root;
|
|
7055
7252
|
}
|
|
7056
7253
|
}
|
|
7057
|
-
for (let
|
|
7058
|
-
const i =
|
|
7059
|
-
const node = array[
|
|
7254
|
+
for (let i9 = 0, len8 = array.length; i9 < len8; i9++) {
|
|
7255
|
+
const i = i9;
|
|
7256
|
+
const node = array[i9];
|
|
7060
7257
|
if (!(node != null)) {
|
|
7061
7258
|
return;
|
|
7062
7259
|
}
|
|
@@ -7080,9 +7277,9 @@ ${js}`
|
|
|
7080
7277
|
return root;
|
|
7081
7278
|
}
|
|
7082
7279
|
}
|
|
7083
|
-
for (let
|
|
7084
|
-
const i =
|
|
7085
|
-
const node = array[
|
|
7280
|
+
for (let i10 = 0, len9 = array.length; i10 < len9; i10++) {
|
|
7281
|
+
const i = i10;
|
|
7282
|
+
const node = array[i10];
|
|
7086
7283
|
if (!(node != null)) {
|
|
7087
7284
|
continue;
|
|
7088
7285
|
}
|
|
@@ -7500,7 +7697,7 @@ ${js}`
|
|
|
7500
7697
|
IgnoreColon,
|
|
7501
7698
|
TryStatement,
|
|
7502
7699
|
CatchClause,
|
|
7503
|
-
|
|
7700
|
+
CatchBinding,
|
|
7504
7701
|
FinallyClause,
|
|
7505
7702
|
CatchParameter,
|
|
7506
7703
|
Condition,
|
|
@@ -7560,6 +7757,8 @@ ${js}`
|
|
|
7560
7757
|
NamedImports,
|
|
7561
7758
|
OperatorNamedImports,
|
|
7562
7759
|
FromClause,
|
|
7760
|
+
ImpliedFromClause,
|
|
7761
|
+
ImpliedFrom,
|
|
7563
7762
|
ImportAssertion,
|
|
7564
7763
|
TypeAndImportSpecifier,
|
|
7565
7764
|
ImportSpecifier,
|
|
@@ -7844,6 +8043,7 @@ ${js}`
|
|
|
7844
8043
|
TypeSuffix,
|
|
7845
8044
|
MaybeNestedType,
|
|
7846
8045
|
MaybeNestedTypePrimary,
|
|
8046
|
+
MaybeNestedTypeUnary,
|
|
7847
8047
|
ReturnTypeSuffix,
|
|
7848
8048
|
ReturnType,
|
|
7849
8049
|
TypePredicate,
|
|
@@ -8243,7 +8443,7 @@ ${js}`
|
|
|
8243
8443
|
var $R29 = (0, import_lib4.$R)(new RegExp("[:.]", "suy"));
|
|
8244
8444
|
var $R30 = (0, import_lib4.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy"));
|
|
8245
8445
|
var $R31 = (0, import_lib4.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy"));
|
|
8246
|
-
var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s]+', "suy"));
|
|
8446
|
+
var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s=>]+', "suy"));
|
|
8247
8447
|
var $R33 = (0, import_lib4.$R)(new RegExp("(?=[0-9.])", "suy"));
|
|
8248
8448
|
var $R34 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy"));
|
|
8249
8449
|
var $R35 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy"));
|
|
@@ -9752,14 +9952,22 @@ ${js}`
|
|
|
9752
9952
|
var CallExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9753
9953
|
return dynamizeImportDeclarationExpression($0);
|
|
9754
9954
|
});
|
|
9755
|
-
var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(
|
|
9955
|
+
var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(FromClause, __, Import, _, NamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9956
|
+
var from = $1;
|
|
9957
|
+
var fws = $2;
|
|
9958
|
+
var i = $3;
|
|
9959
|
+
var iws = $4;
|
|
9960
|
+
var imports = $5;
|
|
9961
|
+
return dynamizeImportDeclarationExpression([i, iws, imports, fws, from]);
|
|
9962
|
+
});
|
|
9963
|
+
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) {
|
|
9756
9964
|
var rest = $3;
|
|
9757
9965
|
return processCallMemberExpression({
|
|
9758
9966
|
type: "CallExpression",
|
|
9759
9967
|
children: [$1, ...$2, ...rest.flat()]
|
|
9760
9968
|
});
|
|
9761
9969
|
});
|
|
9762
|
-
var CallExpression$
|
|
9970
|
+
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) {
|
|
9763
9971
|
var member = $1;
|
|
9764
9972
|
var trailing = $2;
|
|
9765
9973
|
var rest = $3;
|
|
@@ -9772,7 +9980,7 @@ ${js}`
|
|
|
9772
9980
|
}
|
|
9773
9981
|
return member;
|
|
9774
9982
|
});
|
|
9775
|
-
var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3];
|
|
9983
|
+
var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3, CallExpression$4];
|
|
9776
9984
|
function CallExpression(ctx, state2) {
|
|
9777
9985
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "CallExpression", CallExpression$$);
|
|
9778
9986
|
}
|
|
@@ -9902,11 +10110,12 @@ ${js}`
|
|
|
9902
10110
|
var ws = $3;
|
|
9903
10111
|
var close = $4;
|
|
9904
10112
|
if (expression.type === "SliceParameters") {
|
|
9905
|
-
const { start, end, children } = expression;
|
|
10113
|
+
const { start, end, reversed, children } = expression;
|
|
9906
10114
|
return {
|
|
9907
10115
|
type: "SliceExpression",
|
|
9908
10116
|
start,
|
|
9909
10117
|
end,
|
|
10118
|
+
reversed,
|
|
9910
10119
|
children: [
|
|
9911
10120
|
{ ...open, token: ".slice(" },
|
|
9912
10121
|
...children,
|
|
@@ -9923,78 +10132,57 @@ ${js}`
|
|
|
9923
10132
|
function MemberBracketContent(ctx, state2) {
|
|
9924
10133
|
return (0, import_lib4.$EVENT)(ctx, state2, "MemberBracketContent", MemberBracketContent$0);
|
|
9925
10134
|
}
|
|
9926
|
-
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) {
|
|
9927
|
-
var
|
|
9928
|
-
var
|
|
9929
|
-
var
|
|
9930
|
-
var
|
|
10135
|
+
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) {
|
|
10136
|
+
var ls = $1;
|
|
10137
|
+
var start = $2;
|
|
10138
|
+
var ws = $3;
|
|
10139
|
+
var dots = $4;
|
|
10140
|
+
var le = $5;
|
|
10141
|
+
var end = $6;
|
|
10142
|
+
const reversed = dots.increasing === false;
|
|
10143
|
+
const sign = reversed ? "-" : "+";
|
|
9931
10144
|
let children;
|
|
10145
|
+
start ??= {
|
|
10146
|
+
$loc: ls.$loc,
|
|
10147
|
+
token: reversed ? "-1" : "0"
|
|
10148
|
+
};
|
|
10149
|
+
if (!end) {
|
|
10150
|
+
if (reversed) {
|
|
10151
|
+
end = {
|
|
10152
|
+
$loc: le.$loc,
|
|
10153
|
+
token: "0"
|
|
10154
|
+
};
|
|
10155
|
+
} else if (!dots.right.inclusive && !dots.triple) {
|
|
10156
|
+
end = {
|
|
10157
|
+
$loc: le.$loc,
|
|
10158
|
+
token: "-1"
|
|
10159
|
+
};
|
|
10160
|
+
}
|
|
10161
|
+
}
|
|
9932
10162
|
if (!dots.left.inclusive) {
|
|
9933
|
-
start = [
|
|
10163
|
+
start = [makeLeftHandSideExpression(start), ` ${sign} 1`];
|
|
9934
10164
|
}
|
|
9935
10165
|
if (end) {
|
|
9936
10166
|
const inc = [];
|
|
9937
10167
|
if (dots.right.inclusive) {
|
|
9938
|
-
end = [
|
|
9939
|
-
|
|
10168
|
+
end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
|
|
10169
|
+
if (!reversed)
|
|
10170
|
+
inc.push(" || 1/0");
|
|
9940
10171
|
}
|
|
9941
10172
|
children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
|
|
9942
10173
|
} else {
|
|
9943
10174
|
children = [start, ws];
|
|
9944
10175
|
}
|
|
9945
|
-
if (dots.increasing === false) {
|
|
9946
|
-
children.push({
|
|
9947
|
-
type: "Error",
|
|
9948
|
-
message: "Slice range cannot be decreasing",
|
|
9949
|
-
$loc: dots.$loc
|
|
9950
|
-
});
|
|
9951
|
-
}
|
|
9952
10176
|
return {
|
|
9953
10177
|
type: "SliceParameters",
|
|
9954
10178
|
start,
|
|
9955
10179
|
end,
|
|
10180
|
+
reversed,
|
|
9956
10181
|
children
|
|
9957
10182
|
};
|
|
9958
10183
|
});
|
|
9959
|
-
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) {
|
|
9960
|
-
var l = $1;
|
|
9961
|
-
var ws = $2;
|
|
9962
|
-
var sep = $3;
|
|
9963
|
-
var end = $4;
|
|
9964
|
-
const inclusive = sep.token === "..";
|
|
9965
|
-
const inc = [];
|
|
9966
|
-
if (inclusive) {
|
|
9967
|
-
end = ["1 + ", end];
|
|
9968
|
-
inc.push(" || 1/0");
|
|
9969
|
-
}
|
|
9970
|
-
const start = {
|
|
9971
|
-
$loc: l.$loc,
|
|
9972
|
-
token: "0"
|
|
9973
|
-
};
|
|
9974
|
-
return {
|
|
9975
|
-
type: "SliceParameters",
|
|
9976
|
-
start,
|
|
9977
|
-
end,
|
|
9978
|
-
children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
|
|
9979
|
-
};
|
|
9980
|
-
});
|
|
9981
|
-
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) {
|
|
9982
|
-
var l = $1;
|
|
9983
|
-
var ws = $2;
|
|
9984
|
-
const start = {
|
|
9985
|
-
$loc: l.$loc,
|
|
9986
|
-
token: "0"
|
|
9987
|
-
};
|
|
9988
|
-
return {
|
|
9989
|
-
type: "SliceParameters",
|
|
9990
|
-
start,
|
|
9991
|
-
end: void 0,
|
|
9992
|
-
children: [start, ws]
|
|
9993
|
-
};
|
|
9994
|
-
});
|
|
9995
|
-
var SliceParameters$$ = [SliceParameters$0, SliceParameters$1, SliceParameters$2];
|
|
9996
10184
|
function SliceParameters(ctx, state2) {
|
|
9997
|
-
return (0, import_lib4.$
|
|
10185
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "SliceParameters", SliceParameters$0);
|
|
9998
10186
|
}
|
|
9999
10187
|
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) {
|
|
10000
10188
|
var modifier = $1;
|
|
@@ -11663,6 +11851,7 @@ ${js}`
|
|
|
11663
11851
|
left: { inclusive: true, raw: "" },
|
|
11664
11852
|
right: { inclusive: false, raw: "." },
|
|
11665
11853
|
increasing: void 0,
|
|
11854
|
+
triple: true,
|
|
11666
11855
|
children: []
|
|
11667
11856
|
};
|
|
11668
11857
|
});
|
|
@@ -13821,9 +14010,12 @@ ${js}`
|
|
|
13821
14010
|
function ForBinding(ctx, state2) {
|
|
13822
14011
|
return (0, import_lib4.$EVENT)(ctx, state2, "ForBinding", ForBinding$0);
|
|
13823
14012
|
}
|
|
13824
|
-
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) {
|
|
13825
|
-
var
|
|
13826
|
-
var
|
|
14013
|
+
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) {
|
|
14014
|
+
var s = $1;
|
|
14015
|
+
var condition = $3;
|
|
14016
|
+
var caseBlock = $5;
|
|
14017
|
+
if (!condition)
|
|
14018
|
+
return $skip;
|
|
13827
14019
|
if (condition.type === "EmptyCondition") {
|
|
13828
14020
|
caseBlock.clauses.forEach(({ cases }) => {
|
|
13829
14021
|
if (cases) {
|
|
@@ -13843,7 +14035,8 @@ ${js}`
|
|
|
13843
14035
|
}
|
|
13844
14036
|
return {
|
|
13845
14037
|
type: "SwitchStatement",
|
|
13846
|
-
children:
|
|
14038
|
+
children: [s, condition, caseBlock],
|
|
14039
|
+
// omit NewlineBinaryOp control
|
|
13847
14040
|
condition,
|
|
13848
14041
|
caseBlock
|
|
13849
14042
|
};
|
|
@@ -13940,12 +14133,14 @@ ${js}`
|
|
|
13940
14133
|
};
|
|
13941
14134
|
});
|
|
13942
14135
|
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) {
|
|
14136
|
+
var e = $1;
|
|
14137
|
+
var colon = $2;
|
|
13943
14138
|
var block = $3;
|
|
13944
|
-
|
|
14139
|
+
e = { ...e, token: "default" };
|
|
13945
14140
|
return {
|
|
13946
14141
|
type: "DefaultClause",
|
|
13947
14142
|
block,
|
|
13948
|
-
children:
|
|
14143
|
+
children: [e, colon, block]
|
|
13949
14144
|
};
|
|
13950
14145
|
});
|
|
13951
14146
|
var CaseClause$$ = [CaseClause$0, CaseClause$1, CaseClause$2, CaseClause$3, CaseClause$4];
|
|
@@ -14016,36 +14211,56 @@ ${js}`
|
|
|
14016
14211
|
function IgnoreColon(ctx, state2) {
|
|
14017
14212
|
return (0, import_lib4.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
|
|
14018
14213
|
}
|
|
14019
|
-
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.$
|
|
14214
|
+
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) {
|
|
14020
14215
|
return processTryBlock($0);
|
|
14021
14216
|
});
|
|
14022
14217
|
function TryStatement(ctx, state2) {
|
|
14023
14218
|
return (0, import_lib4.$EVENT)(ctx, state2, "TryStatement", TryStatement$0);
|
|
14024
14219
|
}
|
|
14025
|
-
var CatchClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Catch, (0, import_lib4.$E)(
|
|
14220
|
+
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) {
|
|
14221
|
+
var binding = $3;
|
|
14026
14222
|
var block = $4;
|
|
14027
14223
|
return {
|
|
14028
14224
|
type: "CatchClause",
|
|
14029
14225
|
children: $0,
|
|
14030
|
-
block
|
|
14226
|
+
block,
|
|
14227
|
+
binding
|
|
14031
14228
|
};
|
|
14032
14229
|
});
|
|
14033
14230
|
function CatchClause(ctx, state2) {
|
|
14034
14231
|
return (0, import_lib4.$EVENT)(ctx, state2, "CatchClause", CatchClause$0);
|
|
14035
14232
|
}
|
|
14036
|
-
var
|
|
14037
|
-
|
|
14233
|
+
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) {
|
|
14234
|
+
var ws1 = $1;
|
|
14235
|
+
var open = $2;
|
|
14236
|
+
var ws2 = $3;
|
|
14237
|
+
var parameter = $5;
|
|
14238
|
+
var ws3 = $7;
|
|
14239
|
+
var close = $8;
|
|
14240
|
+
if (!parameter)
|
|
14241
|
+
return $skip;
|
|
14242
|
+
return {
|
|
14243
|
+
type: "CatchBinding",
|
|
14244
|
+
parameter,
|
|
14245
|
+
children: [ws1, open, ws2, parameter, ws3, close]
|
|
14246
|
+
};
|
|
14247
|
+
});
|
|
14248
|
+
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) {
|
|
14038
14249
|
var ws = $1;
|
|
14039
14250
|
var open = $2;
|
|
14040
|
-
var
|
|
14251
|
+
var parameter = $5;
|
|
14041
14252
|
var close = $7;
|
|
14042
|
-
if (!
|
|
14253
|
+
if (!parameter)
|
|
14043
14254
|
return $skip;
|
|
14044
|
-
return
|
|
14255
|
+
return {
|
|
14256
|
+
type: "CatchBinding",
|
|
14257
|
+
parameter,
|
|
14258
|
+
children: [ws, open, parameter, close]
|
|
14259
|
+
};
|
|
14045
14260
|
});
|
|
14046
|
-
var
|
|
14047
|
-
function
|
|
14048
|
-
return (0, import_lib4.$EVENT_C)(ctx, state2, "
|
|
14261
|
+
var CatchBinding$$ = [CatchBinding$0, CatchBinding$1];
|
|
14262
|
+
function CatchBinding(ctx, state2) {
|
|
14263
|
+
return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchBinding", CatchBinding$$);
|
|
14049
14264
|
}
|
|
14050
14265
|
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) {
|
|
14051
14266
|
var block = $3;
|
|
@@ -14058,9 +14273,34 @@ ${js}`
|
|
|
14058
14273
|
function FinallyClause(ctx, state2) {
|
|
14059
14274
|
return (0, import_lib4.$EVENT)(ctx, state2, "FinallyClause", FinallyClause$0);
|
|
14060
14275
|
}
|
|
14061
|
-
var CatchParameter$0 = (0, import_lib4.$S)(BindingIdentifier, (0, import_lib4.$E)(TypeSuffix))
|
|
14062
|
-
|
|
14063
|
-
|
|
14276
|
+
var CatchParameter$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(BindingIdentifier, (0, import_lib4.$E)(TypeSuffix)), function($skip, $loc, $0, $1, $2) {
|
|
14277
|
+
var binding = $1;
|
|
14278
|
+
var typeSuffix = $2;
|
|
14279
|
+
return {
|
|
14280
|
+
type: "CatchParameter",
|
|
14281
|
+
binding,
|
|
14282
|
+
typeSuffix,
|
|
14283
|
+
children: $0
|
|
14284
|
+
};
|
|
14285
|
+
});
|
|
14286
|
+
var CatchParameter$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(ObjectBindingPattern, ArrayBindingPattern), TypeSuffix), function($skip, $loc, $0, $1, $2) {
|
|
14287
|
+
var binding = $1;
|
|
14288
|
+
var typeSuffix = $2;
|
|
14289
|
+
return {
|
|
14290
|
+
type: "CatchParameter",
|
|
14291
|
+
binding,
|
|
14292
|
+
typeSuffix,
|
|
14293
|
+
children: [binding, typeSuffix]
|
|
14294
|
+
};
|
|
14295
|
+
});
|
|
14296
|
+
var CatchParameter$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(PatternExpressionList), function($skip, $loc, $0, $1) {
|
|
14297
|
+
return {
|
|
14298
|
+
type: "CatchPattern",
|
|
14299
|
+
children: $0,
|
|
14300
|
+
patterns: $1
|
|
14301
|
+
};
|
|
14302
|
+
});
|
|
14303
|
+
var CatchParameter$$ = [CatchParameter$0, CatchParameter$1, CatchParameter$2];
|
|
14064
14304
|
function CatchParameter(ctx, state2) {
|
|
14065
14305
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchParameter", CatchParameter$$);
|
|
14066
14306
|
}
|
|
@@ -14164,8 +14404,8 @@ ${js}`
|
|
|
14164
14404
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
14165
14405
|
return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
|
|
14166
14406
|
}
|
|
14167
|
-
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication,
|
|
14168
|
-
var exp = $
|
|
14407
|
+
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) {
|
|
14408
|
+
var exp = $3;
|
|
14169
14409
|
if (exp)
|
|
14170
14410
|
return exp;
|
|
14171
14411
|
return $skip;
|
|
@@ -14554,36 +14794,41 @@ ${js}`
|
|
|
14554
14794
|
children: [imp, $0.slice(1)]
|
|
14555
14795
|
};
|
|
14556
14796
|
});
|
|
14557
|
-
var ImportDeclaration$1 = (0, import_lib4.$
|
|
14558
|
-
var
|
|
14559
|
-
var
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
var
|
|
14564
|
-
var imports = $6;
|
|
14565
|
-
var from = $8;
|
|
14797
|
+
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) {
|
|
14798
|
+
var i = $1;
|
|
14799
|
+
var behavior = $3;
|
|
14800
|
+
var ws1 = $4;
|
|
14801
|
+
var imports = $5;
|
|
14802
|
+
var ws2 = $6;
|
|
14803
|
+
var from = $7;
|
|
14566
14804
|
imports.specifiers.forEach((spec) => {
|
|
14567
14805
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
14568
14806
|
});
|
|
14569
14807
|
return {
|
|
14570
14808
|
type: "ImportDeclaration",
|
|
14571
|
-
children: [
|
|
14572
|
-
// omit $
|
|
14809
|
+
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
14810
|
+
// omit $2 = Operator and $3 = OperatorBehavior
|
|
14573
14811
|
imports,
|
|
14574
14812
|
from
|
|
14575
14813
|
};
|
|
14576
14814
|
});
|
|
14577
|
-
var ImportDeclaration$
|
|
14578
|
-
var
|
|
14579
|
-
var
|
|
14580
|
-
|
|
14815
|
+
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) {
|
|
14816
|
+
var t = $3;
|
|
14817
|
+
var imports = $4;
|
|
14818
|
+
var from = $6;
|
|
14819
|
+
return {
|
|
14820
|
+
type: "ImportDeclaration",
|
|
14821
|
+
children: $0,
|
|
14822
|
+
imports,
|
|
14823
|
+
from,
|
|
14824
|
+
ts: !!t
|
|
14825
|
+
};
|
|
14581
14826
|
});
|
|
14582
|
-
var ImportDeclaration$
|
|
14827
|
+
var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
|
|
14583
14828
|
var module = value[2];
|
|
14584
14829
|
return { "type": "ImportDeclaration", "children": value, "module": module };
|
|
14585
14830
|
});
|
|
14586
|
-
var ImportDeclaration$
|
|
14831
|
+
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) {
|
|
14587
14832
|
var i = $1;
|
|
14588
14833
|
var t = $2;
|
|
14589
14834
|
var imports = $3;
|
|
@@ -14596,22 +14841,40 @@ ${js}`
|
|
|
14596
14841
|
const children = [i, t, imports, w, from];
|
|
14597
14842
|
return { type: "ImportDeclaration", ts: !!t, children, imports, from };
|
|
14598
14843
|
});
|
|
14599
|
-
var ImportDeclaration$
|
|
14600
|
-
var
|
|
14601
|
-
var
|
|
14602
|
-
var
|
|
14603
|
-
var
|
|
14844
|
+
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) {
|
|
14845
|
+
var from = $1;
|
|
14846
|
+
var fws = $2;
|
|
14847
|
+
var i = $3;
|
|
14848
|
+
var iws = $4;
|
|
14849
|
+
var behavior = $6;
|
|
14850
|
+
var ows = $7;
|
|
14851
|
+
var imports = $8;
|
|
14604
14852
|
imports.specifiers.forEach((spec) => {
|
|
14605
14853
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
14606
14854
|
});
|
|
14607
14855
|
return {
|
|
14608
14856
|
type: "ImportDeclaration",
|
|
14609
|
-
children: [
|
|
14610
|
-
// omit
|
|
14857
|
+
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
14858
|
+
// omit Operator and OperatorBehavior
|
|
14611
14859
|
imports,
|
|
14612
14860
|
from
|
|
14613
14861
|
};
|
|
14614
14862
|
});
|
|
14863
|
+
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) {
|
|
14864
|
+
var from = $1;
|
|
14865
|
+
var fws = $2;
|
|
14866
|
+
var i = $3;
|
|
14867
|
+
var iws = $4;
|
|
14868
|
+
var t = $5;
|
|
14869
|
+
var imports = $6;
|
|
14870
|
+
return {
|
|
14871
|
+
type: "ImportDeclaration",
|
|
14872
|
+
children: [i, iws, t, imports, fws, from],
|
|
14873
|
+
imports,
|
|
14874
|
+
from,
|
|
14875
|
+
ts: !!t
|
|
14876
|
+
};
|
|
14877
|
+
});
|
|
14615
14878
|
var ImportDeclaration$$ = [ImportDeclaration$0, ImportDeclaration$1, ImportDeclaration$2, ImportDeclaration$3, ImportDeclaration$4, ImportDeclaration$5, ImportDeclaration$6];
|
|
14616
14879
|
function ImportDeclaration(ctx, state2) {
|
|
14617
14880
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ImportDeclaration", ImportDeclaration$$);
|
|
@@ -14696,6 +14959,21 @@ ${js}`
|
|
|
14696
14959
|
function FromClause(ctx, state2) {
|
|
14697
14960
|
return (0, import_lib4.$EVENT)(ctx, state2, "FromClause", FromClause$0);
|
|
14698
14961
|
}
|
|
14962
|
+
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) {
|
|
14963
|
+
var module = $2;
|
|
14964
|
+
if (!Array.isArray(module))
|
|
14965
|
+
return $0;
|
|
14966
|
+
return [$1, ...module];
|
|
14967
|
+
});
|
|
14968
|
+
function ImpliedFromClause(ctx, state2) {
|
|
14969
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFromClause", ImpliedFromClause$0);
|
|
14970
|
+
}
|
|
14971
|
+
var ImpliedFrom$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($L0, 'ImpliedFrom ""'), function($skip, $loc, $0, $1) {
|
|
14972
|
+
return { $loc, token: "from " };
|
|
14973
|
+
});
|
|
14974
|
+
function ImpliedFrom(ctx, state2) {
|
|
14975
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFrom", ImpliedFrom$0);
|
|
14976
|
+
}
|
|
14699
14977
|
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) {
|
|
14700
14978
|
var keyword = $2;
|
|
14701
14979
|
var object = $5;
|
|
@@ -14828,7 +15106,7 @@ ${js}`
|
|
|
14828
15106
|
function UnprocessedModuleSpecifier(ctx, state2) {
|
|
14829
15107
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "UnprocessedModuleSpecifier", UnprocessedModuleSpecifier$$);
|
|
14830
15108
|
}
|
|
14831
|
-
var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s]+/'), function($skip, $loc, $0, $1) {
|
|
15109
|
+
var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s=>]+/'), function($skip, $loc, $0, $1) {
|
|
14832
15110
|
var spec = $0;
|
|
14833
15111
|
return { $loc, token: `"${spec}"` };
|
|
14834
15112
|
});
|
|
@@ -14881,13 +15159,26 @@ ${js}`
|
|
|
14881
15159
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
14882
15160
|
});
|
|
14883
15161
|
var ExportDeclaration$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14884
|
-
|
|
15162
|
+
var exports = $3;
|
|
15163
|
+
return { type: "ExportDeclaration", ts: exports.ts, children: $0 };
|
|
14885
15164
|
});
|
|
14886
|
-
var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(
|
|
15165
|
+
var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Export, __, ExportFromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15166
|
+
var from = $1;
|
|
15167
|
+
var fws = $2;
|
|
15168
|
+
var e = $3;
|
|
15169
|
+
var ews = $4;
|
|
15170
|
+
var exports = $5;
|
|
15171
|
+
return {
|
|
15172
|
+
type: "ExportDeclaration",
|
|
15173
|
+
ts: exports.ts,
|
|
15174
|
+
children: [e, ews, exports, " ", from, trimFirstSpace(fws)]
|
|
15175
|
+
};
|
|
15176
|
+
});
|
|
15177
|
+
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) {
|
|
14887
15178
|
var declaration = $4;
|
|
14888
15179
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
14889
15180
|
});
|
|
14890
|
-
var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4];
|
|
15181
|
+
var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4, ExportDeclaration$5];
|
|
14891
15182
|
function ExportDeclaration(ctx, state2) {
|
|
14892
15183
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ExportDeclaration", ExportDeclaration$$);
|
|
14893
15184
|
}
|
|
@@ -17466,6 +17757,19 @@ ${js}`
|
|
|
17466
17757
|
function MaybeNestedTypePrimary(ctx, state2) {
|
|
17467
17758
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "MaybeNestedTypePrimary", MaybeNestedTypePrimary$$);
|
|
17468
17759
|
}
|
|
17760
|
+
var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
|
|
17761
|
+
var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
|
|
17762
|
+
var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
|
|
17763
|
+
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) {
|
|
17764
|
+
if (!$2)
|
|
17765
|
+
return $skip;
|
|
17766
|
+
return $2;
|
|
17767
|
+
});
|
|
17768
|
+
var MaybeNestedTypeUnary$4 = (0, import_lib4.$S)(NotDedented, TypeUnary);
|
|
17769
|
+
var MaybeNestedTypeUnary$$ = [MaybeNestedTypeUnary$0, MaybeNestedTypeUnary$1, MaybeNestedTypeUnary$2, MaybeNestedTypeUnary$3, MaybeNestedTypeUnary$4];
|
|
17770
|
+
function MaybeNestedTypeUnary(ctx, state2) {
|
|
17771
|
+
return (0, import_lib4.$EVENT_C)(ctx, state2, "MaybeNestedTypeUnary", MaybeNestedTypeUnary$$);
|
|
17772
|
+
}
|
|
17469
17773
|
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) {
|
|
17470
17774
|
var optional = $2;
|
|
17471
17775
|
var t = $5;
|
|
@@ -17520,7 +17824,7 @@ ${js}`
|
|
|
17520
17824
|
function Type(ctx, state2) {
|
|
17521
17825
|
return (0, import_lib4.$EVENT)(ctx, state2, "Type", Type$0);
|
|
17522
17826
|
}
|
|
17523
|
-
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,
|
|
17827
|
+
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) {
|
|
17524
17828
|
var optionalPrefix = $1;
|
|
17525
17829
|
var t = $2;
|
|
17526
17830
|
var ops = $3;
|