@danielx/civet 0.7.29 → 0.7.30
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 +6 -0
- package/dist/browser.js +261 -83
- package/dist/main.js +261 -83
- package/dist/main.mjs +261 -83
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ This changelog is generated automatically by [`build/changelog.civet`](build/cha
|
|
|
4
4
|
For each version of Civet, it lists and links to all incorporated PRs,
|
|
5
5
|
as well as a full diff and commit list.
|
|
6
6
|
|
|
7
|
+
## 0.7.30 (2024-09-15, [diff](https://github.com/DanielXMoore/Civet/compare/v0.7.29...v0.7.30), [commits](https://github.com/DanielXMoore/Civet/commits/v0.7.30))
|
|
8
|
+
* Fix `!` negated indented argument in function call [[#1393](https://github.com/DanielXMoore/Civet/pull/1393)]
|
|
9
|
+
* `break with` and `continue with` for modifying results array in a loop [[#1396](https://github.com/DanielXMoore/Civet/pull/1396)]
|
|
10
|
+
* `break/continue [label] with` and better error handling [[#1397](https://github.com/DanielXMoore/Civet/pull/1397)]
|
|
11
|
+
* `for*`, `loop*`, `while*`, `do*` generator expressions [[#1398](https://github.com/DanielXMoore/Civet/pull/1398)]
|
|
12
|
+
|
|
7
13
|
## 0.7.29 (2024-09-04, [diff](https://github.com/DanielXMoore/Civet/compare/v0.7.28...v0.7.29), [commits](https://github.com/DanielXMoore/Civet/commits/v0.7.29))
|
|
8
14
|
* Lexical declarations as JSX code children [[#1387](https://github.com/DanielXMoore/Civet/pull/1387)]
|
|
9
15
|
* Postfix `if`/`unless` in type declaration [[#1388](https://github.com/DanielXMoore/Civet/pull/1388)]
|
package/dist/browser.js
CHANGED
|
@@ -685,7 +685,7 @@ ${body}`;
|
|
|
685
685
|
"ForStatement",
|
|
686
686
|
"IfStatement",
|
|
687
687
|
"IterationStatement",
|
|
688
|
-
"
|
|
688
|
+
"LabelledStatement",
|
|
689
689
|
"ReturnStatement",
|
|
690
690
|
"SwitchStatement",
|
|
691
691
|
"ThrowStatement",
|
|
@@ -730,13 +730,16 @@ ${body}`;
|
|
|
730
730
|
return node.expressions.some((s) => isExit(s[1]));
|
|
731
731
|
}
|
|
732
732
|
case "IterationStatement": {
|
|
733
|
-
return node
|
|
733
|
+
return isLoopStatement(node) && gatherRecursiveWithinFunction(node.block, ($) => $.type === "BreakStatement").length === 0;
|
|
734
734
|
}
|
|
735
735
|
default: {
|
|
736
736
|
return false;
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
+
function isLoopStatement(node) {
|
|
741
|
+
return node.type === "IterationStatement" && node.condition?.type === "ParenthesizedExpression" && node.condition.expression?.type === "Literal" && node.condition.expression?.raw === "true";
|
|
742
|
+
}
|
|
740
743
|
function isComma(node) {
|
|
741
744
|
if (node?.token === ",") {
|
|
742
745
|
return node;
|
|
@@ -1102,7 +1105,7 @@ ${body}`;
|
|
|
1102
1105
|
}
|
|
1103
1106
|
return ["(", type, ")"];
|
|
1104
1107
|
}
|
|
1105
|
-
function wrapIIFE(expressions, asyncFlag) {
|
|
1108
|
+
function wrapIIFE(expressions, asyncFlag, generator) {
|
|
1106
1109
|
let prefix;
|
|
1107
1110
|
const async = [];
|
|
1108
1111
|
if (asyncFlag) {
|
|
@@ -1128,23 +1131,49 @@ ${body}`;
|
|
|
1128
1131
|
};
|
|
1129
1132
|
const signature = {
|
|
1130
1133
|
modifier: {
|
|
1131
|
-
async: !!async.length
|
|
1134
|
+
async: !!async.length,
|
|
1135
|
+
generator: !!generator
|
|
1132
1136
|
},
|
|
1133
1137
|
returnType: void 0
|
|
1134
1138
|
};
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1139
|
+
let fn;
|
|
1140
|
+
if (generator) {
|
|
1141
|
+
fn = makeNode({
|
|
1142
|
+
type: "FunctionExpression",
|
|
1143
|
+
signature,
|
|
1144
|
+
parameters,
|
|
1145
|
+
returnType: void 0,
|
|
1146
|
+
ts: false,
|
|
1147
|
+
async,
|
|
1148
|
+
block,
|
|
1149
|
+
generator,
|
|
1150
|
+
children: [async, "function", generator, parameters, block]
|
|
1151
|
+
});
|
|
1152
|
+
} else {
|
|
1153
|
+
fn = makeNode({
|
|
1154
|
+
type: "ArrowFunction",
|
|
1155
|
+
signature,
|
|
1156
|
+
parameters,
|
|
1157
|
+
returnType: void 0,
|
|
1158
|
+
ts: false,
|
|
1159
|
+
async,
|
|
1160
|
+
block,
|
|
1161
|
+
children: [async, parameters, "=>", block]
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
const children = [makeLeftHandSideExpression(fn), "()"];
|
|
1165
|
+
if (fn.type === "FunctionExpression") {
|
|
1166
|
+
if (gatherRecursiveWithinFunction(block, (a1) => typeof a1 === "object" && a1 != null && "token" in a1 && a1.token === "this").length) {
|
|
1167
|
+
children.splice(1, 0, ".bind(this)");
|
|
1168
|
+
}
|
|
1169
|
+
if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
|
|
1170
|
+
let ref2;
|
|
1171
|
+
children[children.length - 1] = (ref2 = parameters.children)[ref2.length - 1] = "(arguments)";
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1145
1174
|
const exp = makeNode({
|
|
1146
1175
|
type: "CallExpression",
|
|
1147
|
-
children
|
|
1176
|
+
children
|
|
1148
1177
|
});
|
|
1149
1178
|
if (prefix) {
|
|
1150
1179
|
return makeLeftHandSideExpression([prefix, exp]);
|
|
@@ -1765,7 +1794,7 @@ ${body}`;
|
|
|
1765
1794
|
({ type } = exp);
|
|
1766
1795
|
}
|
|
1767
1796
|
let ref4;
|
|
1768
|
-
switch (
|
|
1797
|
+
switch (type) {
|
|
1769
1798
|
case "BreakStatement":
|
|
1770
1799
|
case "ContinueStatement":
|
|
1771
1800
|
case "DebuggerStatement":
|
|
@@ -1986,6 +2015,58 @@ ${body}`;
|
|
|
1986
2015
|
return insertReturn(clause);
|
|
1987
2016
|
});
|
|
1988
2017
|
}
|
|
2018
|
+
function processBreakContinueWith(statement) {
|
|
2019
|
+
let changed = false;
|
|
2020
|
+
for (const control of gatherRecursiveWithinFunction(
|
|
2021
|
+
statement.block,
|
|
2022
|
+
($) => $.type === "BreakStatement" || $.type === "ContinueStatement"
|
|
2023
|
+
)) {
|
|
2024
|
+
let controlName2 = function() {
|
|
2025
|
+
switch (control.type) {
|
|
2026
|
+
case "BreakStatement": {
|
|
2027
|
+
return "break";
|
|
2028
|
+
}
|
|
2029
|
+
case "ContinueStatement": {
|
|
2030
|
+
return "continue";
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
var controlName = controlName2;
|
|
2035
|
+
if (control.with) {
|
|
2036
|
+
if (control.label) {
|
|
2037
|
+
let m1;
|
|
2038
|
+
if (!(m1 = statement.parent, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "LabelledStatement" && "label" in m1 && typeof m1.label === "object" && m1.label != null && "name" in m1.label && m1.label.name === control.label.name)) {
|
|
2039
|
+
continue;
|
|
2040
|
+
}
|
|
2041
|
+
} else {
|
|
2042
|
+
const { ancestor } = findAncestor(
|
|
2043
|
+
control,
|
|
2044
|
+
(s) => s === statement || s.type === "IterationStatement" || s.type === "ForStatement" || s.type === "SwitchStatement" && control.type === "BreakStatement"
|
|
2045
|
+
);
|
|
2046
|
+
if (!(ancestor === statement)) {
|
|
2047
|
+
continue;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
control.children.unshift(
|
|
2051
|
+
control.type === "BreakStatement" ? (changed = true, [statement.resultsRef, " =", control.with, ";"]) : (
|
|
2052
|
+
// control.type is "ContinueStatement"
|
|
2053
|
+
[statement.resultsRef, ".push(", trimFirstSpace(control.with), ");"]
|
|
2054
|
+
)
|
|
2055
|
+
);
|
|
2056
|
+
updateParentPointers(control.with, control);
|
|
2057
|
+
const i = control.children.findIndex(($1) => $1?.type === "Error");
|
|
2058
|
+
if (i >= 0) {
|
|
2059
|
+
control.children.splice(i, 1);
|
|
2060
|
+
}
|
|
2061
|
+
const block = control.parent;
|
|
2062
|
+
if (!(block?.type === "BlockStatement")) {
|
|
2063
|
+
throw new Error(`Expected parent of ${controlName2()} to be BlockStatement`);
|
|
2064
|
+
}
|
|
2065
|
+
braceBlock(block);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
return changed;
|
|
2069
|
+
}
|
|
1989
2070
|
function wrapIterationReturningResults(statement, outer, collect) {
|
|
1990
2071
|
if (statement.type === "DoStatement" || statement.type === "ComptimeStatement") {
|
|
1991
2072
|
if (collect) {
|
|
@@ -2001,14 +2082,37 @@ ${body}`;
|
|
|
2001
2082
|
"wrapIterationReturningResults should not be called twice on the same statement"
|
|
2002
2083
|
);
|
|
2003
2084
|
const resultsRef = statement.resultsRef = makeRef("results");
|
|
2085
|
+
let decl = "const";
|
|
2086
|
+
if (statement.type === "IterationStatement" || statement.type === "ForStatement") {
|
|
2087
|
+
if (processBreakContinueWith(statement)) {
|
|
2088
|
+
decl = "let";
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
const breakWithOnly = decl === "let" && isLoopStatement(statement) && gatherRecursive(
|
|
2092
|
+
statement.block,
|
|
2093
|
+
(s) => s.type === "BreakStatement" && !s.with,
|
|
2094
|
+
(s) => isFunction(s) || s.type === "IterationStatement"
|
|
2095
|
+
).length === 0;
|
|
2004
2096
|
const declaration = {
|
|
2005
2097
|
type: "Declaration",
|
|
2006
|
-
children: ["
|
|
2098
|
+
children: [decl, " ", resultsRef],
|
|
2099
|
+
decl,
|
|
2100
|
+
names: [],
|
|
2101
|
+
bindings: []
|
|
2007
2102
|
};
|
|
2103
|
+
if (decl === "const") {
|
|
2104
|
+
declaration.children.push("=[]");
|
|
2105
|
+
} else {
|
|
2106
|
+
if (!breakWithOnly) {
|
|
2107
|
+
declaration.children.push(";", resultsRef, "=[]");
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2008
2110
|
outer.children.unshift(["", declaration, ";"]);
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2111
|
+
if (!breakWithOnly) {
|
|
2112
|
+
assignResults(statement.block, (node) => {
|
|
2113
|
+
return [resultsRef, ".push(", node, ")"];
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2012
2116
|
if (collect) {
|
|
2013
2117
|
statement.children.push(collect(resultsRef));
|
|
2014
2118
|
} else {
|
|
@@ -2074,8 +2178,8 @@ ${body}`;
|
|
|
2074
2178
|
}
|
|
2075
2179
|
if (hasYield(block) && !f.generator?.length) {
|
|
2076
2180
|
if (f.type === "ArrowFunction") {
|
|
2077
|
-
gatherRecursiveWithinFunction(block, ($) =>
|
|
2078
|
-
const i = y.children.findIndex(($
|
|
2181
|
+
gatherRecursiveWithinFunction(block, ($2) => $2.type === "YieldExpression").forEach((y) => {
|
|
2182
|
+
const i = y.children.findIndex(($3) => $3.type === "Yield");
|
|
2079
2183
|
return y.children.splice(i + 1, 0, {
|
|
2080
2184
|
type: "Error",
|
|
2081
2185
|
message: "Can't use yield inside of => arrow function"
|
|
@@ -2103,31 +2207,55 @@ ${body}`;
|
|
|
2103
2207
|
});
|
|
2104
2208
|
}
|
|
2105
2209
|
function expressionizeIteration(exp) {
|
|
2106
|
-
const { async, subtype, block, children, statement } = exp;
|
|
2210
|
+
const { async, generator, subtype, block, children, statement } = exp;
|
|
2107
2211
|
const i = children.indexOf(statement);
|
|
2108
2212
|
if (i < 0) {
|
|
2109
2213
|
throw new Error("Could not find iteration statement in iteration expression");
|
|
2110
2214
|
}
|
|
2111
2215
|
if (subtype === "DoStatement" || subtype === "ComptimeStatement") {
|
|
2112
|
-
children.splice(i, 1, wrapIIFE([["", statement, void 0]], async));
|
|
2216
|
+
children.splice(i, 1, wrapIIFE([["", statement, void 0]], async, generator));
|
|
2113
2217
|
updateParentPointers(exp);
|
|
2114
2218
|
return;
|
|
2115
2219
|
}
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
[
|
|
2129
|
-
|
|
2130
|
-
|
|
2220
|
+
if (generator) {
|
|
2221
|
+
assignResults(block, (node) => {
|
|
2222
|
+
return {
|
|
2223
|
+
type: "YieldExpression",
|
|
2224
|
+
expression: node,
|
|
2225
|
+
children: ["yield ", node]
|
|
2226
|
+
};
|
|
2227
|
+
});
|
|
2228
|
+
braceBlock(block);
|
|
2229
|
+
children.splice(
|
|
2230
|
+
i,
|
|
2231
|
+
1,
|
|
2232
|
+
wrapIIFE([
|
|
2233
|
+
["", statement, void 0],
|
|
2234
|
+
// Prevent implicit return in generator, by adding an explicit return
|
|
2235
|
+
["", {
|
|
2236
|
+
type: "ReturnStatement",
|
|
2237
|
+
expression: void 0,
|
|
2238
|
+
children: [";return"]
|
|
2239
|
+
}, void 0]
|
|
2240
|
+
], async, generator)
|
|
2241
|
+
);
|
|
2242
|
+
} else {
|
|
2243
|
+
exp.resultsRef ??= makeRef("results");
|
|
2244
|
+
const { resultsRef } = exp;
|
|
2245
|
+
assignResults(block, (node) => {
|
|
2246
|
+
return [resultsRef, ".push(", node, ")"];
|
|
2247
|
+
});
|
|
2248
|
+
braceBlock(block);
|
|
2249
|
+
children.splice(
|
|
2250
|
+
i,
|
|
2251
|
+
1,
|
|
2252
|
+
wrapIIFE([
|
|
2253
|
+
["", ["const ", resultsRef, "=[]"], ";"],
|
|
2254
|
+
["", statement, void 0],
|
|
2255
|
+
["", wrapWithReturn(resultsRef)]
|
|
2256
|
+
], async)
|
|
2257
|
+
);
|
|
2258
|
+
}
|
|
2131
2259
|
updateParentPointers(exp);
|
|
2132
2260
|
}
|
|
2133
2261
|
function skipImplicitArguments(args) {
|
|
@@ -2141,7 +2269,7 @@ ${body}`;
|
|
|
2141
2269
|
return false;
|
|
2142
2270
|
}
|
|
2143
2271
|
function processCoffeeDo(ws, expression) {
|
|
2144
|
-
ws =
|
|
2272
|
+
ws = trimFirstSpace(ws);
|
|
2145
2273
|
const args = [];
|
|
2146
2274
|
if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
|
|
2147
2275
|
const { parameters } = expression;
|
|
@@ -2175,7 +2303,7 @@ ${body}`;
|
|
|
2175
2303
|
expression = {
|
|
2176
2304
|
...expression,
|
|
2177
2305
|
parameters: newParameters,
|
|
2178
|
-
children: expression.children.map(($
|
|
2306
|
+
children: expression.children.map(($4) => $4 === parameters ? newParameters : $4)
|
|
2179
2307
|
};
|
|
2180
2308
|
}
|
|
2181
2309
|
return {
|
|
@@ -2196,7 +2324,7 @@ ${body}`;
|
|
|
2196
2324
|
ref = makeRef("$");
|
|
2197
2325
|
inplacePrepend(ref, body);
|
|
2198
2326
|
}
|
|
2199
|
-
if (startsWithPredicate(body, ($
|
|
2327
|
+
if (startsWithPredicate(body, ($5) => $5.type === "ObjectExpression")) {
|
|
2200
2328
|
body = makeLeftHandSideExpression(body);
|
|
2201
2329
|
}
|
|
2202
2330
|
const parameters = makeNode({
|
|
@@ -3457,7 +3585,7 @@ ${body}`;
|
|
|
3457
3585
|
const blockStatement = ["", statementExp];
|
|
3458
3586
|
let ref;
|
|
3459
3587
|
if (statementExp.type === "IterationExpression") {
|
|
3460
|
-
if (statementExp.async) {
|
|
3588
|
+
if (statementExp.async || statementExp.generator) {
|
|
3461
3589
|
return;
|
|
3462
3590
|
}
|
|
3463
3591
|
const statement2 = statementExp.statement;
|
|
@@ -6020,7 +6148,8 @@ ${js}`
|
|
|
6020
6148
|
type: "IterationExpression",
|
|
6021
6149
|
children: [statement],
|
|
6022
6150
|
block: statement.block,
|
|
6023
|
-
statement
|
|
6151
|
+
statement,
|
|
6152
|
+
generator: statement.generator
|
|
6024
6153
|
};
|
|
6025
6154
|
}
|
|
6026
6155
|
case "IfStatement": {
|
|
@@ -6547,6 +6676,7 @@ ${js}`
|
|
|
6547
6676
|
ReservedBinary,
|
|
6548
6677
|
ArgumentsWithTrailingMemberExpressions,
|
|
6549
6678
|
TrailingMemberExpressions,
|
|
6679
|
+
IndentedTrailingMemberExpression,
|
|
6550
6680
|
AllowedTrailingMemberExpressions,
|
|
6551
6681
|
TrailingCallExpressions,
|
|
6552
6682
|
AllowedTrailingCallExpressions,
|
|
@@ -6815,6 +6945,7 @@ ${js}`
|
|
|
6815
6945
|
BlockStatement,
|
|
6816
6946
|
LabelledStatement,
|
|
6817
6947
|
Label,
|
|
6948
|
+
LabelIdentifier,
|
|
6818
6949
|
LabelledItem,
|
|
6819
6950
|
IfStatement,
|
|
6820
6951
|
ElseClause,
|
|
@@ -7874,7 +8005,7 @@ ${js}`
|
|
|
7874
8005
|
function ExplicitArguments(ctx, state2) {
|
|
7875
8006
|
return (0, import_lib3.$EVENT)(ctx, state2, "ExplicitArguments", ExplicitArguments$0);
|
|
7876
8007
|
}
|
|
7877
|
-
var ApplicationStart$0 = (0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$Y)((0, import_lib3.$S)(IndentedFurther, (0, import_lib3.$N)(IdentifierBinaryOp), (0, import_lib3.$N)(
|
|
8008
|
+
var ApplicationStart$0 = (0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$Y)((0, import_lib3.$S)(IndentedFurther, (0, import_lib3.$N)(IdentifierBinaryOp))), (0, import_lib3.$N)(IndentedTrailingMemberExpression));
|
|
7878
8009
|
var ApplicationStart$1 = (0, import_lib3.$S)((0, import_lib3.$N)(EOS), (0, import_lib3.$Y)((0, import_lib3.$S)(_, (0, import_lib3.$C)(BracedApplicationAllowed, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($L1, 'ApplicationStart "{"'))), (0, import_lib3.$N)(ForbiddenImplicitCalls))));
|
|
7879
8010
|
var ApplicationStart$$ = [ApplicationStart$0, ApplicationStart$1];
|
|
7880
8011
|
function ApplicationStart(ctx, state2) {
|
|
@@ -7915,20 +8046,20 @@ ${js}`
|
|
|
7915
8046
|
function ArgumentsWithTrailingMemberExpressions(ctx, state2) {
|
|
7916
8047
|
return (0, import_lib3.$EVENT)(ctx, state2, "ArgumentsWithTrailingMemberExpressions", ArgumentsWithTrailingMemberExpressions$0);
|
|
7917
8048
|
}
|
|
7918
|
-
var TrailingMemberExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(MemberExpressionRest), (0, import_lib3.$Q)(
|
|
7919
|
-
return
|
|
7920
|
-
if (Array.isArray(memberExpressionRest)) {
|
|
7921
|
-
return [ws, ...memberExpressionRest];
|
|
7922
|
-
}
|
|
7923
|
-
return {
|
|
7924
|
-
...memberExpressionRest,
|
|
7925
|
-
children: [ws, ...memberExpressionRest.children]
|
|
7926
|
-
};
|
|
7927
|
-
}));
|
|
8049
|
+
var TrailingMemberExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(MemberExpressionRest), (0, import_lib3.$Q)(IndentedTrailingMemberExpression)), function($skip, $loc, $0, $1, $2) {
|
|
8050
|
+
return [...$1, ...$2];
|
|
7928
8051
|
});
|
|
7929
8052
|
function TrailingMemberExpressions(ctx, state2) {
|
|
7930
8053
|
return (0, import_lib3.$EVENT)(ctx, state2, "TrailingMemberExpressions", TrailingMemberExpressions$0);
|
|
7931
8054
|
}
|
|
8055
|
+
var IndentedTrailingMemberExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(IndentedAtLeast, (0, import_lib3.$Y)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$EXPECT)($L6, 'IndentedTrailingMemberExpression "?"')), (0, import_lib3.$EXPECT)($L7, 'IndentedTrailingMemberExpression "."'), (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R3, "IndentedTrailingMemberExpression /[0-9]/")))), MemberExpressionRest), function($skip, $loc, $0, $1, $2, $3) {
|
|
8056
|
+
var ws = $1;
|
|
8057
|
+
var rest = $3;
|
|
8058
|
+
return prepend(ws, rest);
|
|
8059
|
+
});
|
|
8060
|
+
function IndentedTrailingMemberExpression(ctx, state2) {
|
|
8061
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "IndentedTrailingMemberExpression", IndentedTrailingMemberExpression$0);
|
|
8062
|
+
}
|
|
7932
8063
|
var AllowedTrailingMemberExpressions$0 = (0, import_lib3.$T)((0, import_lib3.$S)(TrailingMemberPropertyAllowed, TrailingMemberExpressions), function(value) {
|
|
7933
8064
|
return value[1];
|
|
7934
8065
|
});
|
|
@@ -12472,8 +12603,10 @@ ${js}`
|
|
|
12472
12603
|
var Statement$2 = (0, import_lib3.$T)((0, import_lib3.$S)(IfStatement, (0, import_lib3.$N)(ShouldExpressionize)), function(value) {
|
|
12473
12604
|
return value[0];
|
|
12474
12605
|
});
|
|
12475
|
-
var Statement$3 = (0, import_lib3.$
|
|
12476
|
-
|
|
12606
|
+
var Statement$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(IterationStatement, (0, import_lib3.$N)(ShouldExpressionize)), function($skip, $loc, $0, $1, $2) {
|
|
12607
|
+
if ($1.generator)
|
|
12608
|
+
return $skip;
|
|
12609
|
+
return $1;
|
|
12477
12610
|
});
|
|
12478
12611
|
var Statement$4 = (0, import_lib3.$T)((0, import_lib3.$S)(SwitchStatement, (0, import_lib3.$N)(ShouldExpressionize)), function(value) {
|
|
12479
12612
|
return value[0];
|
|
@@ -12544,11 +12677,22 @@ ${js}`
|
|
|
12544
12677
|
var colon = $1;
|
|
12545
12678
|
var id = $2;
|
|
12546
12679
|
var w = $3;
|
|
12547
|
-
return
|
|
12680
|
+
return {
|
|
12681
|
+
type: "Label",
|
|
12682
|
+
name: id.name,
|
|
12683
|
+
children: [id, colon, w]
|
|
12684
|
+
};
|
|
12548
12685
|
});
|
|
12549
12686
|
function Label(ctx, state2) {
|
|
12550
12687
|
return (0, import_lib3.$EVENT)(ctx, state2, "Label", Label$0);
|
|
12551
12688
|
}
|
|
12689
|
+
var LabelIdentifier$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)(Colon), Identifier), function(value) {
|
|
12690
|
+
var id = value[1];
|
|
12691
|
+
return id;
|
|
12692
|
+
});
|
|
12693
|
+
function LabelIdentifier(ctx, state2) {
|
|
12694
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "LabelIdentifier", LabelIdentifier$0);
|
|
12695
|
+
}
|
|
12552
12696
|
var LabelledItem$0 = Statement;
|
|
12553
12697
|
var LabelledItem$1 = FunctionDeclaration;
|
|
12554
12698
|
var LabelledItem$$ = [LabelledItem$0, LabelledItem$1];
|
|
@@ -12645,7 +12789,8 @@ ${js}`
|
|
|
12645
12789
|
children: [statement],
|
|
12646
12790
|
block: statement.block,
|
|
12647
12791
|
statement,
|
|
12648
|
-
async
|
|
12792
|
+
async,
|
|
12793
|
+
generator: statement.generator
|
|
12649
12794
|
};
|
|
12650
12795
|
});
|
|
12651
12796
|
function IterationExpression(ctx, state2) {
|
|
@@ -12664,8 +12809,9 @@ ${js}`
|
|
|
12664
12809
|
function LoopStatement(ctx, state2) {
|
|
12665
12810
|
return (0, import_lib3.$EVENT)(ctx, state2, "LoopStatement", LoopStatement$0);
|
|
12666
12811
|
}
|
|
12667
|
-
var LoopClause$0 = (0, import_lib3.$
|
|
12668
|
-
var kind = $
|
|
12812
|
+
var LoopClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Loop, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star))), function($skip, $loc, $0, $1, $2) {
|
|
12813
|
+
var kind = $1;
|
|
12814
|
+
var generator = $2;
|
|
12669
12815
|
const expression = {
|
|
12670
12816
|
type: "Literal",
|
|
12671
12817
|
children: ["true"],
|
|
@@ -12680,33 +12826,41 @@ ${js}`
|
|
|
12680
12826
|
type: "IterationStatement",
|
|
12681
12827
|
subtype: kind.token,
|
|
12682
12828
|
children: [kind, condition],
|
|
12683
|
-
condition
|
|
12829
|
+
condition,
|
|
12830
|
+
generator
|
|
12684
12831
|
};
|
|
12685
12832
|
});
|
|
12686
12833
|
function LoopClause(ctx, state2) {
|
|
12687
12834
|
return (0, import_lib3.$EVENT)(ctx, state2, "LoopClause", LoopClause$0);
|
|
12688
12835
|
}
|
|
12689
|
-
var DoWhileStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, NoPostfixBracedOrEmptyBlock, __, WhileClause), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12690
|
-
var
|
|
12691
|
-
var
|
|
12836
|
+
var DoWhileStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), NoPostfixBracedOrEmptyBlock, __, WhileClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12837
|
+
var d = $1;
|
|
12838
|
+
var generator = $2;
|
|
12839
|
+
var block = $3;
|
|
12840
|
+
var ws = $4;
|
|
12841
|
+
var clause = $5;
|
|
12692
12842
|
return {
|
|
12693
12843
|
...clause,
|
|
12694
12844
|
type: "IterationStatement",
|
|
12695
12845
|
subtype: "do-while",
|
|
12696
|
-
children:
|
|
12697
|
-
block
|
|
12846
|
+
children: [d, block, ws, clause],
|
|
12847
|
+
block,
|
|
12848
|
+
generator
|
|
12698
12849
|
};
|
|
12699
12850
|
});
|
|
12700
12851
|
function DoWhileStatement(ctx, state2) {
|
|
12701
12852
|
return (0, import_lib3.$EVENT)(ctx, state2, "DoWhileStatement", DoWhileStatement$0);
|
|
12702
12853
|
}
|
|
12703
|
-
var DoStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, NoPostfixBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2) {
|
|
12704
|
-
var
|
|
12854
|
+
var DoStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), NoPostfixBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
12855
|
+
var d = $1;
|
|
12856
|
+
var generator = $2;
|
|
12857
|
+
var block = $3;
|
|
12705
12858
|
block = trimFirstSpace(block);
|
|
12706
12859
|
return {
|
|
12707
12860
|
type: "DoStatement",
|
|
12708
12861
|
children: [block],
|
|
12709
|
-
block
|
|
12862
|
+
block,
|
|
12863
|
+
generator
|
|
12710
12864
|
};
|
|
12711
12865
|
});
|
|
12712
12866
|
function DoStatement(ctx, state2) {
|
|
@@ -12741,10 +12895,11 @@ ${js}`
|
|
|
12741
12895
|
function WhileStatement(ctx, state2) {
|
|
12742
12896
|
return (0, import_lib3.$EVENT)(ctx, state2, "WhileStatement", WhileStatement$0);
|
|
12743
12897
|
}
|
|
12744
|
-
var WhileClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(While, Until), (0, import_lib3.$E)(_), Condition), function($skip, $loc, $0, $1, $2, $3) {
|
|
12898
|
+
var WhileClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(While, Until), (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), (0, import_lib3.$E)(_), Condition), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12745
12899
|
var kind = $1;
|
|
12746
|
-
var
|
|
12747
|
-
var
|
|
12900
|
+
var generator = $2;
|
|
12901
|
+
var ws = $3;
|
|
12902
|
+
var condition = $4;
|
|
12748
12903
|
if (kind.negated) {
|
|
12749
12904
|
kind = { ...kind, token: "while" };
|
|
12750
12905
|
condition = negateCondition(condition);
|
|
@@ -12754,6 +12909,7 @@ ${js}`
|
|
|
12754
12909
|
subtype: kind.token,
|
|
12755
12910
|
children: [kind, ws, condition],
|
|
12756
12911
|
condition,
|
|
12912
|
+
generator,
|
|
12757
12913
|
negated: kind.negated
|
|
12758
12914
|
};
|
|
12759
12915
|
});
|
|
@@ -12773,16 +12929,18 @@ ${js}`
|
|
|
12773
12929
|
function ForStatement(ctx, state2) {
|
|
12774
12930
|
return (0, import_lib3.$EVENT)(ctx, state2, "ForStatement", ForStatement$0);
|
|
12775
12931
|
}
|
|
12776
|
-
var ForClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(For, __, ForStatementControl), function($skip, $loc, $0, $1, $2, $3) {
|
|
12777
|
-
var
|
|
12932
|
+
var ForClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(For, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), __, ForStatementControl), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12933
|
+
var generator = $2;
|
|
12934
|
+
var c = $4;
|
|
12778
12935
|
const { children, declaration } = c;
|
|
12779
12936
|
return {
|
|
12780
12937
|
type: "ForStatement",
|
|
12781
|
-
children: [$1, ...$
|
|
12938
|
+
children: [$1, ...$3, ...children],
|
|
12782
12939
|
declaration,
|
|
12783
12940
|
block: null,
|
|
12784
12941
|
blockPrefix: c.blockPrefix,
|
|
12785
|
-
hoistDec: c.hoistDec
|
|
12942
|
+
hoistDec: c.hoistDec,
|
|
12943
|
+
generator
|
|
12786
12944
|
};
|
|
12787
12945
|
});
|
|
12788
12946
|
function ForClause(ctx, state2) {
|
|
@@ -13549,11 +13707,21 @@ ${js}`
|
|
|
13549
13707
|
function ExpressionStatement(ctx, state2) {
|
|
13550
13708
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ExpressionStatement", ExpressionStatement$$);
|
|
13551
13709
|
}
|
|
13552
|
-
var KeywordStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Break, (0, import_lib3.$E)((0, import_lib3.$S)(_, (0, import_lib3.$E)(
|
|
13710
|
+
var KeywordStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Break, (0, import_lib3.$E)((0, import_lib3.$S)(_, LabelIdentifier)), (0, import_lib3.$E)((0, import_lib3.$S)(_, With, MaybeNestedExtendedExpression))), function($skip, $loc, $0, $1, $2, $3) {
|
|
13711
|
+
const children = [$1];
|
|
13712
|
+
if ($2)
|
|
13713
|
+
children.push($2);
|
|
13714
|
+
if ($3)
|
|
13715
|
+
children.push({
|
|
13716
|
+
type: "Error",
|
|
13717
|
+
subtype: "Warning",
|
|
13718
|
+
message: "'break with' outside of loop that returns a value"
|
|
13719
|
+
});
|
|
13553
13720
|
return {
|
|
13554
13721
|
type: "BreakStatement",
|
|
13555
|
-
|
|
13556
|
-
|
|
13722
|
+
label: $2?.[1],
|
|
13723
|
+
with: $3?.[2],
|
|
13724
|
+
children
|
|
13557
13725
|
};
|
|
13558
13726
|
});
|
|
13559
13727
|
var KeywordStatement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Continue, _, Switch), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -13563,11 +13731,21 @@ ${js}`
|
|
|
13563
13731
|
children: []
|
|
13564
13732
|
};
|
|
13565
13733
|
});
|
|
13566
|
-
var KeywordStatement$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Continue, (0, import_lib3.$E)((0, import_lib3.$S)(_, (0, import_lib3.$E)(
|
|
13734
|
+
var KeywordStatement$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Continue, (0, import_lib3.$E)((0, import_lib3.$S)(_, LabelIdentifier)), (0, import_lib3.$E)((0, import_lib3.$S)(_, With, MaybeNestedExtendedExpression))), function($skip, $loc, $0, $1, $2, $3) {
|
|
13735
|
+
const children = [$1];
|
|
13736
|
+
if ($2)
|
|
13737
|
+
children.push($2);
|
|
13738
|
+
if ($3)
|
|
13739
|
+
children.push({
|
|
13740
|
+
type: "Error",
|
|
13741
|
+
subtype: "Warning",
|
|
13742
|
+
message: "'continue with' outside of loop that returns a value"
|
|
13743
|
+
});
|
|
13567
13744
|
return {
|
|
13568
13745
|
type: "ContinueStatement",
|
|
13569
|
-
|
|
13570
|
-
|
|
13746
|
+
label: $2?.[1],
|
|
13747
|
+
with: $3?.[2],
|
|
13748
|
+
children
|
|
13571
13749
|
};
|
|
13572
13750
|
});
|
|
13573
13751
|
var KeywordStatement$3 = DebuggerStatement;
|